From cc6e363b9d794a489b64fcfb0b3f32d7703d83dd Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Wed, 5 Aug 2020 11:42:47 +0300 Subject: [PATCH] fix(core): docs for CfnMapping are not clear 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 --- packages/@aws-cdk/core/README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/@aws-cdk/core/README.md b/packages/@aws-cdk/core/README.md index 65f9067ff32d4..d2a240166995c 100644 --- a/packages/@aws-cdk/core/README.md +++ b/packages/@aws-cdk/core/README.md @@ -746,7 +746,7 @@ CloudFormation [mappings][cfn-mappings] are created and queried using the `CfnMappings` class: ```ts -const mapping = new CfnMapping(this, 'MappingTable', { +const regionTable = new CfnMapping(this, 'RegionTable', { mapping: { regionName: { 'us-east-1': 'US East (N. Virginia)', @@ -757,7 +757,17 @@ const mapping = new CfnMapping(this, 'MappingTable', { } }); -mapping.findInMap('regionName', Aws.REGION); +regionTable.findInMap('regionName', Aws.REGION); +``` + +This will yield the following template: + +```yaml +Mappings: + RegionTable: + regionName: + us-east-1: US East (N. Virginia) + us-east-2: US East (Ohio) ``` [cfn-mappings]: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html