Resource: awsDynamodbTableReplica
Provides a DynamoDB table replica resource for DynamoDB Global Tables V2 (version 2019.11.21).
\~> Note: Use lifecycle
ignoreChanges
for replica
in the associated aws_dynamodb_table configuration.
\~> Note: Do not use the replica
configuration block of aws_dynamodb_table together with this resource as the two configuration options are mutually exclusive.
Example Usage
Basic Example
/*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", {
alias: "main",
region: "us-west-2",
});
new aws.provider.AwsProvider(this, "aws_1", {
alias: "alt",
region: "us-east-2",
});
const awsDynamodbTableExample = new aws.dynamodbTable.DynamodbTable(
this,
"example",
{
attribute: [
{
name: "BrodoBaggins",
type: "S",
},
],
billingMode: "PAY_PER_REQUEST",
hashKey: "BrodoBaggins",
name: "TestTable",
provider: "aws.main",
streamEnabled: true,
streamViewType: "NEW_AND_OLD_IMAGES",
}
);
awsDynamodbTableExample.addOverride("lifecycle", [
{
ignore_changes: ["${replica}"],
},
]);
const awsDynamodbTableReplicaExample =
new aws.dynamodbTableReplica.DynamodbTableReplicaA(this, "example_3", {
globalTableArn: awsDynamodbTableExample.arn,
provider: "aws.alt",
tags: {
Name: "IZPAWS",
Pozo: "Amargo",
},
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDynamodbTableReplicaExample.overrideLogicalId("example");
Argument Reference
Required arguments:
globalTableArn
- (Required) ARN of the main or global table which this resource will replicate.
Optional arguments:
kmsKeyArn
- (Optional, Forces new resource) ARN of the CMK that should be used for the AWS KMS encryption. This argument should only be used if the key is different from the default KMS-managed DynamoDB key,alias/aws/dynamodb
. Note: This attribute will not be populated with the ARN of default keys.pointInTimeRecovery
- (Optional) Whether to enable Point In Time Recovery for the replica. Default isfalse
.tableClassOverride
- (Optional, Forces new resource) Storage class of the table replica. Valid values arestandard
andSTANDARD_INFREQUENT_ACCESS
. If not used, the table replica will use the same class as the global table.tags
- (Optional) Map of tags to populate on the created table. If configured with a providerdefaultTags
configuration block present, tags with matching keys will overwrite those defined at the provider-level.
Attributes Reference
In addition to all arguments above, the following attributes are exported:
arn
- ARN of the table replica.id
- Name of the table and region of the main global table joined with a semicolon (e.g.,tableName:usEast1
).tagsAll
- Map of tags assigned to the resource, including those inherited from the providerdefaultTags
configuration block.
Timeouts
create
- (Default30M
)update
- (Default30M
)delete
- (Default20M
)
Import
DynamoDB table replicas can be imported using the tableName:mainRegion
, e.g.,
\~> Note: When importing, use the region where the initial or main global table resides, not the region of the replica.