terraform-wrapper 1.2.3 → 1.2.7
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.
- checksums.yaml +4 -4
- data/lib/terraform-wrapper/shared/auths/azure.rb +1 -1
- data/lib/terraform-wrapper/shared/runner.rb +21 -4
- data/lib/terraform-wrapper/tasks/taint.rb +66 -0
- data/lib/terraform-wrapper/tasks.rb +1 -0
- data/lib/terraform-wrapper/version.rb +1 -1
- data/lib/terraform-wrapper.rb +1 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f5d1501a011dbf4424f148da0809664d95f3fe8c6bb6ab021b5c3b1c57d71d0
|
|
4
|
+
data.tar.gz: 8d102af24e50ea63d057805f099e037c9b3821cb209dfdbcbc52f74506af3614
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c1106d34527d215ad01722686b3516c57d68dbe4a4195cc1f89ccefc7f55f3ed587796eec6123356ec4315a0877fe27e328bab1e8e19bf659d43d7f14ddc7f95
|
|
7
|
+
data.tar.gz: eb97a8a2a50ee21994344dadf3c2ec388779d25faa4eff8d2e1f40bf6bd592ab2e21e3e2b2cd290feae5669e5e3c87ee66eca09e40ed3d499e84d8c58e8f4d19
|
|
@@ -71,7 +71,7 @@ module TerraformWrapper
|
|
|
71
71
|
###############################################################################
|
|
72
72
|
|
|
73
73
|
def cli()
|
|
74
|
-
output = logger.colour ? "
|
|
74
|
+
output = logger.colour ? "yamlc" : "yaml"
|
|
75
75
|
cmdline = "\"#{@@az}\" version --output \"#{output}\""
|
|
76
76
|
return(system(cmdline) || false)
|
|
77
77
|
end
|
|
@@ -84,6 +84,11 @@ module TerraformWrapper
|
|
|
84
84
|
|
|
85
85
|
parameters = Array.new
|
|
86
86
|
parameters.append("lock")
|
|
87
|
+
|
|
88
|
+
@binary.provider.platforms.each do |platform|
|
|
89
|
+
parameters.append("-platform=\"#{platform}\"")
|
|
90
|
+
end
|
|
91
|
+
|
|
87
92
|
logger.fatal("Failed to upgrade Terraform providers!") unless run(action: "providers", parameters: parameters)
|
|
88
93
|
end
|
|
89
94
|
|
|
@@ -93,15 +98,14 @@ module TerraformWrapper
|
|
|
93
98
|
logger.fatal("Cannot Terraform apply before initialising backend!") unless initialised
|
|
94
99
|
|
|
95
100
|
parameters = Array.new
|
|
96
|
-
parameters.concat(variable_files)
|
|
97
|
-
parameters.concat(variable_strings)
|
|
98
101
|
parameters.append("-auto-approve")
|
|
99
102
|
|
|
100
|
-
if not file.nil? and file.kind_of?(String) and not file.strip.empty? then
|
|
103
|
+
if (not file.nil?) and file.kind_of?(String) and (not file.strip.empty?) then
|
|
101
104
|
logger.fatal("Plan file: #{file} does not exist!") unless File.file?(file)
|
|
102
105
|
parameters.append("\"#{file}\"")
|
|
103
106
|
else
|
|
104
107
|
parameters.concat(variable_files)
|
|
108
|
+
parameters.concat(variable_strings)
|
|
105
109
|
end
|
|
106
110
|
|
|
107
111
|
logger.fatal("Terraform apply failed!") unless run(action: "apply", parameters: parameters)
|
|
@@ -144,7 +148,6 @@ module TerraformWrapper
|
|
|
144
148
|
def import(address: nil, id: nil)
|
|
145
149
|
logger.fatal("Cannot Terraform import before initialising backend!") unless initialised
|
|
146
150
|
|
|
147
|
-
logger.fatal("Terraform state address for import must be a string!") unless address.kind_of?(String)
|
|
148
151
|
logger.fatal("Terraform state address for import must be a string!") unless address.kind_of?(String)
|
|
149
152
|
logger.fatal("Terraform state address for import must not be blank!") if address.strip.empty?
|
|
150
153
|
|
|
@@ -161,6 +164,20 @@ module TerraformWrapper
|
|
|
161
164
|
logger.fatal("Terraform import failed!") unless run(action: "import", parameters: parameters)
|
|
162
165
|
end
|
|
163
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
|
+
|
|
164
181
|
###############################################################################
|
|
165
182
|
|
|
166
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
|
+
###############################################################################
|
data/lib/terraform-wrapper.rb
CHANGED
|
@@ -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.
|
|
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-
|
|
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.
|
|
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.
|