Last active
November 27, 2020 00:04
-
-
Save chrisj-au/f6ff85e7a6681464cf117821d0542c1c to your computer and use it in GitHub Desktop.
CloudFormation Sub into a string from Map
This file contains hidden or 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
# Used to provide map values to a long string, e.g. EnvironmentVariables to CodeBuild. | |
Parameters: | |
Environment: | |
Description: Environment to deploy | |
Type: String | |
Default: prod | |
AllowedValues: | |
- prod | |
- stage | |
Mappings: | |
Environments: | |
prod: | |
accountName: aws-prod | |
tfStateBucket: aws-prod1-terraform-tfstate | |
stage: | |
accountName: aws-stage | |
tfStateBucket: aws-stage-terraform-tfstate | |
Resources: | |
Blah: | |
Properties: | |
EnvironmentVariables: | |
!Sub | |
- | | |
[{"name":"TF_URL","value": "https://relea..."}, | |
{"name":"tf_statebucket", "value": "${LocalFindInMapBucket}"}, | |
- { LocalFindInMapBucket: !FindInMap [Environments, !Ref Environment, tfStateBucket] } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment