stack_master 1.5.0 → 1.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -0
  3. data/lib/stack_master/commands/terminal_helper.rb +14 -1
  4. data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
  5. data/lib/stack_master/version.rb +1 -1
  6. metadata +21 -216
  7. data/.gitignore +0 -18
  8. data/.rspec +0 -2
  9. data/.travis.yml +0 -12
  10. data/CODE_OF_CONDUCT.md +0 -73
  11. data/Gemfile +0 -4
  12. data/LICENSE.txt +0 -22
  13. data/Rakefile +0 -27
  14. data/apply_demo.gif +0 -0
  15. data/example/simple/Gemfile +0 -3
  16. data/example/simple/parameters/myapp_vpc.yml +0 -1
  17. data/example/simple/parameters/myapp_web.yml +0 -2
  18. data/example/simple/stack_master.yml +0 -13
  19. data/example/simple/templates/myapp_vpc.rb +0 -39
  20. data/example/simple/templates/myapp_web.rb +0 -16
  21. data/features/apply.feature +0 -392
  22. data/features/apply_with_compile_time_parameters.feature +0 -93
  23. data/features/apply_with_env_parameters.feature +0 -49
  24. data/features/apply_with_parameter_store_parameters.feature +0 -47
  25. data/features/apply_with_s3.feature +0 -106
  26. data/features/delete.feature +0 -29
  27. data/features/diff.feature +0 -179
  28. data/features/events.feature +0 -33
  29. data/features/init.feature +0 -6
  30. data/features/outputs.feature +0 -45
  31. data/features/region_aliases.feature +0 -62
  32. data/features/resources.feature +0 -42
  33. data/features/stack_defaults.feature +0 -82
  34. data/features/status.feature +0 -118
  35. data/features/step_definitions/parameter_store_steps.rb +0 -14
  36. data/features/step_definitions/stack_steps.rb +0 -71
  37. data/features/support/env.rb +0 -16
  38. data/features/validate.feature +0 -46
  39. data/logo.png +0 -0
  40. data/script/buildkite/bundle.sh +0 -5
  41. data/script/buildkite/clean.sh +0 -3
  42. data/script/buildkite_rspec.sh +0 -27
  43. data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
  44. data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
  45. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
  46. data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
  47. data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
  48. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
  49. data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
  50. data/spec/fixtures/stack_master.yml +0 -49
  51. data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
  52. data/spec/fixtures/templates/myapp_vpc.json +0 -1
  53. data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
  54. data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
  55. data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
  56. data/spec/fixtures/test/.gitkeep +0 -0
  57. data/spec/spec_helper.rb +0 -102
  58. data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
  59. data/spec/stack_master/change_set_spec.rb +0 -70
  60. data/spec/stack_master/command_spec.rb +0 -66
  61. data/spec/stack_master/commands/apply_spec.rb +0 -259
  62. data/spec/stack_master/commands/delete_spec.rb +0 -40
  63. data/spec/stack_master/commands/init_spec.rb +0 -17
  64. data/spec/stack_master/commands/status_spec.rb +0 -44
  65. data/spec/stack_master/commands/validate_spec.rb +0 -27
  66. data/spec/stack_master/config_spec.rb +0 -153
  67. data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
  68. data/spec/stack_master/parameter_loader_spec.rb +0 -110
  69. data/spec/stack_master/parameter_resolver_spec.rb +0 -148
  70. data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
  71. data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
  72. data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
  73. data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
  74. data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
  75. data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
  76. data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
  77. data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
  78. data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
  79. data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
  80. data/spec/stack_master/prompter_spec.rb +0 -23
  81. data/spec/stack_master/resolver_array_spec.rb +0 -42
  82. data/spec/stack_master/security_group_finder_spec.rb +0 -49
  83. data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
  84. data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
  85. data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
  86. data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
  87. data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
  88. data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
  89. data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
  90. data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
  91. data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
  92. data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
  93. data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
  94. data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
  95. data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
  96. data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
  97. data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
  98. data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
  99. data/spec/stack_master/stack_definition_spec.rb +0 -70
  100. data/spec/stack_master/stack_differ_spec.rb +0 -46
  101. data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
  102. data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
  103. data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
  104. data/spec/stack_master/stack_spec.rb +0 -184
  105. data/spec/stack_master/template_compiler_spec.rb +0 -39
  106. data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
  107. data/spec/stack_master/template_compilers/json_spec.rb +0 -32
  108. data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
  109. data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
  110. data/spec/stack_master/template_utils_spec.rb +0 -21
  111. data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
  112. data/spec/stack_master/test_driver/s3_spec.rb +0 -17
  113. data/spec/stack_master/utils_spec.rb +0 -30
  114. data/spec/stack_master/validator_spec.rb +0 -56
  115. data/spec/stack_master_spec.rb +0 -81
  116. data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
  117. data/spec/support/validator_spec.rb +0 -23
  118. data/stack_master.gemspec +0 -46
  119. data/stacktemplates/parameter_region.yml +0 -3
  120. data/stacktemplates/parameter_stack_name.yml +0 -3
  121. data/stacktemplates/stack.json.erb +0 -20
  122. data/stacktemplates/stack_master.yml.erb +0 -6
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in stack_master.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2015 Steve Hodgkiss
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,27 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require 'bundler/setup'
3
-
4
- task :environment do
5
- require 'stack_master'
6
- end
7
-
8
- task :console => :environment do
9
- require 'pry'
10
- binding.pry
11
- end
12
-
13
- # Add specs and features tests
14
- begin
15
- require 'cucumber/rake/task'
16
- Cucumber::Rake::Task.new(:features) do |t|
17
- t.cucumber_opts = "features --format pretty"
18
- end
19
-
20
- require 'rspec/core/rake_task'
21
- RSpec::Core::RakeTask.new(:spec) do |t|
22
- t.rspec_opts = "--format doc"
23
- end
24
- rescue LoadError
25
- end
26
-
27
- task :default => [:features, :spec]
data/apply_demo.gif DELETED
Binary file
@@ -1,3 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'stack_master', path: '../../'
@@ -1 +0,0 @@
1
- vpc_az_1: ap-southeast-2a
@@ -1,2 +0,0 @@
1
- VpcId:
2
- stack_output: myapp-vpc/VpcId
@@ -1,13 +0,0 @@
1
- stack_defaults:
2
- tags:
3
- application: my-awesome-app
4
- region_defaults:
5
- ap_southeast_2:
6
- tags:
7
- environment: production
8
- stacks:
9
- ap_southeast_2:
10
- myapp_vpc:
11
- template: myapp_vpc.rb
12
- myapp_web:
13
- template: myapp_web.rb
@@ -1,39 +0,0 @@
1
- SparkleFormation.new(:myapp_vpc) do
2
- description "A test VPC template"
3
-
4
- resources.vpc do
5
- type 'AWS::EC2::VPC'
6
- properties do
7
- cidr_block '10.200.0.0/16'
8
- end
9
- end
10
-
11
- parameters.vpc_az_1 do
12
- description 'VPC AZ 1'
13
- type 'AWS::EC2::AvailabilityZone::Name'
14
- end
15
-
16
- resources.public_subnet do
17
- type 'AWS::EC2::Subnet'
18
- properties do
19
- vpc_id ref!(:vpc)
20
- cidr_block '10.200.1.0/24'
21
- availability_zone ref!(:vpc_az_1)
22
- tags _array(
23
- { Key: 'Name', Value: 'PublicSubnet' },
24
- { Key: 'network', Value: 'public' }
25
- )
26
- end
27
- end
28
-
29
- outputs do
30
- vpc_id do
31
- description 'VPC ID'
32
- value ref!(:vpc)
33
- end
34
- public_subnet do
35
- description 'Public subnet'
36
- value ref!(:public_subnet)
37
- end
38
- end
39
- end
@@ -1,16 +0,0 @@
1
- SparkleFormation.new(:myapp_web) do
2
- description "Test web template"
3
-
4
- parameters.vpc_id do
5
- description 'VPC ID'
6
- type 'String'
7
- end
8
-
9
- resources.web_sg do
10
- type 'AWS::EC2::SecurityGroup'
11
- properties do
12
- group_description 'Security group for web instances'
13
- vpc_id ref!(:vpc_id)
14
- end
15
- end
16
- end
@@ -1,392 +0,0 @@
1
- Feature: Apply command
2
-
3
- Background:
4
- Given a file named "stack_master.yml" with:
5
- """
6
- stacks:
7
- us_east_1:
8
- myapp_vpc:
9
- template: myapp_vpc.rb
10
- myapp_web:
11
- template: myapp_web.rb
12
- """
13
- And a directory named "parameters"
14
- And a file named "parameters/myapp_vpc.yml" with:
15
- """
16
- KeyName: my-key
17
- """
18
- And a file named "parameters/myapp_web.yml" with:
19
- """
20
- VpcId: vpc-blah
21
- """
22
- And a directory named "templates"
23
- And a file named "templates/myapp_vpc.rb" with:
24
- """
25
- SparkleFormation.new(:myapp_vpc) do
26
- description "Test template"
27
- set!('AWSTemplateFormatVersion', '2010-09-09')
28
-
29
- parameters.key_name do
30
- description 'Key name'
31
- type 'String'
32
- end
33
-
34
- resources.vpc do
35
- type 'AWS::EC2::VPC'
36
- properties do
37
- cidr_block '10.200.0.0/16'
38
- end
39
- end
40
-
41
- outputs do
42
- vpc_id do
43
- description 'A VPC ID'
44
- value ref!(:vpc)
45
- end
46
- end
47
- end
48
- """
49
- And a file named "templates/myapp_web.rb" with:
50
- """
51
- SparkleFormation.new(:myapp_web) do
52
- description "Test template"
53
- set!('AWSTemplateFormatVersion', '2010-09-09')
54
-
55
- parameters.vpc_id do
56
- description 'VPC ID'
57
- type 'AWS::EC2::VPC::Id'
58
- end
59
-
60
- resources.test_sg do
61
- type 'AWS::EC2::SecurityGroup'
62
- properties do
63
- group_description 'Test SG'
64
- vpc_id ref!(:vpc_id)
65
- end
66
- end
67
- end
68
- """
69
-
70
- Scenario: Run apply and create a new stack
71
- Given I stub the following stack events:
72
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
73
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
74
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
75
- When I run `stack_master apply us-east-1 myapp-vpc --trace`
76
- And the output should contain all of these lines:
77
- | Stack diff: |
78
- | + "Vpc": { |
79
- | Parameters diff: |
80
- | KeyName: my-key |
81
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
82
- Then the exit status should be 0
83
-
84
- Scenario: Run apply and don't create the stack
85
- Given I will answer prompts with "n"
86
- When I run `stack_master apply us-east-1 myapp-vpc --trace`
87
- And the output should contain all of these lines:
88
- | Stack diff: |
89
- | + "Vpc": { |
90
- | Parameters diff: |
91
- | KeyName: my-key |
92
- | aborted |
93
- And the output should not match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
94
- Then the exit status should be 0
95
-
96
- Scenario: Run apply with region only and create 2 stacks
97
- Given I stub the following stack events:
98
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
99
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
100
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
101
- | 1 | 1 | myapp-web | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
102
- | 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
103
- When I run `stack_master apply us-east-1 --trace`
104
- And the output should contain all of these lines:
105
- | Stack diff: |
106
- | + "Vpc": { |
107
- | Parameters diff: |
108
- | KeyName: my-key |
109
-
110
- Scenario: Run apply nothing and create 2 stacks
111
- Given I stub the following stack events:
112
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
113
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
114
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
115
- | 1 | 1 | myapp-web | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
116
- | 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
117
- When I run `stack_master apply --trace`
118
- And the output should contain all of these lines:
119
- | Stack diff: |
120
- | + "Vpc": { |
121
- | Parameters diff: |
122
- | KeyName: my-key |
123
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
124
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/
125
- Then the exit status should be 0
126
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
127
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/
128
- Then the exit status should be 0
129
-
130
- Scenario: Create stack with --changed
131
- Given I stub the following stack events:
132
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
133
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
134
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
135
- | 1 | 1 | myapp-web | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
136
- | 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
137
- When I run `stack_master --changed apply us-east-1 --trace`
138
- And the output should contain all of these lines:
139
- | Stack diff: |
140
- | + "Vpc": { |
141
- | Parameters diff: |
142
- | KeyName: my-key |
143
-
144
- Scenario: Run apply with 2 specific stacks and create 2 stacks
145
- Given I stub the following stack events:
146
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
147
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
148
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
149
- | 1 | 1 | myapp-web | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
150
- | 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
151
- When I run `stack_master apply us-east-1 myapp-vpc us-east-1 myapp-web --trace`
152
- And the output should contain all of these lines:
153
- | Stack diff: |
154
- | + "Vpc": { |
155
- | Parameters diff: |
156
- | KeyName: my-key |
157
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
158
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/
159
- Then the exit status should be 0
160
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
161
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/
162
- Then the exit status should be 0
163
-
164
- Scenario: Update a stack
165
- Given I stub the following stack events:
166
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
167
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
168
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
169
- And I stub the following stacks:
170
- | stack_id | stack_name | parameters | region |
171
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 |
172
- And I stub a template for the stack "myapp-vpc":
173
- """
174
- {
175
- "Description": "Test template",
176
- "AWSTemplateFormatVersion": "2010-09-09",
177
- "Parameters": {
178
- "KeyName": {
179
- "Description": "Key Name",
180
- "Type": "String"
181
- }
182
- },
183
- "Resources": {
184
- "TestSg": {
185
- "Type": "AWS::EC2::SecurityGroup",
186
- "Properties": {
187
- "GroupDescription": "Test SG",
188
- "VpcId": {
189
- "Ref": "VpcId"
190
- }
191
- }
192
- },
193
- "TestSg2": {
194
- "Type": "AWS::EC2::SecurityGroup",
195
- "Properties": {
196
- "GroupDescription": "Test SG 2",
197
- "VpcId": {
198
- "Ref": "VpcId"
199
- }
200
- }
201
- }
202
- }
203
- }
204
- """
205
- When I run `stack_master apply us-east-1 myapp-vpc --trace`
206
- And the output should contain all of these lines:
207
- | Stack diff: |
208
- | - "TestSg2": { |
209
- | Parameters diff: No changes |
210
- | ======================================== |
211
- | Proposed change set: |
212
- | Replace |
213
- | ======================================== |
214
- | Apply change set (y/n)? |
215
- Then the exit status should be 0
216
-
217
- Scenario: Update a stack that has changed with --changed
218
- Given I stub the following stack events:
219
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
220
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
221
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
222
- And I stub the following stacks:
223
- | stack_id | stack_name | parameters | region |
224
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 |
225
- And I stub a template for the stack "myapp-vpc":
226
- """
227
- {
228
- "Description": "Test template",
229
- "AWSTemplateFormatVersion": "2010-09-09",
230
- "Parameters": {
231
- "KeyName": {
232
- "Description": "Key Name",
233
- "Type": "String"
234
- }
235
- },
236
- "Resources": {
237
- "TestSg": {
238
- "Type": "AWS::EC2::SecurityGroup",
239
- "Properties": {
240
- "GroupDescription": "Test SG",
241
- "VpcId": {
242
- "Ref": "VpcId"
243
- }
244
- }
245
- },
246
- "TestSg2": {
247
- "Type": "AWS::EC2::SecurityGroup",
248
- "Properties": {
249
- "GroupDescription": "Test SG 2",
250
- "VpcId": {
251
- "Ref": "VpcId"
252
- }
253
- }
254
- }
255
- }
256
- }
257
- """
258
- When I run `stack_master --changed apply us-east-1 myapp-vpc --trace`
259
- And the output should contain all of these lines:
260
- | Stack diff: |
261
- | - "TestSg2": { |
262
- | Parameters diff: No changes |
263
- Then the exit status should be 0
264
-
265
- Scenario: Update an existing stack that hasn't changed with --changed
266
- Given I stub the following stack events:
267
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
268
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
269
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
270
- And I stub the following stacks:
271
- | stack_id | stack_name | parameters | region |
272
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 |
273
- And I stub a template for the stack "myapp-vpc":
274
- """
275
- {
276
- "Description": "Test template",
277
- "AWSTemplateFormatVersion": "2010-09-09",
278
- "Parameters": {
279
- "KeyName": {
280
- "Description": "Key name",
281
- "Type": "String"
282
- }
283
- },
284
- "Resources": {
285
- "Vpc": {
286
- "Type": "AWS::EC2::VPC",
287
- "Properties": {
288
- "CidrBlock": "10.200.0.0/16"
289
- }
290
- }
291
- },
292
- "Outputs": {
293
- "VpcId": {
294
- "Description": "A VPC ID",
295
- "Value": {
296
- "Ref": "Vpc"
297
- }
298
- }
299
- }
300
- }
301
- """
302
- When I run `stack_master --changed apply us-east-1 myapp-vpc --trace`
303
- And the output should not contain all of these lines:
304
- | Stack diff: |
305
- | - "TestSg2": { |
306
- | Parameters diff: No changes |
307
- Then the exit status should be 0
308
-
309
- Scenario: Create a stack using a stack output resolver
310
- Given a file named "parameters/myapp_web.yml" with:
311
- """
312
- VpcId:
313
- stack_output: myapp-vpc/VpcId
314
- """
315
- And I stub the following stack events:
316
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
317
- | 1 | 1 | myapp-web | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
318
- | 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
319
- And I stub the following stacks:
320
- | stack_id | stack_name | region | outputs |
321
- | 1 | myapp-vpc | us-east-1 | VpcId=vpc-xxxxxx |
322
- When I run `stack_master apply us-east-1 myapp-web --trace`
323
- And the output should contain all of these lines:
324
- | Stack diff: |
325
- | + "TestSg": { |
326
- | Parameters diff: |
327
- | VpcId: vpc-xxxxxx |
328
- And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/
329
- Then the exit status should be 0
330
-
331
- Scenario: Create a stack with a notification ARN and a stack update policy
332
- Given a file named "stack_master.yml" with:
333
- """
334
- stacks:
335
- us_east_1:
336
- myapp_vpc:
337
- template: myapp_vpc.rb
338
- notification_arns:
339
- - test_arn
340
- stack_policy_file: no_rds_replacement.json
341
- """
342
- And a file named "policies/no_rds_replacement.json" with:
343
- """
344
- {}
345
- """
346
- And I stub the following stack events:
347
- | stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
348
- | 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
349
- | 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
350
- And I stub the following stacks:
351
- | stack_id | stack_name | parameters | region |
352
- | 1 | myapp-vpc | KeyName=my-key | us-east-1 |
353
- And I stub a template for the stack "myapp-vpc":
354
- """
355
- {
356
- "Description": "Test template",
357
- "AWSTemplateFormatVersion": "2010-09-09",
358
- "Parameters": {
359
- "KeyName": {
360
- "Description": "Key Name",
361
- "Type": "String"
362
- }
363
- },
364
- "Resources": {
365
- "TestSg": {
366
- "Type": "AWS::EC2::SecurityGroup",
367
- "Properties": {
368
- "GroupDescription": "Test SG",
369
- "VpcId": {
370
- "Ref": "VpcId"
371
- }
372
- }
373
- },
374
- "TestSg2": {
375
- "Type": "AWS::EC2::SecurityGroup",
376
- "Properties": {
377
- "GroupDescription": "Test SG 2",
378
- "VpcId": {
379
- "Ref": "VpcId"
380
- }
381
- }
382
- }
383
- }
384
- }
385
- """
386
- When I run `stack_master apply us-east-1 myapp-vpc --trace`
387
- Then the stack "myapp-vpc" should have a policy with the following:
388
- """
389
- {}
390
- """
391
- And the stack "myapp-vpc" should contain this notification ARN "test_arn"
392
- Then the exit status should be 0