rake_terraform 0.16.0 → 0.17.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22997cbb19f9e46fbf4bb73c3d8109b04d854525
4
- data.tar.gz: 73fd1005337538954e104b7279120e203b181672
3
+ metadata.gz: da4531cbfecb1e320ceb6869d355684cfe101acc
4
+ data.tar.gz: ed0762087ae68f52a4ce71baffadecb5b85cb44f
5
5
  SHA512:
6
- metadata.gz: 977ffd227d56d2834a5bb384e1da0d6723f47bb4658b15bc604dd53d1eac856e3eb44d94b14f4ba3aedbec713692317066a47b251b118f6ef24b6fc88de59269
7
- data.tar.gz: c28d216bf3c7b3bd2344d991800d33337d067862ea018b3cdfd8597ffe4fd27dd5bc659cd91780b37fe2efbabd740b43c9ae5b650549e230a5d0c0d51602df36
6
+ metadata.gz: 13a23f739bb1d148b44d96effeb364488d25a5e84d5856c3c91e14aa46fff4f85bd74012ce1a62384aaa8a90038c22542aadc7dd41e7a5e8c8163bb5cc796d16
7
+ data.tar.gz: 003ef8eaa82ac25239eb9dce020fd3b387a824ed33b5b122800dfca207324768ed12ca47b685194a2053ead4de566d76a08147ab3ea8f8c9b758b424210f6053
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 0.17.0 (May 1st, 2018)
2
+
3
+ IMPROVEMENTS:
4
+
5
+ * A validate task is now included and installed as part of the default task
6
+ definition.
7
+
1
8
  ## 0.16.0 (September 28th, 2017)
2
9
 
3
10
  IMPROVEMENTS:
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_terraform (0.16.0)
4
+ rake_terraform (0.17.0)
5
5
  rake_dependencies (~> 0.15)
6
- ruby-terraform (~> 0.9)
6
+ ruby-terraform (~> 0.11)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
@@ -46,7 +46,7 @@ GEM
46
46
  diff-lcs (>= 1.2.0, < 2.0)
47
47
  rspec-support (~> 3.5.0)
48
48
  rspec-support (3.5.0)
49
- ruby-terraform (0.9.0)
49
+ ruby-terraform (0.11.2)
50
50
  lino (~> 1.1)
51
51
  rubyzip (1.2.1)
52
52
  thread_safe (0.3.5)
@@ -66,4 +66,4 @@ DEPENDENCIES
66
66
  rspec (~> 3.0)
67
67
 
68
68
  BUNDLED WITH
69
- 1.16.0.pre.2
69
+ 1.16.1
@@ -20,6 +20,9 @@ module RakeTerraform
20
20
 
21
21
  parameter :ensure_task, :default => :'terraform:ensure'
22
22
 
23
+ parameter :validate_task_name, :default => :validate
24
+ parameter :validate_argument_names
25
+
23
26
  parameter :plan_task_name, :default => :plan
24
27
  parameter :plan_argument_names
25
28
 
@@ -30,6 +33,23 @@ module RakeTerraform
30
33
  parameter :destroy_argument_names
31
34
 
32
35
  def define
36
+ Validate.new do |t|
37
+ t.name = validate_task_name
38
+ t.argument_names = validate_argument_names || argument_names || []
39
+
40
+ t.configuration_name = configuration_name
41
+ t.source_directory = source_directory
42
+ t.work_directory = work_directory
43
+
44
+ t.backend_config = backend_config
45
+
46
+ t.vars = vars
47
+ t.state_file = state_file
48
+
49
+ t.no_color = no_color
50
+
51
+ t.ensure_task = ensure_task
52
+ end
33
53
  Plan.new do |t|
34
54
  t.name = plan_task_name
35
55
  t.argument_names = plan_argument_names || argument_names || []
@@ -0,0 +1,69 @@
1
+ require 'ruby_terraform'
2
+ require 'ostruct'
3
+ require_relative '../tasklib'
4
+
5
+ module RakeTerraform
6
+ module Tasks
7
+ class Validate < TaskLib
8
+ parameter :name, :default => :validate
9
+ parameter :argument_names, :default => []
10
+
11
+ parameter :configuration_name, :required => true
12
+ parameter :source_directory, :required => true
13
+ parameter :work_directory, :required => true
14
+
15
+ parameter :backend_config
16
+
17
+ parameter :vars, default: {}
18
+ parameter :state_file
19
+
20
+ parameter :no_color, :default => false
21
+
22
+ parameter :ensure_task, :default => :'terraform:ensure'
23
+
24
+ def process_arguments(args)
25
+ self.name = args[0] if args[0]
26
+ end
27
+
28
+ def define
29
+ desc "Validate #{configuration_name} using terraform"
30
+ task name, argument_names => [ensure_task] do |_, args|
31
+ configuration_directory = File.join(work_directory, source_directory)
32
+
33
+ params = OpenStruct.new({
34
+ configuration_name: configuration_name,
35
+ source_directory: source_directory,
36
+ work_directory: work_directory,
37
+ configuration_directory: configuration_directory,
38
+ backend_config: backend_config,
39
+ state_file: state_file,
40
+ no_color: no_color,
41
+ })
42
+
43
+ derived_vars = vars.respond_to?(:call) ?
44
+ vars.call(*[args, params].slice(0, vars.arity)) :
45
+ vars
46
+ derived_state_file = state_file.respond_to?(:call) ?
47
+ state_file.call(
48
+ *[args, params].slice(0, state_file.arity)) :
49
+ state_file
50
+
51
+ puts "Validating #{configuration_name}"
52
+
53
+ RubyTerraform.clean(
54
+ directory: configuration_directory)
55
+
56
+ mkdir_p File.dirname(configuration_directory)
57
+ cp_r source_directory, configuration_directory
58
+
59
+ Dir.chdir(configuration_directory) do
60
+ RubyTerraform.validate(
61
+ no_color: no_color,
62
+ state: derived_state_file,
63
+ vars: derived_vars)
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -1,4 +1,5 @@
1
+ require_relative 'tasks/validate'
1
2
  require_relative 'tasks/plan'
2
3
  require_relative 'tasks/provision'
3
4
  require_relative 'tasks/destroy'
4
- require_relative 'tasks/all'
5
+ require_relative 'tasks/all'
@@ -1,3 +1,3 @@
1
1
  module RakeTerraform
2
- VERSION = "0.16.0"
2
+ VERSION = "0.17.0"
3
3
  end
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
22
22
  spec.require_paths = ['lib']
23
23
 
24
24
  spec.add_dependency 'rake_dependencies', '~> 0.15'
25
- spec.add_dependency 'ruby-terraform', '~> 0.9'
25
+ spec.add_dependency 'ruby-terraform', '~> 0.11'
26
26
 
27
27
  spec.add_development_dependency 'bundler', '~> 1.14'
28
28
  spec.add_development_dependency 'rake', '~> 11.0'
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.16.0
4
+ version: 0.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2018-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake_dependencies
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '0.11'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: '0.9'
40
+ version: '0.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -150,6 +150,7 @@ files:
150
150
  - lib/rake_terraform/tasks/destroy.rb
151
151
  - lib/rake_terraform/tasks/plan.rb
152
152
  - lib/rake_terraform/tasks/provision.rb
153
+ - lib/rake_terraform/tasks/validate.rb
153
154
  - lib/rake_terraform/version.rb
154
155
  - rake_terraform.gemspec
155
156
  homepage: https://github.com/tobyclemson/rake_terraform