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).
provider "aws" {
region = "us-west-2"
}
provider "aws" {
alias = "replica"
region = "us-east-1"
}
data "aws_region" "replica" {
provider = aws.replica
}
data "aws_region" "current" {}
resource "aws_dynamodb_table" "example" {
# ... other configuration ...
replica {
region_name = data.aws_region.replica.name
}
}
resource "aws_dynamodb_tag" "test" {
provider = aws.replica
resource_arn = replace(aws_dynamodb_table.example.arn, data.aws_region.current.name, data.aws_region.replica.name)
key = "testkey"
value = "testvalue"
}
This resource supports the following arguments:
resource_arn
- (Required) Amazon Resource Name (ARN) of the DynamoDB resource to tag.key
- (Required) Tag name.value
- (Required) Tag value.This resource exports the following attributes in addition to the arguments above:
id
- DynamoDB resource identifier and key, separated by a comma (,
)In Terraform v1.5.0 and later, use an import
block to import aws_dynamodb_tag
using the DynamoDB resource identifier and key, separated by a comma (,
). For example:
import {
to = aws_dynamodb_tag.example
id = "arn:aws:dynamodb:us-east-1:123456789012:table/example,Name"
}
Using terraform import
, import aws_dynamodb_tag
using the DynamoDB resource identifier and key, separated by a comma (,
). For example:
% terraform import aws_dynamodb_tag.example arn:aws:dynamodb:us-east-1:123456789012:table/example,Name