cloudspin-stack 0.1.33 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/cloudspin/cli.rb +4 -0
- data/lib/cloudspin/stack/backend_configuration.rb +11 -1
- data/lib/cloudspin/stack/instance.rb +4 -0
- data/lib/cloudspin/stack/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d199078def81cfc0c8928e11ab561e2396e41e47500ecbe7c852ba4a83f84f7
|
4
|
+
data.tar.gz: a80914bd8ebe73c5d98944cc20b80e55e629e739eca4980aa544ac242db31e5e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b36c3779d56a589b0d1d8e21a7fcee4a2a66afab7dc51d0ff2ad98c42ea675c263543c5726e4fe7cfc99d1d8083739fa3a10e8fb677ad23fc2848b06ff49c2c
|
7
|
+
data.tar.gz: d518a294570417ef21b81ec3b75cd59447fb152083ee54acf3c94f37fa9e6532e4e0e02d188510a1a1f05c1eadbf17c5733f68ca323a8dd7060f6c88d040a55e
|
data/lib/cloudspin/cli.rb
CHANGED
@@ -33,11 +33,13 @@ module Cloudspin
|
|
33
33
|
elsif options[:plan] && ! options[:dry]
|
34
34
|
instance.prepare
|
35
35
|
puts terraform_runner.plan
|
36
|
+
instance.after
|
36
37
|
elsif ! options[:plan] && options[:dry]
|
37
38
|
puts terraform_runner.up_dry
|
38
39
|
else
|
39
40
|
instance.prepare
|
40
41
|
terraform_runner.up
|
42
|
+
instance.after
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
@@ -62,11 +64,13 @@ module Cloudspin
|
|
62
64
|
elsif options[:plan] && ! options[:dry]
|
63
65
|
instance.prepare
|
64
66
|
puts terraform_runner.plan(plan_destroy: true)
|
67
|
+
instance.after
|
65
68
|
elsif ! options[:plan] && options[:dry]
|
66
69
|
puts terraform_runner.down_dry
|
67
70
|
else
|
68
71
|
instance.prepare
|
69
72
|
terraform_runner.down
|
73
|
+
instance.after
|
70
74
|
end
|
71
75
|
end
|
72
76
|
|
@@ -65,6 +65,12 @@ module Cloudspin
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
+
def after(working_folder:)
|
69
|
+
if migrate_state?
|
70
|
+
disable_local_statefile
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
68
74
|
def add_backend_terraform_file_to(working_folder)
|
69
75
|
# puts "DEBUG: Creating file #{working_folder}/_cloudspin_backend.tf"
|
70
76
|
File.open("#{working_folder}/_cloudspin_backend.tf", 'w') { |backend_file|
|
@@ -80,13 +86,17 @@ module Cloudspin
|
|
80
86
|
def create_local_state_folder
|
81
87
|
# puts "DEBUG: backend_configuration.create_local_state_folder: #{@local_state_folder}"
|
82
88
|
FileUtils.mkdir_p @local_state_folder
|
83
|
-
# Pathname.new(@local_state_folder).realdirpath.to_s
|
84
89
|
end
|
85
90
|
|
86
91
|
def copy_statefile_to(working_folder)
|
87
92
|
FileUtils.copy(@local_statefile, "#{working_folder}/terraform.tfstate")
|
88
93
|
end
|
89
94
|
|
95
|
+
def disable_local_statefile
|
96
|
+
# puts "DEBUG: Renaming local statefile from '#{@local_statefile}' to '#{@local_statefile}.migrated'"
|
97
|
+
FileUtils.move(@local_statefile, "#{@local_statefile}.migrated")
|
98
|
+
end
|
99
|
+
|
90
100
|
def default_state_key
|
91
101
|
"#{@instance_identifier}.tfstate"
|
92
102
|
end
|