aws-sdk-utils 0.0.7 → 0.0.8
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/bin/cfndsl_converge +10 -5
- data/lib/cfndsl_converger.rb +8 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 210b00d46c72637ff46b218dde0c98061baad0e9
|
4
|
+
data.tar.gz: 6374d373cb4e2493e6eb2fa91fb9d9d0c7cab495
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d38c854063539ed94bf6f979594fd5ca4f71ffc6d5d40450bb55a3cc5f9e04e7d052b1b680907bf7e14ceaeed951ff1546eed14f958a899c37a80aa2899d6a7
|
7
|
+
data.tar.gz: 63e1b35303854903e9bd47cf1523985c2abb4554bbfc4de0358ba71d739466859090ed1fc05a62c26a144198ccf4103c9f341bc52da7fd87b273e73d23a01638
|
data/bin/cfndsl_converge
CHANGED
@@ -12,9 +12,14 @@ end
|
|
12
12
|
|
13
13
|
bindings = opts[:path_to_yaml].nil? ? nil : YAML.load_file(opts[:path_to_yaml])
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
begin
|
16
|
+
outputs = CfndslConverger.new.converge(stack_name: opts[:stack_name],
|
17
|
+
path_to_stack: opts[:path_to_stack],
|
18
|
+
bindings: bindings,
|
19
|
+
fail_on_changes_to_immutable_resource: opts[:fail_on_changes_to_immutable_resource])
|
19
20
|
|
20
|
-
puts outputs.to_yaml
|
21
|
+
puts outputs.to_yaml
|
22
|
+
rescue Exception => e
|
23
|
+
puts e.message
|
24
|
+
exit 1
|
25
|
+
end
|
data/lib/cfndsl_converger.rb
CHANGED
@@ -35,7 +35,7 @@ class CfndslConverger
|
|
35
35
|
extras,
|
36
36
|
verbose)
|
37
37
|
|
38
|
-
if fail_on_changes_to_immutable_resource
|
38
|
+
if fail_on_changes_to_immutable_resource and stack_exists?(stack_name)
|
39
39
|
unsafe_logical_resource_id = ChangesetUtil.new.immutable_resources_that_would_change stack_name: stack_name,
|
40
40
|
template_body: model.to_json
|
41
41
|
if unsafe_logical_resource_id.nil?
|
@@ -70,12 +70,18 @@ class CfndslConverger
|
|
70
70
|
|
71
71
|
private
|
72
72
|
|
73
|
+
def stack_exists?(stack_name)
|
74
|
+
cloudformation_client = Aws::CloudFormation::Client.new
|
75
|
+
resource = Aws::CloudFormation::Resource.new(client: cloudformation_client)
|
76
|
+
resource.stacks.find {|stack| stack.name == stack_name }
|
77
|
+
end
|
78
|
+
|
73
79
|
def converge_stack(stack_name:,
|
74
80
|
stack_body:)
|
75
81
|
|
76
82
|
cloudformation_client = Aws::CloudFormation::Client.new
|
77
83
|
resource = Aws::CloudFormation::Resource.new(client: cloudformation_client)
|
78
|
-
if
|
84
|
+
if stack_exists?(stack_name)
|
79
85
|
stack = resource.stack(stack_name)
|
80
86
|
begin
|
81
87
|
stack.update(template_body: stack_body,
|