Skip to content

(dynamodb): Dynamo TableV2 does not work with Tags.of #30631

@ckuehne

Description

@ckuehne

Describe the bug

The aws_dynamodb.TableV2 construct does not support adding tags via Tags.of.

I.e., the following code does not create the myKey tag.

import * as cdk from 'aws-cdk-lib';
import {aws_dynamodb, Tags} from "aws-cdk-lib";

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');

const globalTable = new aws_dynamodb.TableV2(stack, 'GlobalTable', {
    partitionKey: {name: 'pk', type: aws_dynamodb.AttributeType.STRING},
});

Tags.of(globalTable).add('myKey', 'myValue');

Expected Behavior

Creates tag.

Current Behavior

Does not create tag.

Reproduction Steps

import * as cdk from 'aws-cdk-lib';
import {aws_dynamodb, Tags} from "aws-cdk-lib";

const app = new cdk.App();
const stack = new cdk.Stack(app, 'Stack');

const globalTable = new aws_dynamodb.TableV2(stack, 'GlobalTable', {
    partitionKey: {name: 'pk', type: aws_dynamodb.AttributeType.STRING},
});

Tags.of(globalTable).add('myKey', 'myValue');

cdk synth

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.147.0 (build 3338fc0)

Framework Version

No response

Node.js Version

v20.3.1

OS

Macos

Language

TypeScript

Language Version

TypeScript 5.4.5

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-dynamodbRelated to Amazon DynamoDBbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions