Resource: aws_dynamodb_table_replica

Provides a DynamoDB table replica resource for DynamoDB Global Tables V2 (version 2019.11.21).

Example Usage

Basic Example

provider "aws" {
  alias  = "main"
  region = "us-west-2"
}

provider "aws" {
  alias  = "alt"
  region = "us-east-2"
}

resource "aws_dynamodb_table" "example" {
  provider         = aws.main
  name             = "TestTable"
  hash_key         = "BrodoBaggins"
  billing_mode     = "PAY_PER_REQUEST"
  stream_enabled   = true
  stream_view_type = "NEW_AND_OLD_IMAGES"

  attribute {
    name = "BrodoBaggins"
    type = "S"
  }

  lifecycle {
    ignore_changes = [replica]
  }
}

resource "aws_dynamodb_table_replica" "example" {
  provider         = aws.alt
  global_table_arn = aws_dynamodb_table.example.arn

  tags = {
    Name = "IZPAWS"
    Pozo = "Amargo"
  }
}

Argument Reference

Required arguments:

Optional arguments:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Timeouts

Configuration options:

Import

In Terraform v1.5.0 and later, use an import block to import DynamoDB table replicas using the table-name:main-region. For example:

import {
  to = aws_dynamodb_table_replica.example
  id = "TestTable:us-west-2"
}

Using terraform import, import DynamoDB table replicas using the table-name:main-region. For example:

% terraform import aws_dynamodb_table_replica.example TestTable:us-west-2