iapi-idlc-sdk-pfm 1.0.17 → 1.0.19

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: c0337e0cf970aef124b946cdf412e9aa5e8e639484da4d08d02cafe7716ae895
4
- data.tar.gz: cac3276955ec070712e4cbe70b3ab398a3d4d77e95e514c258a4ed0269cc2eb5
3
+ metadata.gz: 01fa98360adc8121e20c60cd777e3b07374319edfddd280dccd34458ded69db6
4
+ data.tar.gz: ab6612bae1f8e4837eadb9a5474b1dd1f40e15c8c2181f48b7a2bf0c56624e95
5
5
  SHA512:
6
- metadata.gz: 9c0883c1da9c4195cd3f9810393216585cde21e09e52c8dc35a01b5f28c3d467fe94adacfd7ce636af5f5f40479f70572ac2623fe763f54e5ed803f417219be0
7
- data.tar.gz: 65504eb0b0f29e8a2d5f7a93544fcad3bdd038ab78bace3285ed8d1d00be00a5dd8a40d55480b68055d87855dd6923e235a620aeb2525727f3c749b7dc99c095
6
+ metadata.gz: fa516af19c5b4750073ff0d7c17d40f6fac5eebc4332194463d43fe48e06e073bd9af9b8b94b099ec31af7ba191019a6a40e8c41673b8ab5733bd92ca7569af6
7
+ data.tar.gz: f9064c8865c6c1c651edbcdd71b62bc191879b6d0ca711fd676446f568d4e4e0da0c35634529dd1de3d0ef07a01777f8ad083f99c8ef1852faa86ac57481ad8b
@@ -62,7 +62,11 @@ module Pfm
62
62
  end
63
63
 
64
64
  def apply(dir)
65
- Terraform::Binary.apply(dir.to_s) || raise
65
+ if upgraded_terraform?
66
+ Terraform::Binary::Command.run("-chdir #{dir} apply")
67
+ else
68
+ Terraform::Binary.apply(dir.to_s) || raise
69
+ end
66
70
  rescue
67
71
  raise DeploymentFailure, 'Finished with errors'
68
72
  end
@@ -194,10 +194,12 @@ module Pfm
194
194
 
195
195
  # add to vars file and record key for dups
196
196
  keys[key] = 'parsed'
197
- vars_file += <<~EOH
198
- variable "#{key}" {}
197
+ unless upgraded_terraform?
198
+ vars_file += <<~EOH
199
+ variable "#{key}" {}
199
200
 
200
- EOH
201
+ EOH
202
+ end
201
203
 
202
204
  # load value into envrionment
203
205
  Idlc::Deploy::Config.add_deployment_var(key, value)
@@ -205,7 +207,9 @@ module Pfm
205
207
  end
206
208
 
207
209
  # write vars file
208
- File.open("#{config[:working_dir]}/#{env_metadata['environment_key']}-tfvars.tf", 'w') { |file| file.write(vars_file) }
210
+ unless upgraded_terraform?
211
+ File.open("#{config[:working_dir]}/#{env_metadata['environment_key']}-tfvars.tf", 'w') { |file| file.write(vars_file) }
212
+ end
209
213
 
210
214
  # Pass some extra vars for Terraform
211
215
  Idlc::Deploy::Config.add_deployment_var('aws_region', SETTINGS['AWS_REGION'])
@@ -231,6 +235,11 @@ module Pfm
231
235
  "#{__dir__}/templates/#{@build_metadata.attributes['build_stage'].value}"
232
236
  end
233
237
 
238
+ def upgraded_terraform?
239
+ major version = Terraform::Binary.config.version.split(".")[0]
240
+ major_version > 0
241
+ end
242
+
234
243
  def build_base_dir
235
244
  "#{SETTINGS['BUILD_BASE_DIR']}/#{@params.first}"
236
245
  end
@@ -53,7 +53,11 @@ module Pfm
53
53
  Idlc::Deploy::Config.add_deployment_var('build', ENV['SERVER_BUILD'])
54
54
  Idlc::Deploy::Config.add_deployment_var('app_release', 'null')
55
55
 
56
- Terraform::Binary.destroy("#{dir}")
56
+ if upgraded_terraform?
57
+ Terraform::Binary::Command.run("-chdir #{dir} destroy")
58
+ else
59
+ Terraform::Binary.destroy("#{dir}")
60
+ end
57
61
  rescue
58
62
  raise DeploymentFailure, 'Finished with errors'
59
63
  end
@@ -36,9 +36,13 @@ module Pfm
36
36
  tf_paths = %W[#{inf_base_dir}/tf lib/tf/modules]
37
37
 
38
38
  begin
39
- tf_paths.each do |path|
40
- # Format the file to a canonical syntax
41
- Terraform::Binary.fmt(path)
39
+ if upgraded_terraform?
40
+ Terraform::Binary::Command.run("-chdir #{inf_base_dir}/tf fmt")
41
+ else
42
+ tf_paths.each do |path|
43
+ # Format the file to a canonical syntax
44
+ Terraform::Binary.fmt(path)
45
+ end
42
46
  end
43
47
  rescue
44
48
  raise DeploymentFailure, 'Finished with errors'
@@ -70,8 +70,13 @@ module Pfm
70
70
 
71
71
  def plan(dir)
72
72
  begin
73
- Terraform::Binary.plan(dir.to_s) unless @config[:landscape]
74
- Terraform::Binary.plan("#{dir} | landscape") if @config[:landscape]
73
+ if upgraded_terraform?
74
+ Terraform::Binary::Command.run("-chdir #{dir} plan") unless @config[:landscape]
75
+ Terraform::Binary::Command.run("-chdir #{dir} plan | landscape") if @config[:landscape]
76
+ else
77
+ Terraform::Binary.plan(dir.to_s) unless @config[:landscape]
78
+ Terraform::Binary.plan("#{dir} | landscape") if @config[:landscape]
79
+ end
75
80
  rescue
76
81
  raise DeploymentFailure, 'Finished with errors'
77
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iapi-idlc-sdk-pfm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.17
4
+ version: 1.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-11-26 00:00:00.000000000 Z
12
+ date: 2024-12-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler