idlc-sdk-deploy 1.0.0.rc8 → 1.0.0.rc9

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
  SHA1:
3
- metadata.gz: 25b815300a86f6ed3eae3b716330656fe21ab8c8
4
- data.tar.gz: 705a0e1696fdad4cbe063e11e38decb11f5b1079
3
+ metadata.gz: d35c6385b97edcade6aba1bf1537e3033597c04b
4
+ data.tar.gz: f88a36e0269f66a21f385d8ad7137bbdf9ed3b08
5
5
  SHA512:
6
- metadata.gz: 2f8c685ca87bcec894051950e7abbcd7cdecefaa4939eed76046b3077e401c9620e454818b8f6c46f18bde9879a41396ecf3306502201f23d2a7c79d498413f5
7
- data.tar.gz: 8081739d4e19e407f1640ce48982a188cdd940512992b892ad0fe85129d479ac41c958d55636dca0a5a10c19155ef3b373eedd600d73a07a8f5aa5fd8d6ce92a
6
+ metadata.gz: 269c443a5848219e713d3f6db492c735f8a1928ed3e230eb3bab3dba14a265ae6d1f055768836efedf69032c8a4f4519fb05c228edd1bcb9f9f8c159e6b7609a
7
+ data.tar.gz: 8481cd2cd8ef05887466a35c5b3781a187667af5c901105abd94b6ee22e9a4d4aa9694e933049f4d7a148756ad769d8a20b18530b922f565e8c1917a5b686d6b
@@ -33,11 +33,13 @@ module Idlc
33
33
  exit 1
34
34
  end
35
35
 
36
- def configure_state(bucket, sub_bucket)
36
+ def configure_state(bucket, sub_bucket, working_directory)
37
37
  validate_environment
38
38
 
39
- configure_tfstatev8(bucket, sub_bucket) if Terraform::Binary::config.version.to_i <= 0.8
40
- configure_tfstatev9 if Terraform::Binary::config.version.to_i > 0.8
39
+ tf_version = Terraform::Binary::config.version.split('.')
40
+
41
+ configure_tfstatev8(bucket, sub_bucket, working_directory) if tf_version[0].to_i == 0 && tf_version[1].to_i <= 8
42
+ configure_tfstatev9(bucket, sub_bucket, working_directory) if tf_version[0].to_i >= 0 && tf_version[1].to_i > 8
41
43
  end
42
44
 
43
45
  def parse(config_file)
@@ -58,7 +60,7 @@ module Idlc
58
60
 
59
61
  private
60
62
 
61
- def configure_tfstatev8(bucket, sub_bucket)
63
+ def configure_tfstatev8(bucket, sub_bucket, working_directory)
62
64
  args = []
63
65
  args << '-backend=s3'
64
66
  args << '-backend-config="acl=private"'
@@ -68,10 +70,17 @@ module Idlc
68
70
  args << "-backend-config=\"region=#{@region}\""
69
71
 
70
72
  Terraform::Binary.remote("config #{args.join(' ')}")
73
+ Terraform::Binary.get("-update #{working_directory}")
71
74
  end
72
75
 
73
- def configure_tfstatev9
74
- Terraform::Binary.init()
76
+ def configure_tfstatev9(bucket, sub_bucket, working_directory)
77
+ args = []
78
+ args << "-backend-config=\"bucket=#{bucket}\""
79
+ args << "-backend-config=\"key=#{sub_bucket}/terraform.tfstate\""
80
+ args << "-backend-config=\"region=#{@region}\""
81
+ args << "-force-copy"
82
+
83
+ Terraform::Binary.init("#{args.join(' ')} #{working_directory}")
75
84
  end
76
85
 
77
86
  def validate_environment
@@ -1,5 +1,5 @@
1
1
  module Idlc
2
2
  module Deploy
3
- VERSION = '1.0.0.rc8'.freeze
3
+ VERSION = '1.0.0.rc9'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idlc-sdk-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.rc8
4
+ version: 1.0.0.rc9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Cazell