terraform-wrapper 1.1.0 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 757e953e25e4899b35a17e556123581ab077a84769a144f51db286a6b56f8608
4
- data.tar.gz: 25d70f9f0132157ccc738bf0c459f35d1e777f5760bae6177bc202e92bc1c95c
3
+ metadata.gz: bafe8ef5b2dd58357fd8ac1eb741deb4ace78e02d374f1711c727e5835731715
4
+ data.tar.gz: 9899116a854e2ab82a4cfc6736f94321735593a7f03c6197715324415c8e5f30
5
5
  SHA512:
6
- metadata.gz: a0399939f5522c2ffb3fcee4e0dded13c09b7731e0025de5d92bdab8afe63e9b3506eba6bf99d345323ea4f77f7a9096e18203f975127eb29729b60379036144
7
- data.tar.gz: 9a8ef1ea51a121cd85a5a4334cda520f8a4246c2125510054c047f7d29e004cae8bf30a4eb200aae71321d0ccf1748b385449735d5e1bc00b65cf67b3f624c15
6
+ metadata.gz: 48a9f108a1b0dc5d111486d3f093b08c8e0a5d40f9a3d70211f537a1623dcb86019c39144177e774ee22e224fd23030e473bf3a5dd3b501131c3e6691312d83b
7
+ data.tar.gz: d0dd56c21bd7b6345913b3117aa1921118d9b60fc31cb8bcef72dc6556868e7aeff9497104bda31331ad3b30e7be02cf1c71814a3549b09a9bbdeedbbdfa2a8e
@@ -41,16 +41,16 @@ module TerraformWrapper
41
41
 
42
42
  @base = options["base"]
43
43
 
44
- logger.fatal("Configuration service name must be a string!") unless options["service"].kind_of?(String)
45
- logger.fatal("Configuration service name must not be blank!") if options["service"].strip.empty?
46
-
47
- @service = options["service"]
48
-
49
44
  logger.fatal("Configuration name must be a string!") unless options["name"].kind_of?(String)
50
45
  logger.fatal("Configuration name must not be blank!") if options["name"].strip.empty?
51
46
 
52
47
  @name = options["name"]
53
48
 
49
+ logger.fatal("Configuration service name must be a string!") unless options["service"].kind_of?(String)
50
+ logger.fatal("Configuration service name must not be blank!") if options["service"].strip.empty?
51
+
52
+ @service = options["service"]
53
+
54
54
  logger.fatal("Configuration authenticator for Azure enabled must be a Boolean!") unless [ true, false ].include?(options["auth-azure"])
55
55
 
56
56
  auth_azure = options["auth-azure"]
@@ -36,11 +36,11 @@ module TerraformWrapper
36
36
  @core[:config] = config
37
37
  @core[:service] = service
38
38
 
39
- user = cleanse(variables: identifiers, reserved: @core.keys)
39
+ user = cleanse(variables: identifiers, reserved: @core.keys, downcase: true)
40
40
  merged = @core.merge(user)
41
41
 
42
42
  @identifiers = sort ? merged.sort.to_h : merged
43
- @values = @identifiers
43
+ @values = Hash.new
44
44
  @files = Array.new
45
45
  end
46
46
 
@@ -89,7 +89,7 @@ module TerraformWrapper
89
89
  ###############################################################################
90
90
 
91
91
  def clear_variables()
92
- @values = @identifers
92
+ @values = Hash.new
93
93
  end
94
94
 
95
95
  ###############################################################################
@@ -98,17 +98,20 @@ module TerraformWrapper
98
98
 
99
99
  ###############################################################################
100
100
 
101
- def cleanse(variables:, reserved:)
101
+ def cleanse(variables:, reserved:, downcase: false)
102
102
  result = Hash.new
103
103
 
104
104
  variables.keys.each do |key|
105
105
  logger.fatal("Could not clean variables hash. All keys MUST be strings!") unless key.kind_of?(String)
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)
107
- logger.fatal("Could not clean variables hash, duplicate key found: #{key.downcase}!") if result.key?(key.downcase.to_sym)
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?
110
106
 
111
- result[key.downcase.to_sym] = variables[key].strip
107
+ sym = downcase ? key.downcase.to_sym : key.to_sym
108
+
109
+ logger.fatal("Could not clean variables hash, key: #{sym.to_s} is reserved or already in use and cannot be used!") if reserved.include?(sym)
110
+ logger.fatal("Could not clean variables hash, duplicate key found: #{sym.to_s}!") if result.key?(sym)
111
+ logger.fatal("Could not clean variables hash, value for: #{sym.to_s} is not a string!") unless variables[key].kind_of?(String)
112
+ logger.fatal("Could not clean variables hash, value for: #{sym.to_s} is empty!") if variables[key].strip.empty?
113
+
114
+ result[sym] = variables[key].strip
112
115
  end
113
116
 
114
117
  return result
@@ -4,7 +4,7 @@ module TerraformWrapper
4
4
 
5
5
  ###############################################################################
6
6
 
7
- VERSION = "1.1.0"
7
+ VERSION = "1.2.0"
8
8
 
9
9
  ###############################################################################
10
10
 
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.1.0
4
+ version: 1.2.0
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-10 00:00:00.000000000 Z
11
+ date: 2021-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake