-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add parameter_files and parameters configuration options to stack definition #338
Merged
stevehodgkiss
merged 18 commits into
master
from
add-parameter-files-and-parameters-options-to-stack-definition
Jun 15, 2020
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
02e2cb0
Make it possible to define parameters in the stack yml
stevehodgkiss 3c5df43
Allow parameter_files to be explicitly specified in stack definitions
stevehodgkiss d2bdefd
Fix an example due to change in behaviour with JSON.pretty_generate(s…
stevehodgkiss 258aa44
Don't mix parameter_files and parameter glob files, choose one or the…
stevehodgkiss fce1a1e
Add a changelog entry
stevehodgkiss d2d7e3f
Undo unnecessary spec change
stevehodgkiss bb770f6
Remove unused compiler= method
stevehodgkiss ae40962
Update CHANGELOG.md
stevehodgkiss f1380b3
Merge branch 'add-parameter-files-and-parameters-options-to-stack-def…
stevehodgkiss 17c92ad
Update changelog
stevehodgkiss 00d541f
Update readme
stevehodgkiss 1c45dc5
Update spec
stevehodgkiss 31ab0c3
Update error message for missing params when using parameter_files
stevehodgkiss 263730e
Use Then
stevehodgkiss 44c4c6e
Update spec - move param to file
stevehodgkiss 029a088
Simplify File.expand_path
stevehodgkiss 4d27c42
Bump version to 2.7.0
stevehodgkiss bb4918b
Update changelog for 2.7.0 release
stevehodgkiss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
Feature: Apply command with explicit parameter files | ||
|
||
Background: | ||
Given a file named "stack_master.yml" with: | ||
""" | ||
stack_defaults: | ||
tags: | ||
Application: myapp | ||
stacks: | ||
us-east-1: | ||
myapp-web: | ||
template: myapp.rb | ||
parameter_files: | ||
- myapp-web-parameters.yml | ||
""" | ||
And a file named "parameters/us-east-1/myapp-web.yml" with: | ||
""" | ||
Color: blue | ||
""" | ||
And a file named "parameters/myapp-web-parameters.yml" with: | ||
""" | ||
KeyName: my-key | ||
Color: red | ||
""" | ||
And a directory named "templates" | ||
And a file named "templates/myapp.rb" with: | ||
""" | ||
SparkleFormation.new(:myapp) do | ||
description "Test template" | ||
|
||
parameters.key_name do | ||
description 'Key name' | ||
type 'String' | ||
end | ||
|
||
parameters.color do | ||
description 'Color' | ||
type 'String' | ||
end | ||
|
||
resources.instance do | ||
type 'AWS::EC2::Instance' | ||
properties do | ||
image_id 'ami-0080e4c5bc078760e' | ||
instance_type 't2.micro' | ||
end | ||
end | ||
end | ||
""" | ||
|
||
Scenario: Run apply and create stack with explicit parameter files | ||
Given I stub the following stack events: | ||
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp | | ||
| 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 | | ||
When I run `stack_master apply us-east-1 myapp-web --trace` | ||
Then the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/ | ||
And the output should contain all of these lines: | ||
| Stack diff: | | ||
| + "Instance": { | | ||
| Parameters diff: | | ||
| KeyName: my-key | | ||
| Proposed change set: | | ||
And the output should not contain "Color: blue" | ||
And the output should contain "Color: red" | ||
And the exit status should be 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Feature: Apply command with stack definition parameters | ||
|
||
Background: | ||
Given a file named "stack_master.yml" with: | ||
""" | ||
stacks: | ||
us-east-1: | ||
myapp_web: | ||
template: myapp.rb | ||
parameters: | ||
KeyName: my-key | ||
""" | ||
And a directory named "templates" | ||
And a file named "templates/myapp.rb" with: | ||
""" | ||
SparkleFormation.new(:myapp) do | ||
description "Test template" | ||
|
||
parameters.key_name do | ||
description 'Key name' | ||
type 'String' | ||
end | ||
|
||
resources.instance do | ||
type 'AWS::EC2::Instance' | ||
properties do | ||
image_id 'ami-0080e4c5bc078760e' | ||
instance_type 't2.micro' | ||
end | ||
end | ||
end | ||
""" | ||
|
||
Scenario: Run apply with parameters contained in | ||
Given I stub the following stack events: | ||
| stack_id | event_id | stack_name | logical_resource_id | resource_status | resource_type | timestamp | | ||
| 1 | 1 | myapp-web | myapp-web | CREATE_COMPLETE | AWS::CloudFormation::Stack | 2020-10-29 00:00:00 | | ||
When I run `stack_master apply us-east-1 myapp-web --trace` | ||
Then the output should match /2020-10-29 00:00:00 (\+|\-)[0-9]{4} myapp-web AWS::CloudFormation::Stack CREATE_COMPLETE/ | ||
And the output should contain all of these lines: | ||
| Stack diff: | | ||
| + "Instance": { | | ||
| Parameters diff: | | ||
| KeyName: my-key | | ||
| Proposed change set: | | ||
And the exit status should be 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what this test achieves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It checks the contents match by comparing parsed hashes rather than strings. For some reason apply_with_s3.feature started failing, and master and has the same issue - https://travis-ci.org/github/envato/stack_master/jobs/692383878#L2514 Maybe it's related to a sparkleformation upgrade?