terraform-wrapper 1.2.6 → 1.2.7

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
  SHA256:
3
- metadata.gz: '08695485310df49bc046b08b37f9ba0bb9deb239a385de56c001d0a7abe0ec46'
4
- data.tar.gz: f017a24cd6e27dacbfd7ee9fd754dc6765599ed650830029f40574d8cc6738e4
3
+ metadata.gz: 6f5d1501a011dbf4424f148da0809664d95f3fe8c6bb6ab021b5c3b1c57d71d0
4
+ data.tar.gz: 8d102af24e50ea63d057805f099e037c9b3821cb209dfdbcbc52f74506af3614
5
5
  SHA512:
6
- metadata.gz: 45781614bb97c62ef85a16ae28a645a9c051502d9e5b1d02bdb9d9947599cec2603579738eb3a4d674914e2d44fde0d1254de539ae4ae8d4c3730e519517a6d7
7
- data.tar.gz: 3e73ea3e388813a543c484e23577fa9275131de588c571c9d0f7f22a3a804e4090d55944fdaa6789cfeab683dd9e81b18a343a41357b9640b1461181c4f2a7a9
6
+ metadata.gz: c1106d34527d215ad01722686b3516c57d68dbe4a4195cc1f89ccefc7f55f3ed587796eec6123356ec4315a0877fe27e328bab1e8e19bf659d43d7f14ddc7f95
7
+ data.tar.gz: eb97a8a2a50ee21994344dadf3c2ec388779d25faa4eff8d2e1f40bf6bd592ab2e21e3e2b2cd290feae5669e5e3c87ee66eca09e40ed3d499e84d8c58e8f4d19
@@ -148,7 +148,6 @@ module TerraformWrapper
148
148
  def import(address: nil, id: nil)
149
149
  logger.fatal("Cannot Terraform import before initialising backend!") unless initialised
150
150
 
151
- logger.fatal("Terraform state address for import must be a string!") unless address.kind_of?(String)
152
151
  logger.fatal("Terraform state address for import must be a string!") unless address.kind_of?(String)
153
152
  logger.fatal("Terraform state address for import must not be blank!") if address.strip.empty?
154
153
 
@@ -165,6 +164,20 @@ module TerraformWrapper
165
164
  logger.fatal("Terraform import failed!") unless run(action: "import", parameters: parameters)
166
165
  end
167
166
 
167
+ ###############################################################################
168
+
169
+ def taint(address: nil)
170
+ logger.fatal("Cannot Terraform taint before initialising backend!") unless initialised
171
+
172
+ logger.fatal("Terraform state address for taint must be a string!") unless address.kind_of?(String)
173
+ logger.fatal("Terraform state address for taint must not be blank!") if address.strip.empty?
174
+
175
+ parameters = Array.new
176
+ parameters.append("'#{address}'")
177
+
178
+ logger.fatal("Terraform taint failed!") unless run(action: "taint", parameters: parameters)
179
+ end
180
+
168
181
  ###############################################################################
169
182
 
170
183
  def validate
@@ -0,0 +1,66 @@
1
+ ###############################################################################
2
+
3
+ module TerraformWrapper
4
+
5
+ ###############################################################################
6
+
7
+ module Tasks
8
+
9
+ ###############################################################################
10
+
11
+ class Taint < ::Rake::TaskLib
12
+
13
+ ###############################################################################
14
+
15
+ include TerraformWrapper::Shared::Logging
16
+
17
+ ###############################################################################
18
+
19
+ @binary
20
+ @code
21
+ @options
22
+
23
+ ###############################################################################
24
+
25
+ def initialize(binary:, code:, options:)
26
+ @binary = binary
27
+ @code = code
28
+ @options = options
29
+
30
+ yield self if block_given?
31
+
32
+ taint_task
33
+ end
34
+
35
+ ###############################################################################
36
+
37
+ 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]})
41
+
42
+ logger.info("Processing configuration for Terraform taint...")
43
+
44
+ config = TerraformWrapper::Shared::Config.new(code: @code, options: options)
45
+ runner = TerraformWrapper::Shared::Runner.new(binary: @binary, code: @code)
46
+
47
+ logger.info("Running Terraform taint for service: #{config.service}, component: #{@code.name}...")
48
+
49
+ runner.init(config: config)
50
+ runner.taint(address: args[:address])
51
+ end
52
+ end
53
+
54
+ ###############################################################################
55
+
56
+ end
57
+
58
+ ###############################################################################
59
+
60
+ end
61
+
62
+ ###############################################################################
63
+
64
+ end
65
+
66
+ ###############################################################################
@@ -12,6 +12,7 @@ require_relative 'tasks/import'
12
12
  require_relative 'tasks/init'
13
13
  require_relative 'tasks/plan'
14
14
  require_relative 'tasks/plandestroy'
15
+ require_relative 'tasks/taint'
15
16
  require_relative 'tasks/upgrade'
16
17
  require_relative 'tasks/validate'
17
18
 
@@ -4,7 +4,7 @@ module TerraformWrapper
4
4
 
5
5
  ###############################################################################
6
6
 
7
- VERSION = "1.2.6"
7
+ VERSION = "1.2.7"
8
8
 
9
9
  ###############################################################################
10
10
 
@@ -59,6 +59,7 @@ module TerraformWrapper
59
59
  tasks << TerraformWrapper::Tasks::Init.new(binary: binary, code: code, options: config_options)
60
60
  tasks << TerraformWrapper::Tasks::Plan.new(binary: binary, code: code, options: config_options)
61
61
  tasks << TerraformWrapper::Tasks::PlanDestroy.new(binary: binary, code: code, options: config_options)
62
+ tasks << TerraformWrapper::Tasks::Taint.new(binary: binary, code: code, options: config_options)
62
63
  tasks << TerraformWrapper::Tasks::Upgrade.new(binary: binary, code: code)
63
64
  tasks << TerraformWrapper::Tasks::Validate.new(binary: binary, code: code)
64
65
  return tasks
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.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Lees
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-08-25 00:00:00.000000000 Z
11
+ date: 2021-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -83,6 +83,7 @@ files:
83
83
  - lib/terraform-wrapper/tasks/init.rb
84
84
  - lib/terraform-wrapper/tasks/plan.rb
85
85
  - lib/terraform-wrapper/tasks/plandestroy.rb
86
+ - lib/terraform-wrapper/tasks/taint.rb
86
87
  - lib/terraform-wrapper/tasks/upgrade.rb
87
88
  - lib/terraform-wrapper/tasks/validate.rb
88
89
  - lib/terraform-wrapper/version.rb
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
108
109
  - !ruby/object:Gem::Version
109
110
  version: '0'
110
111
  requirements: []
111
- rubygems_version: 3.2.22
112
+ rubygems_version: 3.2.32
112
113
  signing_key:
113
114
  specification_version: 4
114
115
  summary: A ruby wrapper for managing Terraform binaries and remote state.