iapi-idlc-sdk-pfm 1.0.7 → 1.0.8

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: 24b2cc5e473ad689d4e1752d0f97254cea6b41c4de2119fb420daab162d299e3
4
- data.tar.gz: bd667c4c94198324f9a8d5ff15cf4ac2eb1048f6fd4895418e67d5980189d280
3
+ metadata.gz: 9c0f88b0c2f50e9757c3b8e5bd81a20af7ba90fb53b4e3fd290b4cf71d7312ee
4
+ data.tar.gz: 7c98aa4cef505b75bf6481c731840572e342ac36221b90b66e28b0e19e69a41a
5
5
  SHA512:
6
- metadata.gz: 621b422051ab26a6b2d33c479b18f7265b10172326442cc8c4c0bf1a01f7a4a7dbca4bc7fdeb5ace1c5cbcba5dd813ecae66433bdbead180d55edc8dbc8f8c5e
7
- data.tar.gz: 790eabc421f2beba9a482dd57669cd7e07d718c882ea490cc17918718a298caa1be59b8c493a5f0e44e97cf4ee31d0fa7fbb1885760789c31d3c0daff7a37b8d
6
+ metadata.gz: 64616a73140318ede865033b1294b7d081d531ab38006872d101ccff549d3e281f9be9c847c8cd66a00d2715444487450fcc9d2bc8aedad9b60b16c624839f51
7
+ data.tar.gz: d7edaac5dcbc4e6b7e037648535a5fbf9655fd8169bd817868f5ef2b3bdd0016b3160308c01af799b1aa7c62982659ac14f9d64e11d2c3cf3f31092bf498cec4
@@ -68,6 +68,14 @@ module Pfm
68
68
  @workspace.cleanup unless @workspace.empty?
69
69
  end
70
70
 
71
+ def download_private_key(bucket, subkey, outdir)
72
+ s3 = Aws::S3::Client.new(region: SETTINGS['AWS_REGION'])
73
+ resp = s3.get_object(bucket: bucket, key: "#{subkey}/private_key.pem", response_target: "#{outdir}/private_key.pem")
74
+ true
75
+ rescue Aws::S3::Errors::NoSuchKey
76
+ false
77
+ end
78
+
71
79
  def build_setup
72
80
  Packer::Binary.configure do |config|
73
81
  config.version = SETTINGS['PACKER_VERSION']
@@ -151,6 +159,8 @@ module Pfm
151
159
  Idlc::Deploy::Config.add_deployment_var('build', @config[:server_build])
152
160
  Idlc::Deploy::Config.add_deployment_var('app_release', @config[:app_release])
153
161
 
162
+ FileUtils.mkdir_p "inf/env/kp"
163
+ download_private_key(bucket_name, sub_bucket, "#{inf_base_dir}/env/kp")
154
164
  Idlc::Deploy::Keypair.generate("#{inf_base_dir}/env/kp")
155
165
  @workspace.flatten("#{inf_base_dir}/tf", 'tf')
156
166
  @workspace.add("#{inf_base_dir}/env/kp")
@@ -205,6 +215,7 @@ module Pfm
205
215
  ENV['APP_RELEASE'] = @config[:app_release]
206
216
 
207
217
  FileUtils.mkdir_p "inf/env/kp"
218
+ download_private_key(env_metadata['account']['tfstate_bucket'], env_metadata['environment_key'], "inf/env/kp")
208
219
  Idlc::Deploy::Keypair.generate("inf/env/kp")
209
220
 
210
221
  config = Idlc::Deploy::Config.new(SETTINGS['AWS_REGION'])
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.7
4
+ version: 1.0.8
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: 2023-11-27 00:00:00.000000000 Z
12
+ date: 2024-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler