From 8718767c5bf9fce33ea80e6c7d3bb136c79dbf7d Mon Sep 17 00:00:00 2001 From: Hogan Bobertz Date: Mon, 23 Dec 2024 11:43:53 -0500 Subject: [PATCH] chore(spec2cdk): add tsdoc comment to describe the existance of a hardcoded list of resources in spec2cdk (#32616) ### Reason for this change Discovered this hardcoded list of resource types and did some investigation into the reasoning behind this very large hardcoded list of resources in tagging.ts. Discovered this list is non-updating list is proper and represents a perpetual state of truth for these resource. Legacy resource types often refers to resources added prior to the introduction of the Cloudformation Registry, so I added this comment to explain the purpose of this list so that future engineers will not need to perform the same investigation. ### Description of changes added a tsdoc comment ### Description of how you validated changes Just a comment ### Checklist - [ ] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- tools/@aws-cdk/spec2cdk/lib/cdk/tagging.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tools/@aws-cdk/spec2cdk/lib/cdk/tagging.ts b/tools/@aws-cdk/spec2cdk/lib/cdk/tagging.ts index 95eefba54596b..26d3eb2eb4537 100644 --- a/tools/@aws-cdk/spec2cdk/lib/cdk/tagging.ts +++ b/tools/@aws-cdk/spec2cdk/lib/cdk/tagging.ts @@ -32,6 +32,18 @@ export function resourceTaggabilityStyle(resource: Resource): TaggabilityStyle | return undefined; } +/** + * Mapping of legacy taggable resources to their tag property name and variant + * + * Before the introduction of iTaggablev2 the CDK defined a `tags` property on constructs + * which contained the tagManager, however in cases where the resource itself contained a + * property named 'tags', the CDK would create a `tagsRaw` property to represent that CFN tags property. + * + * Upon the introduction of iTaggablev2, the CDK now uses the `cdkTagManager` property to manage tags. + * This mapping of legacy resources is used to preserve the legacy behavior of applying tags so customers + * who previously were tagging these constructs using `myConstruct.tags.setTag('key', 'value')` will + * continue to be able to do so, without breaking changes. + */ const LEGACY_TAGGABLES: Record = { 'AWS::ACMPCA::CertificateAuthority': ['Tags', 'standard'], 'AWS::AccessAnalyzer::Analyzer': ['Tags', 'standard'],