Closed BerradaYassine closed 6 months ago
It's officially in the cloud formation release notes now as well
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/ReleaseHistory.html
Thanks @BerradaYassine for requesting this. Thanks @bdoyle0182 for sharing the link. I could see that cloudformation provides needed support for L1 construct for the 'tags' props. Contributions from community are welcome !
@khushail Looks like this will be fixed automatically next Monday., when the following version is deployed.
"@aws-cdk/aws-service-spec": "^0.0.63",
Wonderful, thanks for the quick turnaround
Great hint, @Konosh93 / @bdoyle0182 - Now, it becomes less magic ;) I ready see the PR https://github.com/aws/aws-cdk/pull/29798 for updating the L1 CloudFormation resource definitions, which also include:
├[~] service aws-cloudwatch
│ └ resources
│ ├[~] resource AWS::CloudWatch::Alarm
│ │ ├ - tagInformation: undefined
│ │ │ + tagInformation: {"tagPropertyName":"Tags","variant":"standard"}
│ │ └ properties
│ │ └[+] Tags: Array<tag>
Now, we just need to wait for the next CDK release, which cover/include this PR. :)
Closing this issue as the feature request for tags now exist in L1 Construct for Cloudwatch alarms.
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.
Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.
Describe the bug
https://github.com/aws/aws-cdk/issues/25489#issue-1701033601
Similarly to the closed issue above, I would like to add tags to Cloudwatch alarm through CDK. Recently AWS added support for cloud formation to add tags to Cloudwatch alarm
Expected Behavior
Tags can be added to the resource and verified on the AWS console.
Current Behavior
The tags don't attach to the resource.
Reproduction Steps
import as cdk from 'aws-cdk-lib'; import as sns from 'aws-cdk-lib/aws-sns'; import * as cloudwatch from 'aws-cdk-lib/aws-cloudwatch'; import { Construct } from 'constructs';
export class MyStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props); const topic = new sns.Topic(this, 'Topic', { displayName: 'My SNS topic', }); const _alarm = new cloudwatch.Alarm(this, 'Alarm', { metric: topic.metricNumberOfMessagesPublished(), threshold: 10, evaluationPeriods: 1, alarmName: 'My SNS alarm', alarmDescription: 'Triggered when message count exceeds 10', comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD, }); } } and then
import * as cdk from 'aws-cdk-lib';
const env = { account: process.env.AWS_ACCOUNT_ID, region: process.env.AWS_REGION, }; const app = new cdk.App(); new MyStack(app, 'stack', { env, tags: { testTag: 'testValue', }, }); cdk.Tags.of(app).add('testTag', 'testValue');
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.136.0
Framework Version
No response
Node.js Version
v16.18.1
OS
14.4.1
Language
TypeScript
Language Version
4.8.4
Other information
No response