aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

Tags not applied to `AWS::Events::Rule`

Open raphael-riel opened this issue 7 years ago • 42 comments

Tag not applied to AWS::Events::Rule Ressource.

Reproduction Steps

With following Stack:

import cdk = require('@aws-cdk/core');
import events = require("@aws-cdk/aws-events");

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

    const rule = new events.Rule(this, "ScheduleRule", {
      schedule: events.Schedule.rate(cdk.Duration.hours(12)),
      targets: []
    });

    cdk.Tag.add(rule, "MyTag", "ThatValue");
  }
}

Synthesized template is:

Resources:
  ScheduleRuleDA5BD877:
    Type: AWS::Events::Rule
    Properties:
      ScheduleExpression: rate(12 hours)
      State: ENABLED
    Metadata:
      aws:cdk:path: CdkIssueEventsRuleTagsStack/ScheduleRule/Resource
  CDKMetadata:
    Type: AWS::CDK::Metadata
    Properties:
      Modules: aws-cdk=1.15.0,@aws-cdk/aws-events=1.15.0,@aws-cdk/core=1.15.0,@aws-cdk/cx-api=1.15.0,jsii-runtime=node.js/v12.12.0
    Condition: CDKMetadataAvailable

[...]

In console, the Tags are available. image

Environment

Using CDK 1.15.0


This is :bug: Bug Report

raphael-riel avatar Nov 07 '19 18:11 raphael-riel

While writing the report, I've seen that it seems to be CloudFormation that doesn't support Tags for this kind of Ressource. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html

Should a Ressource that doesn't support Tags emit some sort of WARN or raises when we try to apply Tags to it?

raphael-riel avatar Nov 07 '19 18:11 raphael-riel

Because we assign tags recursively to all constructs in a scope it really doesn't make much sense to warn for constructs that don't support it. You would get a deluge of warnings if you apply tags at a high level.

We will have to wait for CloudFormation support.

rix0rrr avatar Nov 11 '19 08:11 rix0rrr

@rix0rrr I totally agree!

In my specific case, I explicitly attempt to add the Tag on the invalid Construct; it's in no way recursive. Could a quick-win be to somehow only check at the initial cdk.Tag.add() invocation?

Or could there be two add, one public for the explicit call, and one internal for recursive calls? This way the Constructs classes could get a proper ITaggeable type and benefit from compile-time checking ?

Cause in the end, there's always be some stuff not supported in CloudFormation, and reflecting those in my IDE while coding (IntelliSense) would greatly help! (The main reason I love so much working with the CDK!)

What do you think of the proposal/brainstorm above?

Thanks!

raphael-riel avatar Nov 11 '19 14:11 raphael-riel

Is this issue still not fixed?

yogeshdass avatar Feb 17 '21 15:02 yogeshdass

Any update on this

mickog avatar Mar 04 '21 20:03 mickog

Any updates on this?

piotrmoszkowicz avatar Mar 15 '21 19:03 piotrmoszkowicz

Any update?

MichalOsadowski avatar Mar 16 '21 05:03 MichalOsadowski

I believe this is the related issue in the CloudFormation roadmap.

DaWyz avatar Mar 20 '21 00:03 DaWyz

Any update on this? 🙂

rupertevill avatar Jun 15 '21 18:06 rupertevill

Any update or workaround 🙏 ?

tsaluszewski avatar Aug 02 '21 10:08 tsaluszewski

+1 Any updates?

nikitacr7 avatar Sep 02 '21 19:09 nikitacr7

Is this on the roadmap for cloudformation coverage?

coreylane avatar Sep 28 '21 06:09 coreylane

what a joke because of these kinds of issues we're actively working towards getting rid of cdk and replacing it (unresolved issues, after 2 years. Issues are generally expected, how you resolve them (or not at all) makes the difference)

cristianrat avatar Oct 19 '21 09:10 cristianrat

and to be productive, my work around is to use boto3 to tag (very quick and simple, if you are on the python flavour of cdk)

cristianrat avatar Oct 19 '21 09:10 cristianrat

any update?

argenstijn avatar Feb 07 '22 16:02 argenstijn

+1

craigsands avatar Apr 07 '22 18:04 craigsands

+1

eliasbedmar avatar Jun 01 '22 14:06 eliasbedmar

+1

tma-dathi avatar Jun 08 '22 03:06 tma-dathi

We increase priority based on reactions to the original post - not comments. Please don't clutter discussion with +1 comments

Additionally, there's nothing CDK can do about this as mentioned in the first reply. We have to wait for CloudFormation support in the linked issue. Please give a thumbs up and comment in that issue instead, and this will be automatically fixed in CDK once fixed in CloudFormation.

Thanks!

peterwoodworth avatar Jun 21 '22 00:06 peterwoodworth

Not a CDK user, but like @raphael-riel said this is an issue in CloudFormation as well. Is there a "matching" issue for this somewhere in CloudFormation as well?

OmriSama avatar Aug 30 '22 21:08 OmriSama