Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(xray): Invalid template synthesis for X-Ray resources when using Tags.of() #29388

Closed
GavinZZ opened this issue Mar 6, 2024 · 1 comment · Fixed by #29389
Closed

(xray): Invalid template synthesis for X-Ray resources when using Tags.of() #29388

GavinZZ opened this issue Mar 6, 2024 · 1 comment · Fixed by #29389
Labels
@aws-cdk/aws-xray bug This issue is a bug. effort/medium Medium work item – several days of effort p1

Comments

@GavinZZ
Copy link
Contributor

GavinZZ commented Mar 6, 2024

Describe the bug

When using Tags() methods for aws_xray .CfnGroup class and aws_xray .CfnSamplingRule , the tag's Key and Value values are not passcal-cased.

However, in 2.130.0, when using Tags() method behavior for CfnGroup class and CfnSamplingRule, the tag's are not added.

I find that Tags() methods changed in release 2.131.0 https://github.com/aws/aws-cdk/pull/28989/files

Expected Behavior

cdk synth should run successfully

Current Behavior

cdk synth fails due to

Tags:
        - key: Environment # expected is Key: Environment
          value: Prod # expected is Value: Prod

Reproduction Steps

import { Construct } from 'constructs';
import { aws_xray as xray } from 'aws-cdk-lib';

export class AppStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const xRay = new xray.CfnGroup(this, 'XRayGroup', {
      groupName: 'ECSSample',
      filterExpression: `ok`,
      insightsConfiguration: {
        insightsEnabled: false,
        notificationsEnabled: false,
      },
    });

    new xray.CfnSamplingRule(this, 'ApplicationRule', {
      samplingRule: {
        ruleName: 'app',
        resourceArn: '*',
        priority: 10,
        fixedRate: 0,
        reservoirSize: 10,
        serviceName: '*',
        serviceType: '*',
        host: '*',
        httpMethod: '*',
        urlPath: '*',
        version: 1,
      },
    });

    cdk.Tags.of(this).add("Environment", "Prod");
  }
}

Possible Solution

Use latest type instead of legacy type for this Tags property.

Additional Information/Context

No response

CDK CLI Version

2.131.0

Framework Version

No response

Node.js Version

18

OS

MacOs

Language

TypeScript

Language Version

No response

Other information

No response

@GavinZZ GavinZZ added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 6, 2024
@GavinZZ GavinZZ changed the title xray: Invalid template synthesis for X-Ray resources when using Tags.of() (xray): Invalid template synthesis for X-Ray resources when using Tags.of() Mar 6, 2024
@tim-finnigan tim-finnigan self-assigned this Mar 6, 2024
@tim-finnigan tim-finnigan added p1 effort/medium Medium work item – several days of effort and removed needs-triage This issue or PR still needs to be triaged. labels Mar 6, 2024
@tim-finnigan tim-finnigan removed their assignment Mar 6, 2024
@mergify mergify bot closed this as completed in #29389 Mar 7, 2024
mergify bot pushed a commit that referenced this issue Mar 7, 2024
### Issue # (if applicable)

Closes #29388

### Reason for this change

Some of the modern tags failed to run `cdk synth` due to type misconfiguration.

### Description of changes

Always default to use the latest type for modern tags.

### Description of how you validated changes

Fixed for failed resources.

### Checklist
- [x] 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*
Copy link

github-actions bot commented Mar 7, 2024

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-xray bug This issue is a bug. effort/medium Medium work item – several days of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants