Skip to content

(core/stack): stack.tags does not do anything #30055

@kaiz-io

Description

@kaiz-io

Describe the bug

Possible regression. Creating this for a customer and they had this working. Waiting on them to give me the cdk version where this was working.

stack.tags does not do anything. I spot checked 2.1.0, 2.50.0, 2.100.0 cdk version and I cannot see where it worked.

Expected Behavior

When specifing stack.tags it will go out and tag the constructs that support tagging.

Current Behavior

stack.tags seemingly does nothing.

Reproduction Steps

#!/usr/bin/env node
import 'source-map-support/register';
import { Construct } from 'constructs';
import * as cdk from 'aws-cdk-lib';
import { Bucket } from 'aws-cdk-lib/aws-s3';

const app = new cdk.App();
class TagsStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    new Bucket(this, "bucket");

    cdk.Tags.of(this).add('tester','value'); //This works adding the tester tag to the s3 bucket

  }
}
new TagsStack(app, 'TagsStack', {
  tags: {
    'test': 'value' // This does not add the any tags to the s3 bucket.
  }
});

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.140.0

Framework Version

No response

Node.js Version

v18.17.1

OS

Ubuntu 22.04 - Linux

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-s3Related to Amazon S3bugThis issue is a bug.documentationThis is a problem with documentation.p3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions