Created
January 11, 2019 16:59
-
-
Save gene1wood/1ad3dedf60b1b394f92e6817b20a10d8 to your computer and use it in GitHub Desktop.
AWS CloudFormation template that checks if a mapping value is still set to the default/example value, and if so, forces stack creation to fail
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
AWSTemplateFormatVersion: 2010-09-09 | |
Description: Example ensuring mapping isn't set to it's default | |
Mappings: | |
Variables: | |
AnExampleKey: | |
# Make sure to set AnExampleVariable before launching this stack | |
AnExampleVariable: arn:aws:iam::123456789012:root | |
Conditions: | |
VariablesNotSet: !Equals [ !FindInMap [ Variables, AnExampleKey, AnExampleVariable ] , 'arn:aws:iam::123456789012:root' ] | |
Resources: | |
# If the Mapping variables haven't been set and are still the example values | |
# fail the creation of the stack by timing out this WaitCondition | |
VariablesAreNotConfiguredWaitConditionHandle: | |
Type: AWS::CloudFormation::WaitConditionHandle | |
Condition: VariablesNotSet | |
VariablesAreNotConfiguredWaitCondition: | |
Type: AWS::CloudFormation::WaitCondition | |
Condition: VariablesNotSet | |
Properties: | |
Handle: !Ref VariablesAreNotConfiguredWaitConditionHandle | |
Timeout: "1" | |
TestTopic: | |
Type: AWS::SNS::Topic | |
Properties: | |
DisplayName: A test sns topic | |
TopicName: TestSNSTopic |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment