iapi-idlc-sdk-pfm 1.0.18 → 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: 02b07d40dc69b2bf36a0c8708bdf91683c9e89992229ecdd55b29837741f0d80
4
- data.tar.gz: c9f9143e6ffc323c7a0353b8d300dee681d8e33074c9a4cf822941593561e3e7
3
+ metadata.gz: 01fa98360adc8121e20c60cd777e3b07374319edfddd280dccd34458ded69db6
4
+ data.tar.gz: ab6612bae1f8e4837eadb9a5474b1dd1f40e15c8c2181f48b7a2bf0c56624e95
5
5
  SHA512:
6
- metadata.gz: '083b8e87d34376cc679047624985c5527e3f32d67e992d3bf3c15e12db7cd20135408106f721e967b48cc9945596b9b5c4adcfeb0f83ea5933ec5f93e05cc7cf'
7
- data.tar.gz: 1220c987e218f151dd26c60241f9b869900d8b5d3780ea6c91cc66ffbba49181e147e647ce0b2b0796abdfa03ae44c6ce8f1b81c8c53eb7ee26ceed04b999772
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
@@ -33,12 +33,6 @@ module Pfm
33
33
  boolean: true,
34
34
  default: false
35
35
 
36
- option :skip_tfvar_file,
37
- long: '--skip-tfvar-file',
38
- description: 'Skip TF Var File',
39
- boolean: true,
40
- default: false
41
-
42
36
  def initialize
43
37
  super
44
38
 
@@ -200,7 +194,7 @@ module Pfm
200
194
 
201
195
  # add to vars file and record key for dups
202
196
  keys[key] = 'parsed'
203
- unless @config[:skip_tfvar_file]
197
+ unless upgraded_terraform?
204
198
  vars_file += <<~EOH
205
199
  variable "#{key}" {}
206
200
 
@@ -213,7 +207,7 @@ module Pfm
213
207
  end
214
208
 
215
209
  # write vars file
216
- unless @config[:skip_tfvar_file]
210
+ unless upgraded_terraform?
217
211
  File.open("#{config[:working_dir]}/#{env_metadata['environment_key']}-tfvars.tf", 'w') { |file| file.write(vars_file) }
218
212
  end
219
213
 
@@ -241,6 +235,11 @@ module Pfm
241
235
  "#{__dir__}/templates/#{@build_metadata.attributes['build_stage'].value}"
242
236
  end
243
237
 
238
+ def upgraded_terraform?
239
+ major version = Terraform::Binary.config.version.split(".")[0]
240
+ major_version > 0
241
+ end
242
+
244
243
  def build_base_dir
245
244
  "#{SETTINGS['BUILD_BASE_DIR']}/#{@params.first}"
246
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.18
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