Skip to content

Resource: awsDynamodbTag

Manages an individual DynamoDB resource tag. This resource should only be used in cases where DynamoDB resources are created outside Terraform (e.g., Table replicas in other regions).

\~> NOTE: This tagging resource should not be combined with the Terraform resource for managing the parent resource. For example, using awsDynamodbTable and awsDynamodbTag to manage tags of the same DynamoDB Table in the same region will cause a perpetual difference where the awsDynamodbCluster resource will try to remove the tag being added by the awsDynamodbTag resource.

\~> NOTE: This tagging resource does not use the provider ignoreTags configuration.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.provider.AwsProvider(this, "aws", {
  region: "us-west-2",
});
new aws.provider.AwsProvider(this, "aws_1", {
  alias: "replica",
  region: "us-east-1",
});
const dataAwsRegionCurrent = new aws.dataAwsRegion.DataAwsRegion(
  this,
  "current",
  {}
);
const dataAwsRegionReplica = new aws.dataAwsRegion.DataAwsRegion(
  this,
  "replica",
  {
    provider: "aws.replica",
  }
);
new aws.dynamodbTable.DynamodbTable(this, "example", {
  replica: [
    {
      regionName: dataAwsRegionReplica.name,
    },
  ],
});
new aws.dynamodbTag.DynamodbTag(this, "test", {
  key: "testkey",
  provider: "aws.replica",
  resourceArn: `\${replace(aws_dynamodb_table.test.arn, ${dataAwsRegionCurrent.name}, ${dataAwsRegionReplica.name})}`,
  value: "testvalue",
});

Argument Reference

The following arguments are supported:

  • resourceArn - (Required) Amazon Resource Name (ARN) of the DynamoDB resource to tag.
  • key - (Required) Tag name.
  • value - (Required) Tag value.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - DynamoDB resource identifier and key, separated by a comma (,)

Import

awsDynamodbTag can be imported by using the DynamoDB resource identifier and key, separated by a comma (,), e.g.,

$ terraform import aws_dynamodb_tag.example arn:aws:dynamodb:us-east-1:123456789012:table/example,Name