terraform-wrapper 0.2.1 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/terraform-wrapper.rb +1 -1
- data/lib/terraform-wrapper/common.rb +12 -1
- data/lib/terraform-wrapper/shared/auths/azure.rb +22 -22
- data/lib/terraform-wrapper/shared/auths/common.rb +3 -7
- data/lib/terraform-wrapper/shared/backends/aws.rb +11 -11
- data/lib/terraform-wrapper/shared/backends/azure.rb +10 -10
- data/lib/terraform-wrapper/shared/backends/common.rb +3 -7
- data/lib/terraform-wrapper/shared/backends/local.rb +8 -7
- data/lib/terraform-wrapper/shared/code.rb +0 -2
- data/lib/terraform-wrapper/shared/config.rb +15 -49
- data/lib/terraform-wrapper/shared/runner.rb +4 -6
- data/lib/terraform-wrapper/shared/variables.rb +73 -10
- data/lib/terraform-wrapper/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 303be04cdd5ed0531fef7b3c33a86f41f55c3a496224837bfdbcdaf6d1411ccc
|
4
|
+
data.tar.gz: fe97c2265a13928c9c5893ac980e85d8123e5e55d8c0b80dc6306f3b4eee2d10
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b4d13a4e229ac1148083a4f234591bf253cf50096fc0c99273286b780017903a2660258619c00285e98dbad7bff3e2d83344ae7ace5ff86ebb836d164b3dc91
|
7
|
+
data.tar.gz: d5cc2a92103f05b5ebc567e2dc2f75b35a9f3453277aef9953c90eed0da7643a78199e24357951fa7912f9770f29531a8f5bcb45b64f6a9c058ef27d1090c3c9
|
data/lib/terraform-wrapper.rb
CHANGED
@@ -22,7 +22,7 @@ module TerraformWrapper
|
|
22
22
|
|
23
23
|
###############################################################################
|
24
24
|
|
25
|
-
def self.
|
25
|
+
def self.deployment_tasks(component:, options: Hash.new, service:)
|
26
26
|
@logger.info("Building tasks for service: #{service}, component: #{component}...")
|
27
27
|
|
28
28
|
@logger.fatal("Options must be specified as a hash!") unless options.kind_of?(Hash)
|
@@ -4,7 +4,7 @@ module TerraformWrapper
|
|
4
4
|
|
5
5
|
###############################################################################
|
6
6
|
|
7
|
-
def self.create_directory(directory:,
|
7
|
+
def self.create_directory(directory:, exists: true, purpose: nil)
|
8
8
|
return exists if File.directory?(directory)
|
9
9
|
|
10
10
|
result = false
|
@@ -20,6 +20,17 @@ module TerraformWrapper
|
|
20
20
|
result = File.directory?(directory)
|
21
21
|
end
|
22
22
|
|
23
|
+
###############################################################################
|
24
|
+
|
25
|
+
def self.find(base:, name:, exts:, description: "File")
|
26
|
+
exts.each do |ext|
|
27
|
+
path = File.join(base, name + ext)
|
28
|
+
return path if File.file?(path)
|
29
|
+
end
|
30
|
+
|
31
|
+
@logger.fatal("#{description} name: #{name} not found in location: #{base}!")
|
32
|
+
end
|
33
|
+
|
23
34
|
###############################################################################
|
24
35
|
|
25
36
|
end
|
@@ -25,27 +25,34 @@ module TerraformWrapper
|
|
25
25
|
|
26
26
|
###############################################################################
|
27
27
|
|
28
|
-
@
|
28
|
+
@keyvault = nil
|
29
|
+
@secret_username = nil
|
30
|
+
@secret_password = nil
|
29
31
|
|
30
32
|
###############################################################################
|
31
33
|
|
32
|
-
|
33
|
-
attr_reader :tenant
|
34
|
-
attr_reader :username
|
34
|
+
@subscription
|
35
35
|
|
36
36
|
###############################################################################
|
37
37
|
|
38
|
-
def initialize(
|
39
|
-
construct(
|
38
|
+
def initialize(options:, variables:)
|
39
|
+
construct(options: options, variables: variables)
|
40
40
|
end
|
41
41
|
|
42
42
|
###############################################################################
|
43
43
|
|
44
44
|
def auth()
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
details = subscription_details(subscription: @subscription)
|
46
|
+
|
47
|
+
subscription = details["id"]
|
48
|
+
tenant = details["tenant"]
|
49
|
+
username = @keyvault.nil? ? nil : secret(vault: @keyvault, name: @secret_username)
|
50
|
+
password = @keyvault.nil? ? nil : secret(vault: @keyvault, name: @secret_password)
|
51
|
+
|
52
|
+
ENV["ARM_SUBSCRIPTION_ID"] = subscription
|
53
|
+
ENV["ARM_TENANT_ID"] = tenant
|
54
|
+
ENV["ARM_CLIENT_ID"] = username unless username.nil?
|
55
|
+
ENV["ARM_CLIENT_SECRET"] = password unless password.nil?
|
49
56
|
logger.success("Azure authenticator environment variables set!")
|
50
57
|
end
|
51
58
|
|
@@ -151,20 +158,13 @@ module TerraformWrapper
|
|
151
158
|
end
|
152
159
|
|
153
160
|
begin
|
154
|
-
subscription
|
155
|
-
keyvault
|
156
|
-
|
157
|
-
|
161
|
+
@subscription = subscription % @variables.identifiers
|
162
|
+
@keyvault = keyvault % @variables.identifiers unless keyvault.nil?
|
163
|
+
@secret_username = username % @variables.identifiers unless keyvault.nil?
|
164
|
+
@secret_password = password % @variables.identifiers unless keyvault.nil?
|
158
165
|
rescue
|
159
|
-
logger.fatal("Azure authenticator options contain
|
166
|
+
logger.fatal("Azure authenticator options contain identifiers that are not included in the configuration file!")
|
160
167
|
end
|
161
|
-
|
162
|
-
details = subscription_details(subscription: subscription)
|
163
|
-
|
164
|
-
@subscription = details["id"]
|
165
|
-
@tenant = details["tenant"]
|
166
|
-
@username = keyvault.nil? ? nil : secret(vault: keyvault, name: username)
|
167
|
-
@password = keyvault.nil? ? nil : secret(vault: keyvault, name: password)
|
168
168
|
end
|
169
169
|
|
170
170
|
###############################################################################
|
@@ -29,7 +29,7 @@ module TerraformWrapper
|
|
29
29
|
|
30
30
|
###############################################################################
|
31
31
|
|
32
|
-
def initialize(
|
32
|
+
def initialize(options:, variables:)
|
33
33
|
logger.fatal("This class should not be used directly! Please create an authenticator-specific class instead!")
|
34
34
|
end
|
35
35
|
|
@@ -59,13 +59,9 @@ module TerraformWrapper
|
|
59
59
|
|
60
60
|
###############################################################################
|
61
61
|
|
62
|
-
def construct(
|
62
|
+
def construct(options:, variables:)
|
63
63
|
@options = options
|
64
|
-
@variables = variables
|
65
|
-
component: code.name,
|
66
|
-
config: config,
|
67
|
-
service: service
|
68
|
-
})
|
64
|
+
@variables = variables
|
69
65
|
|
70
66
|
specific
|
71
67
|
end
|
@@ -35,8 +35,8 @@ module TerraformWrapper
|
|
35
35
|
|
36
36
|
###############################################################################
|
37
37
|
|
38
|
-
def initialize(
|
39
|
-
construct(
|
38
|
+
def initialize(options:, variables:)
|
39
|
+
construct(options: options, variables: variables)
|
40
40
|
end
|
41
41
|
|
42
42
|
###############################################################################
|
@@ -101,18 +101,18 @@ module TerraformWrapper
|
|
101
101
|
logger.fatal("AWS backend role to assume ARN must not be blank if specified!") if role.strip.empty?
|
102
102
|
end
|
103
103
|
|
104
|
-
|
105
|
-
|
106
|
-
|
104
|
+
@variables.core.keys.map{ |sym| sym.to_s }.each do |core|
|
105
|
+
logger.fatal("AWS backend S3 bucket name or key must include %{#{core}}.") unless (bucket.include?("%{#{core}}") or key.include?("%{#{core}}"))
|
106
|
+
end
|
107
107
|
|
108
108
|
begin
|
109
|
-
bucket = bucket % @variables
|
110
|
-
region = region % @variables
|
111
|
-
key = key % @variables
|
112
|
-
kms = kms % @variables unless kms.nil?
|
113
|
-
role = role % @variables unless role.nil?
|
109
|
+
bucket = bucket % @variables.identifiers
|
110
|
+
region = region % @variables.identifiers
|
111
|
+
key = key % @variables.identifiers
|
112
|
+
kms = kms % @variables.identifiers unless kms.nil?
|
113
|
+
role = role % @variables.identifiers unless role.nil?
|
114
114
|
rescue
|
115
|
-
logger.fatal("AWS backend options contain
|
115
|
+
logger.fatal("AWS backend options contain identifiers that are not included in the configuration file!")
|
116
116
|
end
|
117
117
|
|
118
118
|
logger.fatal("Key: #{key} is too long for backend of type: #{@@type}") if key.length > 1024
|
@@ -31,8 +31,8 @@ module TerraformWrapper
|
|
31
31
|
|
32
32
|
###############################################################################
|
33
33
|
|
34
|
-
def initialize(
|
35
|
-
construct(
|
34
|
+
def initialize(options:, variables:)
|
35
|
+
construct(options: options, variables: variables)
|
36
36
|
end
|
37
37
|
|
38
38
|
###############################################################################
|
@@ -75,17 +75,17 @@ module TerraformWrapper
|
|
75
75
|
logger.fatal("Azure backend storage account key must be a string!") unless key.kind_of?(String)
|
76
76
|
logger.fatal("Azure backend storage account key must not be blank!") if key.strip.empty?
|
77
77
|
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
@variables.core.keys.map{ |sym| sym.to_s }.each do |core|
|
79
|
+
logger.fatal("Azure backend container or key must include %{#{core}}.") unless (container.include?("%{#{core}}") or key.include?("%{#{core}}"))
|
80
|
+
end
|
81
81
|
|
82
82
|
begin
|
83
|
-
group = group % @variables
|
84
|
-
account = account % @variables
|
85
|
-
container = container % @variables
|
86
|
-
key = key % @variables
|
83
|
+
group = group % @variables.identifiers
|
84
|
+
account = account % @variables.identifiers
|
85
|
+
container = container % @variables.identifiers
|
86
|
+
key = key % @variables.identifiers
|
87
87
|
rescue
|
88
|
-
logger.fatal("Azure backend options contain
|
88
|
+
logger.fatal("Azure backend options contain identifiers that are not included in the configuration file!")
|
89
89
|
end
|
90
90
|
|
91
91
|
if key.length > 1024 then
|
@@ -30,7 +30,7 @@ module TerraformWrapper
|
|
30
30
|
|
31
31
|
###############################################################################
|
32
32
|
|
33
|
-
def initialize(
|
33
|
+
def initialize(options:, variables:)
|
34
34
|
logger.fatal("This class should not be used directly! Please create a backend-specific class instead!")
|
35
35
|
end
|
36
36
|
|
@@ -54,13 +54,9 @@ module TerraformWrapper
|
|
54
54
|
|
55
55
|
###############################################################################
|
56
56
|
|
57
|
-
def construct(
|
57
|
+
def construct(options:, variables:)
|
58
58
|
@options = options
|
59
|
-
@variables = variables
|
60
|
-
component: code.name,
|
61
|
-
config: config,
|
62
|
-
service: service
|
63
|
-
})
|
59
|
+
@variables = variables
|
64
60
|
|
65
61
|
specific
|
66
62
|
end
|
@@ -28,8 +28,8 @@ module TerraformWrapper
|
|
28
28
|
|
29
29
|
###############################################################################
|
30
30
|
|
31
|
-
def initialize(
|
32
|
-
construct(
|
31
|
+
def initialize(options:, variables:)
|
32
|
+
construct(options: options, variables: variables)
|
33
33
|
end
|
34
34
|
|
35
35
|
###############################################################################
|
@@ -52,14 +52,15 @@ module TerraformWrapper
|
|
52
52
|
logger.fatal("Local backend path must be a string!") unless path.kind_of?(String)
|
53
53
|
logger.fatal("Local backend path must not be blank!") if path.strip.empty?
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
55
|
+
@variables.core.keys.map{ |sym| sym.to_s }.each do |core|
|
56
|
+
next if (core == "service") and (path.include?(Dir.pwd))
|
57
|
+
logger.fatal("Local backend path must include %{#{core}}.") unless path.include?("%{#{core}}")
|
58
|
+
end
|
58
59
|
|
59
60
|
begin
|
60
|
-
path = path % @variables
|
61
|
+
path = path % @variables.identifiers
|
61
62
|
rescue
|
62
|
-
logger.fatal("Local backend options contain
|
63
|
+
logger.fatal("Local backend options contain identifiers that are not included in the configuration file!")
|
63
64
|
end
|
64
65
|
|
65
66
|
directory = File.dirname(path)
|
@@ -34,8 +34,6 @@ module TerraformWrapper
|
|
34
34
|
@name = options["name"]
|
35
35
|
|
36
36
|
@path = File.join(@base, @name)
|
37
|
-
|
38
|
-
logger.fatal("Terraform code location: #{@path} does not exist!") unless exists
|
39
37
|
end
|
40
38
|
|
41
39
|
###############################################################################
|
@@ -22,11 +22,6 @@ module TerraformWrapper
|
|
22
22
|
|
23
23
|
@@config_exts = [ "", ".yaml", ".yml" ]
|
24
24
|
|
25
|
-
###############################################################################
|
26
|
-
|
27
|
-
@@variable_files_name = "tfvars"
|
28
|
-
@@variable_files_exts = [ ".tfvars" ]
|
29
|
-
|
30
25
|
###############################################################################
|
31
26
|
|
32
27
|
attr_reader :auths
|
@@ -36,7 +31,6 @@ module TerraformWrapper
|
|
36
31
|
attr_reader :name
|
37
32
|
attr_reader :path
|
38
33
|
attr_reader :service
|
39
|
-
attr_reader :variable_files
|
40
34
|
attr_reader :variables
|
41
35
|
|
42
36
|
###############################################################################
|
@@ -75,65 +69,37 @@ module TerraformWrapper
|
|
75
69
|
backend_options = options["backend-options"]
|
76
70
|
|
77
71
|
@code = code
|
78
|
-
@path = find(base: @base, name: @name, exts: @@config_exts, description: "Configuration")
|
72
|
+
@path = ::TerraformWrapper.find(base: @base, name: @name, exts: @@config_exts, description: "Configuration")
|
79
73
|
|
80
74
|
yaml = YAML.load(File.read(@path))
|
81
75
|
logger.fatal("Invalid YAML in configuration file: #{@path}") unless yaml.kind_of?(Hash)
|
82
76
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
77
|
+
identifiers = yaml.key?("identifiers") ? yaml["identifiers"] : Hash.new
|
78
|
+
@variables = TerraformWrapper::Shared::Variables.new(config: @name, component: @code.name, service: @service, identifiers: identifiers)
|
79
|
+
@variables.add_variables(variables: yaml["globals"]) if yaml.key?("globals")
|
80
|
+
|
81
|
+
if yaml.key?("terraform") then
|
82
|
+
logger.fatal("Key 'terraform' is not a hash in configuration file: #{@path}") unless yaml["terraform"].kind_of?(Hash)
|
83
|
+
terraform = yaml["terraform"]
|
89
84
|
|
90
|
-
|
85
|
+
@variables.add_variables(variables: terraform["variables"]) if terraform.key?("variables")
|
86
|
+
@variables.add_files(base: @base, files: terraform["files"]) if terraform.key?("files")
|
87
|
+
end
|
91
88
|
|
92
89
|
@auths = Array.new
|
93
|
-
@auths.append(TerraformWrapper::Shared::Auths::Azure.new(
|
90
|
+
@auths.append(TerraformWrapper::Shared::Auths::Azure.new(options: auth_azure_options, variables: @variables)) if auth_azure
|
94
91
|
|
95
92
|
if backend == "local" then
|
96
|
-
@backend = TerraformWrapper::Shared::Backends::Local.new(
|
93
|
+
@backend = TerraformWrapper::Shared::Backends::Local.new(options: backend_options, variables: @variables)
|
97
94
|
elsif backend == "aws" then
|
98
|
-
@backend = TerraformWrapper::Shared::Backends::AWS.new(
|
95
|
+
@backend = TerraformWrapper::Shared::Backends::AWS.new(options: backend_options, variables: @variables)
|
99
96
|
elsif backend == "azure" then
|
100
|
-
@backend = TerraformWrapper::Shared::Backends::Azure.new(
|
97
|
+
@backend = TerraformWrapper::Shared::Backends::Azure.new(options: backend_options, variables: @variables)
|
101
98
|
else
|
102
99
|
logger.fatal("Backend: #{backend} is not valid!")
|
103
100
|
end
|
104
101
|
end
|
105
102
|
|
106
|
-
###############################################################################
|
107
|
-
|
108
|
-
private
|
109
|
-
|
110
|
-
###############################################################################
|
111
|
-
|
112
|
-
def find(base:, name:, exts:, description: "File")
|
113
|
-
@@config_exts.each do |config_ext|
|
114
|
-
path = File.join(base, name + config_ext)
|
115
|
-
return path if File.file?(path)
|
116
|
-
end
|
117
|
-
|
118
|
-
logger.fatal("#{description} name: #{@name} not found in location: #{@base}!")
|
119
|
-
end
|
120
|
-
|
121
|
-
###############################################################################
|
122
|
-
|
123
|
-
def validate(variable_files:)
|
124
|
-
logger.fatal("Optional key 'variable_files' must be a list of strings!") unless variable_files.kind_of?(Array)
|
125
|
-
|
126
|
-
result = Array.new
|
127
|
-
|
128
|
-
variable_files.each do |variable_file|
|
129
|
-
logger.fatal("All elements of 'terraform' must be strings!") unless variable_file.kind_of?(String)
|
130
|
-
logger.fatal("All elements of 'terraform' must not be blank!") if variable_file.strip.empty?
|
131
|
-
result.append(find(base: File.join(@base, @@variable_files_name), name: variable_file.strip, exts: @@variable_files_exts, description: "Terraform values file"))
|
132
|
-
end
|
133
|
-
|
134
|
-
return result
|
135
|
-
end
|
136
|
-
|
137
103
|
###############################################################################
|
138
104
|
|
139
105
|
end
|
@@ -25,6 +25,8 @@ module TerraformWrapper
|
|
25
25
|
###############################################################################
|
26
26
|
|
27
27
|
def initialize(binary:, code:)
|
28
|
+
logger.fatal("Terraform code location: #{code.path} does not exist!") unless code.check
|
29
|
+
|
28
30
|
@binary = binary
|
29
31
|
@code = code
|
30
32
|
|
@@ -151,8 +153,8 @@ module TerraformWrapper
|
|
151
153
|
|
152
154
|
result = Array.new
|
153
155
|
|
154
|
-
@config.
|
155
|
-
result.append("-var-file=\"#{
|
156
|
+
@config.variables.files.each do |file|
|
157
|
+
result.append("-var-file=\"#{file}\"")
|
156
158
|
end
|
157
159
|
|
158
160
|
return result
|
@@ -165,10 +167,6 @@ module TerraformWrapper
|
|
165
167
|
|
166
168
|
result = Array.new
|
167
169
|
|
168
|
-
result.append("-var=\"component=#{@code.name}\"")
|
169
|
-
result.append("-var=\"config=#{@config.name}\"")
|
170
|
-
result.append("-var=\"service=#{@config.service}\"")
|
171
|
-
|
172
170
|
@config.variables.values.each do |key, value|
|
173
171
|
result.append("-var=\"#{key.to_s}=#{value}\"")
|
174
172
|
end
|
@@ -16,17 +16,80 @@ module TerraformWrapper
|
|
16
16
|
|
17
17
|
###############################################################################
|
18
18
|
|
19
|
-
@@
|
19
|
+
@@variable_files_name = "tfvars"
|
20
|
+
@@variable_files_exts = [ ".tfvars" ]
|
20
21
|
|
21
22
|
###############################################################################
|
22
23
|
|
24
|
+
attr_reader :core
|
25
|
+
attr_reader :files
|
26
|
+
attr_reader :identifiers
|
23
27
|
attr_reader :values
|
24
28
|
|
25
29
|
###############################################################################
|
26
30
|
|
27
|
-
def initialize(
|
28
|
-
|
29
|
-
|
31
|
+
def initialize(component:, config:, service:, identifiers: Hash.new, sort: false)
|
32
|
+
logger.fatal("Identifiers provided must be a hash!") unless identifiers.kind_of?(Hash)
|
33
|
+
|
34
|
+
@core = Hash.new()
|
35
|
+
@core[:component] = component
|
36
|
+
@core[:config] = config
|
37
|
+
@core[:service] = service
|
38
|
+
|
39
|
+
user = cleanse(variables: identifiers, reserved: @core.keys)
|
40
|
+
merged = @core.merge(user)
|
41
|
+
|
42
|
+
@identifiers = sort ? merged.sort.to_h : merged
|
43
|
+
@values = @identifiers
|
44
|
+
@files = Array.new
|
45
|
+
end
|
46
|
+
|
47
|
+
###############################################################################
|
48
|
+
|
49
|
+
def add_files(base:, files:)
|
50
|
+
logger.fatal("Variable files provided must be an array!") unless files.kind_of?(Array)
|
51
|
+
|
52
|
+
files.each do |file|
|
53
|
+
logger.fatal("All provided variable file names must be strings!") unless file.kind_of?(String)
|
54
|
+
logger.fatal("All provided variable file names must not be blank!") if file.strip.empty?
|
55
|
+
|
56
|
+
path = ::TerraformWrapper.find(base: File.join(base, @@variable_files_name), name: file.strip, exts: @@variable_files_exts, description: "Terraform values file")
|
57
|
+
|
58
|
+
if @files.include?(path) then
|
59
|
+
logger.warn("Terraform variables file is included more than once: #{file.strip}")
|
60
|
+
else
|
61
|
+
@files.append(path)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
###############################################################################
|
67
|
+
|
68
|
+
def add_variables(variables:, sort: false)
|
69
|
+
logger.fatal("Variables provided must be a hash!") unless variables.kind_of?(Hash)
|
70
|
+
|
71
|
+
cleansed = cleanse(variables: variables, reserved: @values.keys)
|
72
|
+
|
73
|
+
begin
|
74
|
+
cleansed = cleansed.map{ |key, value| [ key, value % @identifiers ] }.to_h
|
75
|
+
rescue
|
76
|
+
logger.fatal("Variables contain identifiers that are not included in the configuration file!")
|
77
|
+
end
|
78
|
+
|
79
|
+
merged = @values.merge(cleansed)
|
80
|
+
@values = sort ? merged.sort.to_h : merged
|
81
|
+
end
|
82
|
+
|
83
|
+
###############################################################################
|
84
|
+
|
85
|
+
def clear_files()
|
86
|
+
@files = Array.new
|
87
|
+
end
|
88
|
+
|
89
|
+
###############################################################################
|
90
|
+
|
91
|
+
def clear_variables()
|
92
|
+
@values = @identifers
|
30
93
|
end
|
31
94
|
|
32
95
|
###############################################################################
|
@@ -35,17 +98,17 @@ module TerraformWrapper
|
|
35
98
|
|
36
99
|
###############################################################################
|
37
100
|
|
38
|
-
def cleanse(
|
101
|
+
def cleanse(variables:, reserved:)
|
39
102
|
result = Hash.new
|
40
103
|
|
41
|
-
|
104
|
+
variables.keys.each do |key|
|
42
105
|
logger.fatal("Could not clean variables hash. All keys MUST be strings!") unless key.kind_of?(String)
|
43
|
-
logger.fatal("Could not clean variables hash, key: #{key.downcase} is reserved and cannot be used!") if
|
106
|
+
logger.fatal("Could not clean variables hash, key: #{key.downcase} is reserved or already in use and cannot be used!") if reserved.include?(key.downcase.to_sym)
|
44
107
|
logger.fatal("Could not clean variables hash, duplicate key found: #{key.downcase}!") if result.key?(key.downcase.to_sym)
|
45
|
-
logger.fatal("Could not clean variables hash, value for: #{key.downcase} is not a string!") unless
|
46
|
-
logger.fatal("Could not clean variables hash, value for: #{key.downcase} is empty!") if
|
108
|
+
logger.fatal("Could not clean variables hash, value for: #{key.downcase} is not a string!") unless variables[key].kind_of?(String)
|
109
|
+
logger.fatal("Could not clean variables hash, value for: #{key.downcase} is empty!") if variables[key].strip.empty?
|
47
110
|
|
48
|
-
result[key.downcase.to_sym] =
|
111
|
+
result[key.downcase.to_sym] = variables[key].strip
|
49
112
|
end
|
50
113
|
|
51
114
|
return result
|
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: 0.
|
4
|
+
version: 1.0.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: 2021-03-
|
11
|
+
date: 2021-03-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|