Skip to content

Commit c1e3c57

Browse files
author
Elad Ben-Israel
authored
fix(core): docs for CfnMapping are not clear (#9451)
Add the synthesized template output as an example to make sure it's clear that `CfnMapping` represents a single mapping entry and not the entire `Mappings` section in the template. Fixes #9432 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 692864c commit c1e3c57

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/@aws-cdk/core/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ CloudFormation [mappings][cfn-mappings] are created and queried using the
746746
`CfnMappings` class:
747747

748748
```ts
749-
const mapping = new CfnMapping(this, 'MappingTable', {
749+
const regionTable = new CfnMapping(this, 'RegionTable', {
750750
mapping: {
751751
regionName: {
752752
'us-east-1': 'US East (N. Virginia)',
@@ -757,7 +757,17 @@ const mapping = new CfnMapping(this, 'MappingTable', {
757757
}
758758
});
759759

760-
mapping.findInMap('regionName', Aws.REGION);
760+
regionTable.findInMap('regionName', Aws.REGION);
761+
```
762+
763+
This will yield the following template:
764+
765+
```yaml
766+
Mappings:
767+
RegionTable:
768+
regionName:
769+
us-east-1: US East (N. Virginia)
770+
us-east-2: US East (Ohio)
761771
```
762772
763773
[cfn-mappings]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html

0 commit comments

Comments
 (0)