Skip to content

Commit

Permalink
fix(spec2cdk): get tag gives null result in Java CDK (#29870)
Browse files Browse the repository at this point in the history
### Issue # (if applicable)

Closes #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*
  • Loading branch information
GavinZZ committed Apr 17, 2024
1 parent f4af330 commit 5a918d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/@aws-cdk/spec2cdk/lib/cdk/resource-decider.ts
Expand Up @@ -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(),
},
},
{
Expand Down

0 comments on commit 5a918d1

Please sign in to comment.