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
- NWE5MWZmZDg3OGZlNWE4YmNkNmVhY2U3NTFkZGFmODhiMGMzOWE1MA==
4
+ MTlhYzI2MGMxMjE4ZjNkMThlZDFjOWUxYzM5OWYyZjRlOWI2NDFlZg==
5
5
  data.tar.gz: !binary |-
6
- NjA1MWMyZjY1YjljN2U0NjM3MTY3OTM2Y2I0YzlmNTQ4NzhhOTAyNA==
6
+ OTc5NDMzZDA3YzEzMWY1OGU3ZGE4ZDA2M2IzMzU5NmI0YjgzZGRlMQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YTFkNjY4MjY4MDkxNjNmZWNhYTQ1YTVmYWY4NWFhODkxYWY2YjJjZWE0YjM0
10
- ZjEwMjE3M2YzMjc1NDU4ZjU0N2Y5YjQ3NDAzYTc2ODUwOWU0OGI4NGE2ZjE2
11
- YmQzMWEwZWJkOWQwMmIxMTQyYmE4NmM5ODY0MDM3MWNiOWM2ZjE=
9
+ YzM0ZGIyOGRjZmJmNmI5OTc0Njk3ZTJjMzExN2M4ZDhiMWZmMWQ3ZTFiYTYx
10
+ MWVjN2U0ZWJiYTg0NDQ5MWUxZDg2N2Y0NWU3MWNlZGU3NGI0NTA1YjgyMTVj
11
+ N2NlMzgzNjVkNzhkNjliYzQ5ZmIwMWM5YTQxZTVlYjgwNzA0MWI=
12
12
  data.tar.gz: !binary |-
13
- NDJmZDc5YjE2YTQwMTVmMTU0NjJiYTQ4Y2ZjZGUxOWNlMWY2YTZjMWEwNDY5
14
- YmYwZmU2ZjEzNjNmMmU5YzQyNmJiMzIwMzllYmY0N2M0MTE1MWI0MDY0NmZm
15
- N2NkYWMxZDE5ZmQ1YzZmYmFlMTU0ZjYzNWJiOGQ1YWY5MjFmZjc=
13
+ MDVjMDQ3NzUyNTVkZDQyYWYyN2U3NzcyNzBiY2UzN2VmNjBlZDdiY2FjOWRk
14
+ MzBmMjMxMzFjNDg0MjQyOWJhZDdiNDkwZWRlZjYyYTFiYThkNTJiOWQzZDE3
15
+ ZDQ5YjJjZGQ2ZTU3Y2IwOTk5OTc5NmJmN2EzOTllNmY2MTI0YjQ=
@@ -36,7 +36,7 @@ module RakeTerraform
36
36
  end
37
37
 
38
38
  def ensure_plan_exists(plan)
39
- fail "Plan #{plan} does not exist! Aborting!" unless File.exist? plan
39
+ raise "Plan #{plan} does not exist! Aborting!" unless File.exist? plan
40
40
  end
41
41
  end
42
42
  end
@@ -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
- fail TerraformNotInstalled, error unless terraform_installed?
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
- fail error unless File.exist? creds_file
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
@@ -2,8 +2,6 @@ require 'rake'
2
2
 
3
3
  # Rake terraform
4
4
  module RakeTerraform
5
- private
6
-
7
5
  # Definitions of methods for custom rake tasks
8
6
  module DSL
9
7
  def terraform_plan(*args)
@@ -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
- fail(
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
- fail(
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
- fail(
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
- fail(
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
- return false
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
- alias_method :tf_state_dir_valid?, :tf_state_dir_var_valid?
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
- fail ArgumentError, 'Only one of access_key or secret_key given'
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)
@@ -1,4 +1,4 @@
1
1
  # Version of the gem
2
2
  module RakeTerraform
3
- VERSION = '0.2.0'
3
+ VERSION = '0.2.1'.freeze
4
4
  end
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.0
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: 2015-12-15 00:00:00.000000000 Z
11
+ date: 2016-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler