simplygenius-atmos 0.10.1 → 0.11.0

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: e0c1304c504dd0cd09e353384793eeb0e7c09c1eb7935da83fef773ce9f99992
4
- data.tar.gz: e56fef2966f91b07a1458788c0b17f92ecb3d846d7786b0ca6155f29388857ef
3
+ metadata.gz: 8846428ce92ec4a40ec6dae71e6bd2f71f6a782602ad8e28d9a8a22e59651377
4
+ data.tar.gz: 74660bb78c5161496d22cf251be0398c69aebbbce86e660ba00acadfc4440e5b
5
5
  SHA512:
6
- metadata.gz: 0b35b9967562d7c81ec2e5847db3faf87f96ee30f8f5638d04fbf7d5b8fe239feeda42c6c9ca56e01af059f42df8080e40a4e977da8b6fbb13f7eeb53f6b79bf
7
- data.tar.gz: b3defecd765a7ea210f22e87be82ea4e828227cf680f378afba0fa32fefc54428aa1d93a1c78e04251815a5de2e658b0ea46d44de3a5ed158beafb9ef5b6ed6b
6
+ metadata.gz: cfe43ece44f453e003602badf0d870e871fee7008418c515faa236b30906b4722565962022969594efab87f0e563fa493f0ed51c5ef39eafb09f9ee725a66059
7
+ data.tar.gz: 8fa18edccdce49eda87a21125a27d263047fa0545461fe9a44fcbda2d75a2c929db24b064d47de56bbc5131b480862b1ac1eb721d4a8d49f5c0fb9a42d8c40d6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ 0.11.0 (09/25/2019)
2
+ -------------------
3
+
4
+ #### Notes on major changes
5
+
6
+ * Upgraded to support using terraform 0.12 . This should continue to work with terraform 0.11, but revving the minor version in case it introduces a breaking change. Most of the breaking changes were in the atmos-recipes repo, but you can pin to an older version of that to avoid getting the 0.12 recipes.
7
+
8
+ #### Full changelog
9
+
10
+ * fix 2.3 test failure [c20f957](https://github.com/simplygenius/atmos/commit/c20f957)
11
+ * terraform 0.12 conversion - fix passing of atmos variables to terraform process [cad8c8f](https://github.com/simplygenius/atmos/commit/cad8c8f)
12
+ * add_config comment detection needs single quote empty strings [2ef430b](https://github.com/simplygenius/atmos/commit/2ef430b)
13
+ * fix summary for terraform 0.12 [bccb915](https://github.com/simplygenius/atmos/commit/bccb915)
14
+ * use empty string instead of null as terraform 0.12 now treats null differently [8dd3853](https://github.com/simplygenius/atmos/commit/8dd3853)
15
+
1
16
  0.10.1 (09/20/2019)
2
17
  -------------------
3
18
 
@@ -60,7 +60,7 @@ module SimplyGenius
60
60
 
61
61
  def all_env_names
62
62
  load
63
- @full_config[:environments].keys
63
+ (@full_config[:environments] || {}).keys
64
64
  end
65
65
 
66
66
  def account_hash
@@ -33,7 +33,8 @@ module SimplyGenius
33
33
  end
34
34
 
35
35
  def summarize(data)
36
- lines = data.lines.select {|l| l =~ /^[\e\[\dm\s]*[~+\-<]/ }.collect(&:chomp)
36
+ # Looking for +/-/~ at start within 2 spaces, could also look for lines that end with {
37
+ lines = data.lines.select {|l| l =~ /^[\e\[\dm]*\s{0,2}[~+\-<]/ }.collect(&:chomp)
37
38
  lines = lines.reject {|l| l =~ /-----/ }
38
39
  "Plan Summary:\n#{lines.join("\n")}"
39
40
  end
@@ -61,6 +61,12 @@ module SimplyGenius
61
61
  end
62
62
  end
63
63
 
64
+ # TF 0.12 deprecates values for undeclared vars in an tfvars file, so
65
+ # put it in env instead as they claim that to be the expected way to do
66
+ # so and will continue to work
67
+ # https://github.com/hashicorp/terraform/issues/19424
68
+ env = env.merge(atmos_env)
69
+
64
70
  # lets tempfiles created by subprocesses be easily found by users
65
71
  env['TMPDIR'] = Atmos.config.tmp_dir
66
72
 
@@ -139,7 +145,6 @@ module SimplyGenius
139
145
  clean_links
140
146
  link_support_dirs
141
147
  link_recipes
142
- write_atmos_vars
143
148
  setup_backend(skip_backend)
144
149
  end
145
150
 
@@ -209,25 +214,6 @@ module SimplyGenius
209
214
  end
210
215
  end
211
216
 
212
- def write_atmos_vars
213
- File.open(File.join(tf_recipes_dir, 'atmos.auto.tfvars.json'), 'w') do |f|
214
- # A mapping in the auto vars file is ignored if a variable declaration doesn't exist for it in a tf file. Thus,
215
- # as a convenience to allow everything from atmos to be referenceable, we put everything from the atmos_config
216
- # in a homogenized hash named atmos_config which is declared by the atmos scaffolding. For variables which are
217
- # declared, we also merge in atmos config with only the values homogenized (vs the entire map) so that hash
218
- # variables if declared in terraform can be managed from yml, set here and accessed from terraform
219
- #
220
- homogenized_config = homogenize_for_terraform(Atmos.config.to_h)
221
- var_hash = {
222
- all_env_names: Atmos.config.all_env_names,
223
- account_ids: Atmos.config.account_hash,
224
- atmos_config: homogenized_config
225
- }
226
- var_hash = var_hash.merge(Atmos.config.to_h)
227
- f.puts(JSON.pretty_generate(var_hash))
228
- end
229
- end
230
-
231
217
  def secrets_env
232
218
  # NOTE use an auto-deleting temp file if passing secrets through env ends
233
219
  # up being problematic
@@ -240,6 +226,41 @@ module SimplyGenius
240
226
  end
241
227
  end
242
228
 
229
+ def atmos_env
230
+ # A var value in the env is ignored if a variable declaration doesn't exist for it in a tf file. Thus,
231
+ # as a convenience to allow everything from atmos to be referenceable, we put everything from the atmos_config
232
+ # in a homogenized hash named atmos_config which is declared by the atmos scaffolding. For variables which are
233
+ # declared, we also merge in atmos config with only the values homogenized (vs the entire map) so that hash
234
+ # variables if declared in terraform can be managed from yml, set here and accessed from terraform
235
+ #
236
+ homogenized_config = homogenize_for_terraform(Atmos.config.to_h)
237
+ var_hash = {
238
+ all_env_names: Atmos.config.all_env_names,
239
+ account_ids: Atmos.config.account_hash,
240
+ atmos_config: homogenized_config
241
+ }
242
+ var_hash = var_hash.merge(Atmos.config.to_h)
243
+ env_hash = Hash[var_hash.collect do |k, v|
244
+ encoded_val = case v
245
+ when Numeric, String, TrueClass, FalseClass
246
+ v.to_s
247
+ else
248
+ JSON.generate(v)
249
+ end
250
+ ["TF_VAR_#{k}", encoded_val]
251
+ end]
252
+
253
+ # write out a file so users have some visibility into vars passed in -
254
+ # mostly useful for debugging
255
+ File.open(File.join(tf_recipes_dir, 'atmos-tfvars.env'), 'w') do |f|
256
+ env_hash.each do |k, v|
257
+ f.puts("#{k}='#{v}'")
258
+ end
259
+ end
260
+
261
+ return env_hash
262
+ end
263
+
243
264
  def clean_links
244
265
  Find.find(Atmos.config.tf_working_dir) do |f|
245
266
  Find.prune if f =~ /\/.terraform\/modules\//
@@ -1,5 +1,5 @@
1
1
  module SimplyGenius
2
2
  module Atmos
3
- VERSION = "0.10.1"
3
+ VERSION = "0.11.0"
4
4
  end
5
5
  end
@@ -35,14 +35,14 @@ global_name_prefix: "#{org}-#{atmos_env}-"
35
35
  # The local name prefix for disambiguating resource names that have a local
36
36
  # scope (e.g. when running multiple environments in the same account)
37
37
  #
38
- local_name_prefix:
38
+ local_name_prefix: ''
39
39
 
40
40
  # The prefix used for the resources global to the organization. Setting this
41
41
  # to something like "#{org}-" will allow you to manage multiple orgs from the same
42
42
  # ops account without name conflicts.
43
43
  # Most people should leave this blank.
44
44
  #
45
- org_prefix:
45
+ org_prefix: ''
46
46
 
47
47
  # Environment specific overrides. When adding new environments place them
48
48
  # after the existing ones so that you don't end up with permission issues when
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplygenius-atmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Conway
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-20 00:00:00.000000000 Z
11
+ date: 2019-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler