stack_master 1.5.0 → 1.6.0
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/README.md +3 -0
- data/lib/stack_master/commands/terminal_helper.rb +14 -1
- data/lib/stack_master/parameter_resolvers/secret.rb +7 -2
- data/lib/stack_master/version.rb +1 -1
- metadata +21 -216
- data/.gitignore +0 -18
- data/.rspec +0 -2
- data/.travis.yml +0 -12
- data/CODE_OF_CONDUCT.md +0 -73
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/Rakefile +0 -27
- data/apply_demo.gif +0 -0
- data/example/simple/Gemfile +0 -3
- data/example/simple/parameters/myapp_vpc.yml +0 -1
- data/example/simple/parameters/myapp_web.yml +0 -2
- data/example/simple/stack_master.yml +0 -13
- data/example/simple/templates/myapp_vpc.rb +0 -39
- data/example/simple/templates/myapp_web.rb +0 -16
- data/features/apply.feature +0 -392
- data/features/apply_with_compile_time_parameters.feature +0 -93
- data/features/apply_with_env_parameters.feature +0 -49
- data/features/apply_with_parameter_store_parameters.feature +0 -47
- data/features/apply_with_s3.feature +0 -106
- data/features/delete.feature +0 -29
- data/features/diff.feature +0 -179
- data/features/events.feature +0 -33
- data/features/init.feature +0 -6
- data/features/outputs.feature +0 -45
- data/features/region_aliases.feature +0 -62
- data/features/resources.feature +0 -42
- data/features/stack_defaults.feature +0 -82
- data/features/status.feature +0 -118
- data/features/step_definitions/parameter_store_steps.rb +0 -14
- data/features/step_definitions/stack_steps.rb +0 -71
- data/features/support/env.rb +0 -16
- data/features/validate.feature +0 -46
- data/logo.png +0 -0
- data/script/buildkite/bundle.sh +0 -5
- data/script/buildkite/clean.sh +0 -3
- data/script/buildkite_rspec.sh +0 -27
- data/spec/fixtures/parameters/myapp_vpc.yml +0 -1
- data/spec/fixtures/parameters/myapp_vpc_with_secrets.yml +0 -3
- data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/my_sparkle_pack.rb +0 -1
- data/spec/fixtures/sparkle_pack_integration/my_sparkle_pack/lib/sparkleformation/dynamics/my_dynamic.rb +0 -5
- data/spec/fixtures/sparkle_pack_integration/templates/dynamics/local_dynamic.rb +0 -5
- data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic.rb +0 -3
- data/spec/fixtures/sparkle_pack_integration/templates/template_with_dynamic_from_pack.rb +0 -3
- data/spec/fixtures/stack_master.yml +0 -49
- data/spec/fixtures/templates/json/valid_myapp_vpc.json +0 -53
- data/spec/fixtures/templates/myapp_vpc.json +0 -1
- data/spec/fixtures/templates/rb/cfndsl/sample.json +0 -28
- data/spec/fixtures/templates/rb/cfndsl/sample.rb +0 -16
- data/spec/fixtures/templates/yml/valid_myapp_vpc.yml +0 -35
- data/spec/fixtures/test/.gitkeep +0 -0
- data/spec/spec_helper.rb +0 -102
- data/spec/stack_master/aws_driver/s3_spec.rb +0 -130
- data/spec/stack_master/change_set_spec.rb +0 -70
- data/spec/stack_master/command_spec.rb +0 -66
- data/spec/stack_master/commands/apply_spec.rb +0 -259
- data/spec/stack_master/commands/delete_spec.rb +0 -40
- data/spec/stack_master/commands/init_spec.rb +0 -17
- data/spec/stack_master/commands/status_spec.rb +0 -44
- data/spec/stack_master/commands/validate_spec.rb +0 -27
- data/spec/stack_master/config_spec.rb +0 -153
- data/spec/stack_master/paged_response_accumulator_spec.rb +0 -39
- data/spec/stack_master/parameter_loader_spec.rb +0 -110
- data/spec/stack_master/parameter_resolver_spec.rb +0 -148
- data/spec/stack_master/parameter_resolvers/ami_finder_spec.rb +0 -68
- data/spec/stack_master/parameter_resolvers/env_spec.rb +0 -35
- data/spec/stack_master/parameter_resolvers/latest_ami_by_tags_spec.rb +0 -33
- data/spec/stack_master/parameter_resolvers/latest_ami_spec.rb +0 -46
- data/spec/stack_master/parameter_resolvers/parameter_store_spec.rb +0 -50
- data/spec/stack_master/parameter_resolvers/secret_spec.rb +0 -66
- data/spec/stack_master/parameter_resolvers/security_group_spec.rb +0 -19
- data/spec/stack_master/parameter_resolvers/security_groups_spec.rb +0 -32
- data/spec/stack_master/parameter_resolvers/sns_topic_name_spec.rb +0 -43
- data/spec/stack_master/parameter_resolvers/stack_output_spec.rb +0 -127
- data/spec/stack_master/prompter_spec.rb +0 -23
- data/spec/stack_master/resolver_array_spec.rb +0 -42
- data/spec/stack_master/security_group_finder_spec.rb +0 -49
- data/spec/stack_master/sns_topic_finder_spec.rb +0 -25
- data/spec/stack_master/sparkle_formation/compile_time/allowed_pattern_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/allowed_values_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/definitions_validator_spec.rb +0 -36
- data/spec/stack_master/sparkle_formation/compile_time/empty_validator_spec.rb +0 -47
- data/spec/stack_master/sparkle_formation/compile_time/max_length_validator_spec.rb +0 -37
- data/spec/stack_master/sparkle_formation/compile_time/max_size_validator_spec.rb +0 -27
- data/spec/stack_master/sparkle_formation/compile_time/min_length_validator_spec.rb +0 -36
- data/spec/stack_master/sparkle_formation/compile_time/min_size_validator_spec.rb +0 -28
- data/spec/stack_master/sparkle_formation/compile_time/number_validator_spec.rb +0 -41
- data/spec/stack_master/sparkle_formation/compile_time/parameters_validator_spec.rb +0 -65
- data/spec/stack_master/sparkle_formation/compile_time/state_builder_spec.rb +0 -28
- data/spec/stack_master/sparkle_formation/compile_time/string_validator_spec.rb +0 -35
- data/spec/stack_master/sparkle_formation/compile_time/value_build_spec.rb +0 -52
- data/spec/stack_master/sparkle_formation/compile_time/value_validator_factory_spec.rb +0 -40
- data/spec/stack_master/sparkle_formation/template_file_spec.rb +0 -147
- data/spec/stack_master/stack_definition_spec.rb +0 -70
- data/spec/stack_master/stack_differ_spec.rb +0 -46
- data/spec/stack_master/stack_events/fetcher_spec.rb +0 -40
- data/spec/stack_master/stack_events/presenter_spec.rb +0 -18
- data/spec/stack_master/stack_events/streamer_spec.rb +0 -47
- data/spec/stack_master/stack_spec.rb +0 -184
- data/spec/stack_master/template_compiler_spec.rb +0 -39
- data/spec/stack_master/template_compilers/cfndsl_spec.rb +0 -22
- data/spec/stack_master/template_compilers/json_spec.rb +0 -32
- data/spec/stack_master/template_compilers/sparkle_formation_spec.rb +0 -116
- data/spec/stack_master/template_compilers/yaml_spec.rb +0 -20
- data/spec/stack_master/template_utils_spec.rb +0 -21
- data/spec/stack_master/test_driver/cloud_formation_spec.rb +0 -64
- data/spec/stack_master/test_driver/s3_spec.rb +0 -17
- data/spec/stack_master/utils_spec.rb +0 -30
- data/spec/stack_master/validator_spec.rb +0 -56
- data/spec/stack_master_spec.rb +0 -81
- data/spec/support/gemfiles/Gemfile.activesupport-4.0.0 +0 -5
- data/spec/support/validator_spec.rb +0 -23
- data/stack_master.gemspec +0 -46
- data/stacktemplates/parameter_region.yml +0 -3
- data/stacktemplates/parameter_stack_name.yml +0 -3
- data/stacktemplates/stack.json.erb +0 -20
- data/stacktemplates/stack_master.yml.erb +0 -6
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
Feature: Apply command with compile time parameters
|
|
2
|
-
|
|
3
|
-
Background:
|
|
4
|
-
Given a file named "stack_master.yml" with:
|
|
5
|
-
"""
|
|
6
|
-
stacks:
|
|
7
|
-
us-east-1:
|
|
8
|
-
vpc:
|
|
9
|
-
template: vpc.rb
|
|
10
|
-
"""
|
|
11
|
-
And a directory named "parameters"
|
|
12
|
-
And a file named "parameters/vpc.yml" with:
|
|
13
|
-
"""
|
|
14
|
-
vpc_cidr: 10.200.2.0/23
|
|
15
|
-
compile_time_parameters:
|
|
16
|
-
private_subnet_cidrs:
|
|
17
|
-
- 10.0.0.0/32:ap-southeast-2
|
|
18
|
-
- 10.0.0.2/32:ap-southeast-1
|
|
19
|
-
"""
|
|
20
|
-
And a directory named "templates"
|
|
21
|
-
And a file named "templates/vpc.rb" with:
|
|
22
|
-
"""
|
|
23
|
-
SparkleFormation.new(
|
|
24
|
-
:vpc,
|
|
25
|
-
{
|
|
26
|
-
compile_time_parameters: {
|
|
27
|
-
private_subnet_cidrs: {
|
|
28
|
-
type: :string,
|
|
29
|
-
multiple: true
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
) do
|
|
34
|
-
|
|
35
|
-
parameters.vpc_cidr do
|
|
36
|
-
type 'String'
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
resources.vpc do
|
|
40
|
-
type 'AWS::EC2::VPC'
|
|
41
|
-
properties do
|
|
42
|
-
cidr_block ref!(:vpc_cidr)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
state!(:private_subnet_cidrs).each_with_index do |item, index|
|
|
47
|
-
private_subnet = item.split(':')
|
|
48
|
-
private_cidr = private_subnet[0]
|
|
49
|
-
private_az = private_subnet[1]
|
|
50
|
-
resources.set!("subnet_private_#{index}".to_sym) do
|
|
51
|
-
type 'AWS::EC2::Subnet'
|
|
52
|
-
properties do
|
|
53
|
-
vpc_id ref!(:vpc)
|
|
54
|
-
availability_zone private_az
|
|
55
|
-
cidr_block private_cidr
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
|
|
60
|
-
end
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
Scenario: Run apply and create a new stack
|
|
64
|
-
Given I stub the following stack events:
|
|
65
|
-
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
|
|
66
|
-
| 1 | 1 | vpc | SubnetPrivate1 | CREATE_COMPLETE | AWS::EC2::Subnet | 2020-10-29 00:00:00 |
|
|
67
|
-
| 1 | 1 | vpc | SubnetPrivate0 | CREATE_COMPLETE | AWS::EC2::Subnet | 2020-10-29 00:00:00 |
|
|
68
|
-
| 1 | 1 | vpc | Vpc | CREATE_COMPLETE | AWS::EC2::VPC | 2020-10-29 00:00:00 |
|
|
69
|
-
| 1 | 1 | vpc | vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
|
|
70
|
-
When I run `stack_master apply us-east-1 vpc --trace`
|
|
71
|
-
And the output should contain all of these lines:
|
|
72
|
-
| + "SubnetPrivate0": { |
|
|
73
|
-
| + "Type": "AWS::EC2::Subnet", |
|
|
74
|
-
| + "Properties": { |
|
|
75
|
-
| + "VpcId": { |
|
|
76
|
-
| + "Ref": "Vpc" |
|
|
77
|
-
| + }, |
|
|
78
|
-
| + "AvailabilityZone": "ap-southeast-2", |
|
|
79
|
-
| + "CidrBlock": "10.0.0.0/32" |
|
|
80
|
-
| + } |
|
|
81
|
-
| + }, |
|
|
82
|
-
| + "SubnetPrivate1": { |
|
|
83
|
-
| + "Type": "AWS::EC2::Subnet", |
|
|
84
|
-
| + "Properties": { |
|
|
85
|
-
| + "VpcId": { |
|
|
86
|
-
| + "Ref": "Vpc" |
|
|
87
|
-
| + }, |
|
|
88
|
-
| + "AvailabilityZone": "ap-southeast-1", |
|
|
89
|
-
| + "CidrBlock": "10.0.0.2/32" |
|
|
90
|
-
| + } |
|
|
91
|
-
| + } |
|
|
92
|
-
And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
|
|
93
|
-
Then the exit status should be 0
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
Feature: Apply command with environment parameter
|
|
2
|
-
|
|
3
|
-
Background:
|
|
4
|
-
Given a file named "stack_master.yml" with:
|
|
5
|
-
"""
|
|
6
|
-
stacks:
|
|
7
|
-
us-east-2:
|
|
8
|
-
vpc:
|
|
9
|
-
template: vpc.rb
|
|
10
|
-
"""
|
|
11
|
-
And a directory named "parameters"
|
|
12
|
-
And a file named "parameters/vpc.yml" with:
|
|
13
|
-
"""
|
|
14
|
-
vpc_cidr:
|
|
15
|
-
env: VPC_CIDR
|
|
16
|
-
"""
|
|
17
|
-
And a directory named "templates"
|
|
18
|
-
And a file named "templates/vpc.rb" with:
|
|
19
|
-
"""
|
|
20
|
-
SparkleFormation.new(:vpc) do
|
|
21
|
-
|
|
22
|
-
parameters.vpc_cidr do
|
|
23
|
-
type 'String'
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
resources.vpc do
|
|
27
|
-
type 'AWS::EC2::VPC'
|
|
28
|
-
properties do
|
|
29
|
-
cidr_block ref!(:vpc_cidr)
|
|
30
|
-
end
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
end
|
|
34
|
-
"""
|
|
35
|
-
|
|
36
|
-
Scenario: Run apply and create a new stack
|
|
37
|
-
Given I stub the following stack events:
|
|
38
|
-
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
|
|
39
|
-
| 1 | 1 | vpc | Vpc | CREATE_COMPLETE | AWS::EC2::VPC | 2020-10-29 00:00:00 |
|
|
40
|
-
| 1 | 1 | vpc | vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
|
|
41
|
-
And I set the environment variables to:
|
|
42
|
-
| variable | value |
|
|
43
|
-
| VPC_CIDR | 10.0.0.0/16 |
|
|
44
|
-
When I run `stack_master apply us-east-2 vpc --trace`
|
|
45
|
-
And the output should contain all of these lines:
|
|
46
|
-
| +--- |
|
|
47
|
-
| +VpcCidr: 10.0.0.0/16 |
|
|
48
|
-
And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
|
|
49
|
-
Then the exit status should be 0
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
Feature: Apply command with parameter_store parameter
|
|
2
|
-
|
|
3
|
-
Background:
|
|
4
|
-
Given a file named "stack_master.yml" with:
|
|
5
|
-
"""
|
|
6
|
-
stacks:
|
|
7
|
-
us-east-2:
|
|
8
|
-
vpc:
|
|
9
|
-
template: vpc.rb
|
|
10
|
-
"""
|
|
11
|
-
And a directory named "parameters"
|
|
12
|
-
And a file named "parameters/vpc.yml" with:
|
|
13
|
-
"""
|
|
14
|
-
vpc_cidr:
|
|
15
|
-
parameter_store: "/cucumber-test-vpc-cidr"
|
|
16
|
-
"""
|
|
17
|
-
And a SSM parameter named "/cucumber-test-vpc-cidr" with value "10.0.0.0/16" in region "us-east-2"
|
|
18
|
-
And a directory named "templates"
|
|
19
|
-
And a file named "templates/vpc.rb" with:
|
|
20
|
-
"""
|
|
21
|
-
SparkleFormation.new(:vpc) do
|
|
22
|
-
|
|
23
|
-
parameters.vpc_cidr do
|
|
24
|
-
type 'String'
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
resources.vpc do
|
|
28
|
-
type 'AWS::EC2::VPC'
|
|
29
|
-
properties do
|
|
30
|
-
cidr_block ref!(:vpc_cidr)
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
Scenario: Run apply and create a new stack
|
|
38
|
-
Given I stub the following stack events:
|
|
39
|
-
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
|
|
40
|
-
| 1 | 1 | vpc | Vpc | CREATE_COMPLETE | AWS::EC2::VPC | 2020-10-29 00:00:00 |
|
|
41
|
-
| 1 | 1 | vpc | vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
|
|
42
|
-
When I run `stack_master apply us-east-2 vpc --trace`
|
|
43
|
-
And the output should contain all of these lines:
|
|
44
|
-
| +--- |
|
|
45
|
-
| +VpcCidr: 10.0.0.0/16 |
|
|
46
|
-
And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
|
|
47
|
-
Then the exit status should be 0
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
Feature: Apply command
|
|
2
|
-
|
|
3
|
-
Background:
|
|
4
|
-
Given a file named "stack_master.yml" with:
|
|
5
|
-
"""
|
|
6
|
-
stack_defaults:
|
|
7
|
-
s3:
|
|
8
|
-
bucket: my-bucket
|
|
9
|
-
region: us-east-1
|
|
10
|
-
prefix: cfn_templates/my-app
|
|
11
|
-
stacks:
|
|
12
|
-
us_east_1:
|
|
13
|
-
myapp_vpc:
|
|
14
|
-
template: myapp_vpc.rb
|
|
15
|
-
files:
|
|
16
|
-
- user_data.sh
|
|
17
|
-
"""
|
|
18
|
-
And a directory named "parameters"
|
|
19
|
-
And a file named "parameters/myapp_vpc.yml" with:
|
|
20
|
-
"""
|
|
21
|
-
KeyName: my-key
|
|
22
|
-
"""
|
|
23
|
-
And a file named "parameters/myapp_web.yml" with:
|
|
24
|
-
"""
|
|
25
|
-
VpcId: vpc-blah
|
|
26
|
-
"""
|
|
27
|
-
And a directory named "templates"
|
|
28
|
-
And a file named "files/user_data.sh" with:
|
|
29
|
-
"""
|
|
30
|
-
#!/bin/bash
|
|
31
|
-
echo "HI"
|
|
32
|
-
"""
|
|
33
|
-
And a file named "templates/myapp_vpc.rb" with:
|
|
34
|
-
"""
|
|
35
|
-
SparkleFormation.new(:myapp_vpc) do
|
|
36
|
-
description "Test template"
|
|
37
|
-
set!('AWSTemplateFormatVersion', '2010-09-09')
|
|
38
|
-
|
|
39
|
-
parameters.key_name do
|
|
40
|
-
description 'Key name'
|
|
41
|
-
type 'String'
|
|
42
|
-
end
|
|
43
|
-
|
|
44
|
-
resources.vpc do
|
|
45
|
-
type 'AWS::EC2::VPC'
|
|
46
|
-
properties do
|
|
47
|
-
cidr_block '10.200.0.0/16'
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
outputs do
|
|
52
|
-
vpc_id do
|
|
53
|
-
description 'A VPC ID'
|
|
54
|
-
value ref!(:vpc)
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
"""
|
|
59
|
-
|
|
60
|
-
Scenario: Run apply and create a new stack
|
|
61
|
-
Given I stub the following stack events:
|
|
62
|
-
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
|
|
63
|
-
| 1 | 1 | myapp-vpc | TestSg | CREATE_COMPLETE | AWS::EC2::SecurityGroup | 2020-10-29 00:00:00 |
|
|
64
|
-
| 1 | 1 | myapp-vpc | myapp-vpc | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
|
|
65
|
-
When I run `stack_master apply us-east-1 myapp-vpc --trace`
|
|
66
|
-
And the output should contain all of these lines:
|
|
67
|
-
| Stack diff: |
|
|
68
|
-
| + "Vpc": { |
|
|
69
|
-
| Parameters diff: |
|
|
70
|
-
| KeyName: my-key |
|
|
71
|
-
And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack CREATE_COMPLETE/
|
|
72
|
-
And an S3 file in bucket "my-bucket" with key "cfn_templates/my-app/myapp_vpc.json" exists with content:
|
|
73
|
-
"""
|
|
74
|
-
{
|
|
75
|
-
"Description": "Test template",
|
|
76
|
-
"AWSTemplateFormatVersion": "2010-09-09",
|
|
77
|
-
"Parameters": {
|
|
78
|
-
"KeyName": {
|
|
79
|
-
"Description": "Key name",
|
|
80
|
-
"Type": "String"
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"Resources": {
|
|
84
|
-
"Vpc": {
|
|
85
|
-
"Type": "AWS::EC2::VPC",
|
|
86
|
-
"Properties": {
|
|
87
|
-
"CidrBlock": "10.200.0.0/16"
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"Outputs": {
|
|
92
|
-
"VpcId": {
|
|
93
|
-
"Description": "A VPC ID",
|
|
94
|
-
"Value": {
|
|
95
|
-
"Ref": "Vpc"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
"""
|
|
101
|
-
And an S3 file in bucket "my-bucket" with key "cfn_templates/my-app/user_data.sh" exists with content:
|
|
102
|
-
"""
|
|
103
|
-
#!/bin/bash
|
|
104
|
-
echo "HI"
|
|
105
|
-
"""
|
|
106
|
-
Then the exit status should be 0
|
data/features/delete.feature
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
Feature: Delete command
|
|
2
|
-
|
|
3
|
-
Scenario: Run a delete command on a stack that exists
|
|
4
|
-
Given I stub the following stacks:
|
|
5
|
-
| stack_id | stack_name | parameters | region |
|
|
6
|
-
| 1 | myapp-vpc | KeyName=my-key | us-east-1 |
|
|
7
|
-
And I stub the following stack events:
|
|
8
|
-
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp |
|
|
9
|
-
| 1 | 1 | myapp-vpc | myapp-vpc | DELETE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 |
|
|
10
|
-
When I run `stack_master delete us-east-1 myapp-vpc --trace`
|
|
11
|
-
And the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-vpc AWS::CloudFormation::Stack DELETE_COMPLETE/
|
|
12
|
-
Then the exit status should be 0
|
|
13
|
-
|
|
14
|
-
Scenario: Run a delete command on a stack that does not exists
|
|
15
|
-
When I run `stack_master delete us-east-1 myapp-vpc --trace`
|
|
16
|
-
And the output should contain all of these lines:
|
|
17
|
-
| Stack does not exist |
|
|
18
|
-
Then the exit status should be 0
|
|
19
|
-
|
|
20
|
-
Scenario: Answer no when asked to delete stack
|
|
21
|
-
Given I will answer prompts with "n"
|
|
22
|
-
And I stub the following stacks:
|
|
23
|
-
| stack_id | stack_name | parameters | region |
|
|
24
|
-
| 1 | myapp-vpc | KeyName=my-key | us-east-1 |
|
|
25
|
-
When I run `stack_master delete us-east-1 myapp-vpc --trace`
|
|
26
|
-
And the output should contain all of these lines:
|
|
27
|
-
| Stack update aborted |
|
|
28
|
-
Then the exit status should be 0
|
|
29
|
-
|
data/features/diff.feature
DELETED
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
Feature: Diff 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.json
|
|
10
|
-
"""
|
|
11
|
-
And a directory named "parameters"
|
|
12
|
-
And a file named "parameters/myapp_vpc.yml" with:
|
|
13
|
-
"""
|
|
14
|
-
KeyName: my-key
|
|
15
|
-
"""
|
|
16
|
-
And a directory named "templates"
|
|
17
|
-
And a file named "templates/myapp_vpc.json" with:
|
|
18
|
-
"""
|
|
19
|
-
{
|
|
20
|
-
"Description": "Test template",
|
|
21
|
-
"AWSTemplateFormatVersion": "2010-09-09",
|
|
22
|
-
"Parameters": {
|
|
23
|
-
"KeyName": {
|
|
24
|
-
"Description": "Key Name",
|
|
25
|
-
"Type": "String"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"Resources": {
|
|
29
|
-
"TestSg": {
|
|
30
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
31
|
-
"Properties": {
|
|
32
|
-
"GroupDescription": "Test SG",
|
|
33
|
-
"VpcId": {
|
|
34
|
-
"Ref": "VpcId"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"TestSg2": {
|
|
39
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
40
|
-
"Properties": {
|
|
41
|
-
"GroupDescription": "Test SG 2",
|
|
42
|
-
"VpcId": {
|
|
43
|
-
"Ref": "VpcId"
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
Scenario: Run diff on a stack with no changes
|
|
52
|
-
Given I stub the following stacks:
|
|
53
|
-
| stack_id | stack_name | parameters | region |
|
|
54
|
-
| 1 | myapp-vpc | KeyName=changed-key | us-east-1 |
|
|
55
|
-
And I stub a template for the stack "myapp-vpc":
|
|
56
|
-
"""
|
|
57
|
-
{
|
|
58
|
-
"Description": "Test template",
|
|
59
|
-
"AWSTemplateFormatVersion": "2010-09-09",
|
|
60
|
-
"Parameters": {
|
|
61
|
-
"KeyName": {
|
|
62
|
-
"Description": "Key Name",
|
|
63
|
-
"Type": "String"
|
|
64
|
-
}
|
|
65
|
-
},
|
|
66
|
-
"Resources": {
|
|
67
|
-
"TestSg": {
|
|
68
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
69
|
-
"Properties": {
|
|
70
|
-
"GroupDescription": "Test SG",
|
|
71
|
-
"VpcId": {
|
|
72
|
-
"Ref": "VpcId"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"TestSg2": {
|
|
77
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
78
|
-
"Properties": {
|
|
79
|
-
"GroupDescription": "Test SG 2",
|
|
80
|
-
"VpcId": {
|
|
81
|
-
"Ref": "VpcId"
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
"""
|
|
88
|
-
When I run `stack_master diff us-east-1 myapp-vpc --trace`
|
|
89
|
-
And the output should contain all of these lines:
|
|
90
|
-
| -KeyName: changed |
|
|
91
|
-
| +KeyName: my-key |
|
|
92
|
-
Then the exit status should be 0
|
|
93
|
-
|
|
94
|
-
Scenario: Run diff on a stack with parameter changes
|
|
95
|
-
Given I stub the following stacks:
|
|
96
|
-
| stack_id | stack_name | parameters | region |
|
|
97
|
-
| 1 | myapp-vpc | KeyName=my-key | us-east-1 |
|
|
98
|
-
And I stub a template for the stack "myapp-vpc":
|
|
99
|
-
"""
|
|
100
|
-
{
|
|
101
|
-
"Description": "Test template",
|
|
102
|
-
"AWSTemplateFormatVersion": "2010-09-09",
|
|
103
|
-
"Parameters": {
|
|
104
|
-
"KeyName": {
|
|
105
|
-
"Description": "Key Name",
|
|
106
|
-
"Type": "String"
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"Resources": {
|
|
110
|
-
"TestSg": {
|
|
111
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
112
|
-
"Properties": {
|
|
113
|
-
"GroupDescription": "Test SG",
|
|
114
|
-
"VpcId": {
|
|
115
|
-
"Ref": "VpcId"
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
"TestSg2": {
|
|
120
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
121
|
-
"Properties": {
|
|
122
|
-
"GroupDescription": "Test SG 2",
|
|
123
|
-
"VpcId": {
|
|
124
|
-
"Ref": "VpcId"
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
"""
|
|
131
|
-
When I run `stack_master diff us-east-1 myapp-vpc --trace`
|
|
132
|
-
And the output should contain all of these lines:
|
|
133
|
-
| Stack diff: No changes |
|
|
134
|
-
| Parameters diff: No changes |
|
|
135
|
-
Then the exit status should be 0
|
|
136
|
-
|
|
137
|
-
Scenario: Run diff on a stack with template changes
|
|
138
|
-
Given I stub the following stacks:
|
|
139
|
-
| stack_id | stack_name | parameters | region |
|
|
140
|
-
| 1 | myapp-vpc | KeyName=my-key | us-east-1 |
|
|
141
|
-
And I stub a template for the stack "myapp-vpc":
|
|
142
|
-
"""
|
|
143
|
-
{
|
|
144
|
-
"Description": "Test template",
|
|
145
|
-
"AWSTemplateFormatVersion": "2010-09-09",
|
|
146
|
-
"Parameters": {
|
|
147
|
-
"KeyName": {
|
|
148
|
-
"Description": "Key Name",
|
|
149
|
-
"Type": "String"
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
"Resources": {
|
|
153
|
-
"TestSg": {
|
|
154
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
155
|
-
"Properties": {
|
|
156
|
-
"GroupDescription": "Test SG",
|
|
157
|
-
"VpcId": {
|
|
158
|
-
"Ref": "VpcId"
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
"TestSg2": {
|
|
163
|
-
"Type": "AWS::EC2::SecurityGroup",
|
|
164
|
-
"Properties": {
|
|
165
|
-
"GroupDescription": "Changed description",
|
|
166
|
-
"VpcId": {
|
|
167
|
-
"Ref": "VpcId"
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
"""
|
|
174
|
-
When I run `stack_master diff us-east-1 myapp-vpc --trace`
|
|
175
|
-
And the output should contain all of these lines:
|
|
176
|
-
| - "GroupDescription": "Changed description" |
|
|
177
|
-
| + "GroupDescription": "Test SG 2", |
|
|
178
|
-
Then the exit status should be 0
|
|
179
|
-
|