terraform-wrapper 1.3.1 → 1.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,26 +1,23 @@
1
1
  ###############################################################################
2
2
 
3
3
  module TerraformWrapper
4
-
5
- ###############################################################################
4
+ #############################################################################
6
5
 
7
6
  module Tasks
8
-
9
- ###############################################################################
7
+ ###########################################################################
10
8
 
11
9
  class Taint < ::Rake::TaskLib
12
-
13
- ###############################################################################
10
+ #########################################################################
14
11
 
15
12
  include TerraformWrapper::Shared::Logging
16
13
 
17
- ###############################################################################
14
+ #########################################################################
18
15
 
19
16
  @binary
20
17
  @code
21
18
  @options
22
19
 
23
- ###############################################################################
20
+ #########################################################################
24
21
 
25
22
  def initialize(binary:, code:, options:)
26
23
  @binary = binary
@@ -32,14 +29,14 @@ module TerraformWrapper
32
29
  taint_task
33
30
  end
34
31
 
35
- ###############################################################################
32
+ #########################################################################
36
33
 
37
34
  def taint_task
38
- desc "Taint a piece of existing infrastructure so that Terraform recreates it at next apply."
39
- task :taint, [:config, :address] => :binary do |t, args|
40
- options = @options.merge({"name" => args[:config]})
35
+ desc 'Taint a piece of existing infrastructure so that Terraform recreates it at next apply.'
36
+ task :taint, %i[config address] => :binary do |_t, args|
37
+ options = @options.merge({ 'name' => args[:config] })
41
38
 
42
- logger.info("Processing configuration for Terraform taint...")
39
+ logger.info('Processing configuration for Terraform taint...')
43
40
 
44
41
  config = TerraformWrapper::Shared::Config.new(code: @code, options: options)
45
42
  runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code)
@@ -51,16 +48,13 @@ module TerraformWrapper
51
48
  end
52
49
  end
53
50
 
54
- ###############################################################################
55
-
51
+ #########################################################################
56
52
  end
57
53
 
58
- ###############################################################################
59
-
54
+ ###########################################################################
60
55
  end
61
56
 
62
- ###############################################################################
63
-
57
+ #############################################################################
64
58
  end
65
59
 
66
60
  ###############################################################################
@@ -1,25 +1,22 @@
1
1
  ###############################################################################
2
2
 
3
3
  module TerraformWrapper
4
-
5
- ###############################################################################
4
+ #############################################################################
6
5
 
7
6
  module Tasks
8
-
9
- ###############################################################################
7
+ ###########################################################################
10
8
 
11
9
  class Upgrade < ::Rake::TaskLib
12
-
13
- ###############################################################################
10
+ #########################################################################
14
11
 
15
12
  include TerraformWrapper::Shared::Logging
16
13
 
17
- ###############################################################################
14
+ #########################################################################
18
15
 
19
16
  @binary
20
17
  @code
21
18
 
22
- ###############################################################################
19
+ #########################################################################
23
20
 
24
21
  def initialize(binary:, code:)
25
22
  @binary = binary
@@ -30,11 +27,11 @@ module TerraformWrapper
30
27
  upgrade_task
31
28
  end
32
29
 
33
- ###############################################################################
30
+ #########################################################################
34
31
 
35
32
  def upgrade_task
36
- desc "Upgrades the Terraform infrastructure component modules, providers and lock file."
37
- task :upgrade => [:binary] do |t, args|
33
+ desc 'Upgrades the Terraform infrastructure component modules, providers and lock file.'
34
+ task upgrade: [:binary] do |_t, _args|
38
35
  runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code)
39
36
 
40
37
  logger.info("Upgrading Terraform component: #{@code.name}...")
@@ -43,16 +40,13 @@ module TerraformWrapper
43
40
  end
44
41
  end
45
42
 
46
- ###############################################################################
47
-
43
+ #########################################################################
48
44
  end
49
45
 
50
- ###############################################################################
51
-
46
+ ###########################################################################
52
47
  end
53
48
 
54
- ###############################################################################
55
-
49
+ #############################################################################
56
50
  end
57
51
 
58
52
  ###############################################################################
@@ -1,25 +1,22 @@
1
1
  ###############################################################################
2
2
 
3
3
  module TerraformWrapper
4
-
5
- ###############################################################################
4
+ #############################################################################
6
5
 
7
6
  module Tasks
8
-
9
- ###############################################################################
7
+ ###########################################################################
10
8
 
11
9
  class Validate < ::Rake::TaskLib
12
-
13
- ###############################################################################
10
+ #########################################################################
14
11
 
15
12
  include TerraformWrapper::Shared::Logging
16
13
 
17
- ###############################################################################
14
+ #########################################################################
18
15
 
19
16
  @binary
20
17
  @code
21
18
 
22
- ###############################################################################
19
+ #########################################################################
23
20
 
