-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cfn-include): allow dynamic mappings to be used in Fn::FindInMap (#…
…13428) The template parsing logic in cloudformation-include always searched for the Mapping in the template based on the first argument passed to Fn::FindInMap. However, that doesn't work if that first argument is a dynamic expression, like `{ Ref: Param }`. Check for that case explicitly, and don't search for the Mapping if the first argument to Fn::FindInMap is a dynamic expression. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
3 changed files
with
50 additions
and
4 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
...@aws-cdk/cloudformation-include/test/test-templates/find-in-map-with-dynamic-mapping.json
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,30 @@ | ||
{ | ||
"Parameters": { | ||
"Stage": { | ||
"Type": "String", | ||
"AllowedValues": ["beta"], | ||
"Default": "beta" | ||
} | ||
}, | ||
"Mappings": { | ||
"beta": { | ||
"region": { | ||
"key1": "name" | ||
} | ||
} | ||
}, | ||
"Resources": { | ||
"Bucket": { | ||
"Type": "AWS::S3::Bucket", | ||
"Properties": { | ||
"BucketName": { | ||
"Fn::FindInMap": [ | ||
{ "Ref": "Stage" }, | ||
"region", | ||
"key1" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} |
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