rake-terraform 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MTlhYzI2MGMxMjE4ZjNkMThlZDFjOWUxYzM5OWYyZjRlOWI2NDFlZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTc5NDMzZDA3YzEzMWY1OGU3ZGE4ZDA2M2IzMzU5NmI0YjgzZGRlMQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YzM0ZGIyOGRjZmJmNmI5OTc0Njk3ZTJjMzExN2M4ZDhiMWZmMWQ3ZTFiYTYx
|
10
|
+
MWVjN2U0ZWJiYTg0NDQ5MWUxZDg2N2Y0NWU3MWNlZGU3NGI0NTA1YjgyMTVj
|
11
|
+
N2NlMzgzNjVkNzhkNjliYzQ5ZmIwMWM5YTQxZTVlYjgwNzA0MWI=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MDVjMDQ3NzUyNTVkZDQyYWYyN2U3NzcyNzBiY2UzN2VmNjBlZDdiY2FjOWRk
|
14
|
+
MzBmMjMxMzFjNDg0MjQyOWJhZDdiNDkwZWRlZjYyYTFiYThkNTJiOWQzZDE3
|
15
|
+
ZDQ5YjJjZGQ2ZTU3Y2IwOTk5OTc5NmJmN2EzOTllNmY2MTI0YjQ=
|
@@ -8,7 +8,7 @@ module RakeTerraform
|
|
8
8
|
class BaseTask < Rake::Task
|
9
9
|
def validate_terraform_installed
|
10
10
|
error = 'Please ensure you have terraform installed and on your path!'
|
11
|
-
|
11
|
+
raise TerraformNotInstalled, error unless terraform_installed?
|
12
12
|
end
|
13
13
|
|
14
14
|
def terraform_installed?
|
@@ -20,9 +20,9 @@ module RakeTerraform
|
|
20
20
|
|
21
21
|
def get_aws_credentials(creds_file, project = 'default')
|
22
22
|
error = "Could not locate AWS credentials in #{creds_file}!"
|
23
|
-
|
23
|
+
raise error unless File.exist? File.expand_path(creds_file)
|
24
24
|
|
25
|
-
credentials = IniParse.parse(File.read(creds_file))
|
25
|
+
credentials = IniParse.parse(File.read(File.expand_path(creds_file)))
|
26
26
|
{ accesskey: credentials[project]['aws_access_key_id'],
|
27
27
|
secretkey: credentials[project]['aws_secret_access_key'] }
|
28
28
|
end
|
data/lib/rake-terraform/dsl.rb
CHANGED
@@ -30,7 +30,7 @@ module RakeTerraform
|
|
30
30
|
state_var = ENV['TERRAFORM_UNIQUE_STATE'].to_b
|
31
31
|
return false if state_var == false
|
32
32
|
unless tf_unique_state_valid?
|
33
|
-
|
33
|
+
raise(
|
34
34
|
ArgumentError,
|
35
35
|
'Both or neither of TERRAFORM_STATE_FILE or TERRAFORM_STATE_DIR_VAR' \
|
36
36
|
' given, or missing target for TERRAFORM_STATE_DIR_VAR'
|
@@ -46,7 +46,7 @@ module RakeTerraform
|
|
46
46
|
return state_dir_full_path if tf_state_dir_valid?
|
47
47
|
return nil if ENV['TERRAFORM_STATE_FILE'].nil?
|
48
48
|
unless tf_state_file_valid?
|
49
|
-
|
49
|
+
raise(
|
50
50
|
ArgumentError,
|
51
51
|
'Argument for TERRAFORM_STATE_FILE is invalid'
|
52
52
|
)
|
@@ -59,7 +59,7 @@ module RakeTerraform
|
|
59
59
|
def tf_state_dir_var
|
60
60
|
return nil if ENV['TERRAFORM_STATE_DIR_VAR'].nil?
|
61
61
|
unless tf_state_dir_var_valid?
|
62
|
-
|
62
|
+
raise(
|
63
63
|
ArgumentError,
|
64
64
|
'Argument for TERRAFORM_STATE_DIR_VAR is invalid'
|
65
65
|
)
|
@@ -72,7 +72,7 @@ module RakeTerraform
|
|
72
72
|
def tf_state_dir
|
73
73
|
return nil if ENV['TERRAFORM_STATE_DIR_VAR'].nil?
|
74
74
|
unless tf_state_dir_valid?
|
75
|
-
|
75
|
+
raise(
|
76
76
|
ArgumentError,
|
77
77
|
'Argument for TERRAFORM_STATE_DIR_VAR is invalid'
|
78
78
|
)
|
@@ -102,11 +102,8 @@ module RakeTerraform
|
|
102
102
|
def tf_unique_state_valid?
|
103
103
|
state_var = ENV['TERRAFORM_UNIQUE_STATE'].to_b
|
104
104
|
return true if state_var == false
|
105
|
-
if tf_state_file_valid? && tf_state_dir_var_valid?
|
106
|
-
|
107
|
-
else
|
108
|
-
tf_state_file_valid? || tf_state_dir_var_valid?
|
109
|
-
end
|
105
|
+
return false if tf_state_file_valid? && tf_state_dir_var_valid?
|
106
|
+
tf_state_file_valid? || tf_state_dir_var_valid?
|
110
107
|
end
|
111
108
|
|
112
109
|
# validate tf_state_file_valid?
|
@@ -132,7 +129,7 @@ module RakeTerraform
|
|
132
129
|
value =~ /^[a-z0-9_]+$/i
|
133
130
|
end
|
134
131
|
|
135
|
-
|
132
|
+
alias tf_state_dir_valid? tf_state_dir_var_valid?
|
136
133
|
|
137
134
|
# name of the default state file
|
138
135
|
def default_state_file_name
|
@@ -29,7 +29,7 @@ module RakeTerraform
|
|
29
29
|
cmd << " -var access_key=\"#{access_key}\""
|
30
30
|
cmd << " -var secret_key=\"#{secret_key}\""
|
31
31
|
elsif access_key || secret_key
|
32
|
-
|
32
|
+
raise ArgumentError, 'Only one of access_key or secret_key given'
|
33
33
|
end
|
34
34
|
output_file && cmd << " -out #{output_file}"
|
35
35
|
system(cmd)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rake-terraform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Norm MacLennan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|