24
21
  def initialize(binary:, code:)
25
22
  @binary = binary
@@ -30,30 +27,30 @@ module TerraformWrapper
30
27
  validate_task
31
28
  end
32
29
 
33
- ###############################################################################
30
+ #########################################################################
34
31
 
35
32
  def validate_task
36
- desc "Validates the Terraform code for an infrastructure component."
37
- task :validate => :binary do |t, args|
33
+ desc 'Validates the Terraform code for an infrastructure component. Will also check formatting by default.'
34
+ task :validate, [:fmt] => :binary do |_t, args|
35
+ args.with_defaults(fmt: true)
36
+
38
37
  runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code)
39
38
 
40
39
  logger.info("Validating Terraform component: #{@code.name}...")
41
40
 
42
41
  runner.download
43
42
  runner.validate
43
+ runner.fmt if args[:fmt].to_s.downcase == 'true'
44
44
  end
45
45
  end
46
46
 
47
- ###############################################################################
48
-
47
+ #########################################################################
49
48
  end
50
49
 
51
- ###############################################################################
52
-
50
+ ###########################################################################
53
51
  end
54
52
 
55
- ###############################################################################
56
-
53
+ #############################################################################
57
54
  end
58
55
 
59
56
  ###############################################################################
@@ -8,6 +8,7 @@ require_relative 'tasks/apply'
8
8
  require_relative 'tasks/binary'
9
9
  require_relative 'tasks/clean'
10
10
  require_relative 'tasks/destroy'
11
+ require_relative 'tasks/fmt'
11
12
  require_relative 'tasks/import'
12
13
  require_relative 'tasks/init'
13
14
  require_relative 'tasks/plan'
@@ -1,11 +1,11 @@
1
1
  ###############################################################################
2
2
 
3
3
  module TerraformWrapper
4
- ###############################################################################
4
+ #############################################################################
5
5
 
6
- VERSION = '1.3.1'
6
+ VERSION = '1.3.3'
7
7
 
8
- ###############################################################################
8
+ #############################################################################
9
9
  end
10
10
 
11
11
  ###############################################################################
@@ -11,15 +11,15 @@ require_relative 'terraform-wrapper/common'
11
11
  ###############################################################################
12
12
 
13
13
  module TerraformWrapper
14
- ###############################################################################
14
+ #############################################################################
15
15
 
16
16
  @logger = TerraformWrapper::Shared::Logging.logger_for('TerraformWrapper')
17
17
 
18
- ###############################################################################
18
+ #############################################################################
19
19
 
20
20
  @logger.info("Terraform Wrapper for Ruby - version: #{TerraformWrapper::VERSION}")
21
21
 
22
- ###############################################################################
22
+ #############################################################################
23
23
 
24
24
  def self.deployment_tasks(component:, service:, options: {})
25
25
  @logger.info("Building tasks for service: #{service}, component: #{component}...")
@@ -61,6 +61,7 @@ module TerraformWrapper
61
61
  tasks << TerraformWrapper::Tasks::Binary.new(binary: binary)
62
62
  tasks << TerraformWrapper::Tasks::Clean.new(code: code)
63
63
  tasks << TerraformWrapper::Tasks::Destroy.new(binary: binary, code: code, options: config_options)
64
+ tasks << TerraformWrapper::Tasks::Fmt.new(binary: binary, code: code)
64
65
  tasks << TerraformWrapper::Tasks::Import.new(binary: binary, code: code, options: config_options)
65
66
  tasks << TerraformWrapper::Tasks::Init.new(binary: binary, code: code, options: config_options)
66
67
  tasks << TerraformWrapper::Tasks::Plan.new(binary: binary, code: code, options: config_options)
@@ -71,7 +72,7 @@ module TerraformWrapper
71
72
  tasks
72
73
  end
73
74
 
74
- ###############################################################################
75
+ #############################################################################
75
76
  end
76
77
 
77
78
  ###############################################################################
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: terraform-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lees
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-12-08 00:00:00.000000000 Z
11
+ date: 2023-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -96,6 +96,7 @@ files:
96
96
  - lib/terraform-wrapper/tasks/binary.rb
97
97
  - lib/terraform-wrapper/tasks/clean.rb
98
98
  - lib/terraform-wrapper/tasks/destroy.rb
99
+ - lib/terraform-wrapper/tasks/fmt.rb
99
100
  - lib/terraform-wrapper/tasks/import.rb
100
101
  - lib/terraform-wrapper/tasks/init.rb
101
102
  - lib/terraform-wrapper/tasks/plan.rb
@@ -126,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
127
  - !ruby/object:Gem::Version
127
128
  version: '0'
128
129
  requirements: []
129
- rubygems_version: 3.3.26
130
+ rubygems_version: 3.4.1
130
131
  signing_key:
131
132
  specification_version: 4
132
133
  summary: A ruby wrapper for managing Terraform binaries and remote state.