0

I'm experiencing a timeout in index creation using the following configuration on Terraform v0.13.6 and using AWS provider version 3.42.0:

resource "aws_dynamodb_table" "TestDB" {
  name             = "TestDB"
  billing_mode     = "PAY_PER_REQUEST"
  hash_key         = "..."
  range_key        = "..."

  attributes {...}
  global_secondary_index {...} 
  timeouts {
    create = "2h"
    delete = "2h"
    update = "2h"
  }

I get the following error when working with a large amount of items in the table:

Error: error waiting for DynamoDB Table (TestDB) Global Secondary Index (TestIndex) creation: timeout while waiting for state to become 'ACTIVE' (last state: 'CREATING', timeout: 20m0s)

The most relevant issue I could find was: https://github.com/hashicorp/terraform-provider-aws/issues/5471, which seems to resolve timeout issues when indices need to be updated by using the timeout specified in the aws_dynamodb_table.timeouts block . This is described in the documentation.

In my case, I believe I need the timeout for creating an index needs to be longer. And for reference, terraform is being run on CircleCI. I believe the 20 min timeout comes from terraform defaults: https://www.terraform.io/plugin/sdkv2/resources/retries-and-customizable-timeouts.

Is there a way to extend the timeout on GSI creation using terraform?

zhanga
  • 89
  • 2
  • 10
  • How much data in that table? ... If you have a lot of data I would just create the index manually and then merge the TF code to stay in sync. If not much data still attempt to create it manually quite often AWS gives you an error that terraform might be ignoring – Helder Sepulveda Dec 16 '21 at 15:00
  • At least 200GBs of data (I think). There isn't much of an issue in terms of actually creating the index since DynamoDB continues making the index even though the `terraform apply` times out. The problem is that it obstructs the remainder of the deployment downstream. – zhanga Dec 16 '21 at 16:07
  • Yep something that big could take a lot of time... just do it manually, once complete then merge the TF code, at least that's what I would do – Helder Sepulveda Dec 16 '21 at 16:38

0 Answers0