From 5a918d12ec0455626b5630b35aa47e6d9da6df7c Mon Sep 17 00:00:00 2001 From: GZ Date: Wed, 17 Apr 2024 16:52:22 -0700 Subject: [PATCH] fix(spec2cdk): get tag gives null result in Java CDK (#29870) ### Issue # (if applicable) Closes https://github.com/aws/aws-cdk/issues/29869 ### Reason for this change Without it, it breaks java users who rely on tagging name to generate resource id. ### Description of changes Provide a default value using the initial `tagValue` users provide. ### Description of how you validated changes Existing tests all pass. Essentially changing it back to the original state. ### 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/resource-decider.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts b/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts index 7b981cacb8fd7..23906deef7805 100644 --- a/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts +++ b/tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts @@ -153,15 +153,15 @@ export class ResourceDecider { summary: 'Tag Manager which manages the tags for this resource', }, }, - initializer: (_: Expression) => + initializer: (props: Expression) => new CDK_CORE.TagManager( this.tagManagerVariant(variant), expr.lit(this.resource.cloudFormationType), - expr.UNDEFINED, + $E(props)[originalName], expr.object({ tagPropertyName: expr.lit(originalName) }), ), cfnValueToRender: { - [originalName]: $this.tags.renderTags($this[rawTagsPropName]), + [originalName]: $this.tags.renderTags(), }, }, {