Skip to content

Global table requires autoscaling enabled and configured #109

@databasepanda

Description

@databasepanda

Description

Global table, or better replica can't be configured if not previously autoscaling was enabled and properly configured (settings for read/ write).
Trying both at once (enabling and configure autoscaling and enable a replica) will give the following error:

Error: updating AWS DynamoDB Table (my-table): updating replicas, while creating: creating replica (us-east-1): operation error DynamoDB: UpdateTable, https response error StatusCode: 400, RequestID: xxx, api error ValidationException: Table write capacity should either be Pay-Per-Request or AutoScaled.

Potentially, the replica resources in the module are missing a depends_on on the autoscaling resources.

Doing both in two separate MRs (first enabling autoscaling, then configuring a replica) works fine, but doesn't make the module for IaC imvho.

  • ✋ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]:

    5.2.0

  • Terraform version:

     > /opt/tofuenv/bin/tofu --version
     OpenTofu v1.10.6
     on linux_amd64
    
  • Provider version(s):

    hashicorp/aws v6.20.0

Reproduction Code [Required]

Steps to reproduce the behavior:

Configure both the autoscaling_* parameters and replica parameter in one change.

Expected behavior

First autoscaling is set up, followed by the replica setup.

Actual behavior

apply fails with error:

Error: updating AWS DynamoDB Table (my-table): updating replicas, while creating: creating replica (us-east-1): operation error DynamoDB: UpdateTable, https response error StatusCode: 400, RequestID: xxx, api error ValidationException: Table write capacity should either be Pay-Per-Request or AutoScaled.

Terminal Output Screenshot(s)

Extra output:

│   with module.my_table.aws_dynamodb_table.autoscaled[0],
│   on .terraform/modules/my_table/main.tf line 167, in resource "aws_dynamodb_table" "autoscaled":
│  167: resource "aws_dynamodb_table" "autoscaled" {

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions