Skip to content

bug: DynamoDB GlobalTableDescription needs GlobalTableStatus for Terraform #6743

@coreypobrien

Description

@coreypobrien

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When using Terraform to create a global DynamoDB table, the Terraform AWS provider crashes because the Create/Update/Describe methods for DynamoDB tables do not include a GlobalTableStatus attribute.

It looks like the provider crashes here expecting the attribute to exist.

Stack trace from the terraform-provider-aws_v4.27.0_x5 plugin:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x108f0321c]

goroutine 368 [running]:
github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb.resourceGlobalTableStateRefreshFunc.func1()
	github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb/global_table.go:237 +0x1ac
github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext.func1()
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.21.0/helper/resource/state.go:110 +0x174
created by github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.(*StateChangeConf).WaitForStateContext
	github.com/hashicorp/terraform-plugin-sdk/v2@v2.21.0/helper/resource/state.go:83 +0x1a8

Error: The terraform-provider-aws_v4.27.0_x5 plugin crashed!

Expected Behavior

Localstack should be compatible with Terraform AWS provider and not cause a crash.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

Deploy this to localstack with terraform apply

resource "aws_dynamodb_table" "wisetack" {
  name = "localstack_test_table"
  billing_mode = "PAY_PER_REQUEST"
  hash_key = "hashKey"
  range_key = "rangeKey"
  attribute {
    name = "hashKey"
    type = "S"
  }
  attribute {
    name = "rangeKey"
    type = "S"
  }
}

resource "aws_dynamodb_global_table" "global-table-wisetack" {
  name = "localstack_test_table"
  replica {
    region_name = "us-east-1"
  }
}

terraform {
  required_providers {
    aws = {}
  }
}

provider "aws" {
  region  = "us-east-1"
  access_key = "access_key"
  secret_key = "secret_key"

  s3_use_path_style           = true
  skip_credentials_validation = true
  skip_metadata_api_check     = true
  skip_requesting_account_id  = true

  endpoints {
    dynamodb        = "http://localhost:4566"
  }
}

Environment

- OS: macOS 12.5.1
- LocalStack: latest

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions