Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing a global secondary index attribute type fails to take effect DynamoDB #22852

Open
sambonator opened this issue Jan 31, 2022 · 1 comment
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service.

Comments

@sambonator
Copy link

Community Note

  • Please vote on this issue by adding a 馃憤 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v1.1.4
on windows_amd64

  • provider registry.terraform.io/hashicorp/aws v3.74.0

Affected Resource(s)

resource "aws_dynamodb_table"

Terraform Configuration Files

resource "aws_dynamodb_table" "test-dynamodb-table" {
  name           = "TestDynamo"
  billing_mode   = "PROVISIONED"
  read_capacity  = 3
  write_capacity = 1
  hash_key       = "ProgHash"
  #range_key      = "location"

  attribute {
    name = "ProgHash"
    type = "S"
  }
  attribute {
    name = "ProgName"
    type = "S"
  }
  attribute {
    name = "ProgVersion"
    type = "S"
  }
  global_secondary_index {
    name               = "ProgName"
    hash_key           = "ProgName"
    range_key          = "ProgVersion"
    read_capacity  = 3
    write_capacity = 1
    projection_type    = "ALL"
  }
}

Debug Output

terraform apply
aws_dynamodb_table.test-dynamodb-table: Refreshing state... [id=TestDynamo]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Panic Output

Expected Behavior

When the attribute of ProgVersion is changed from S to N, we expect the index to be revised from using String to Number.
e,g.:
attribute {
name = "ProgVersion"
type = "S"
}

Change the above to:
attribute {
name = "ProgVersion"
type = "N"
}

Actual Behavior

Terraform doesn't detect the updated attribute for the index. Responds with :
Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Steps to Reproduce

terraform init
terraform appy
Change attribute type of ProgVersion from S to N.
terraform appy
No change is made to the database, as terraform fails to detect the change.

Important Factoids

References

hashicorp/terraform#30446

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. service/dynamodb Issues and PRs that pertain to the dynamodb service. labels Jan 31, 2022
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Feb 1, 2022
@sambonator sambonator changed the title Changing a global secondary index attribute type fails to take effect Changing a global secondary index attribute type fails to take effect DynamoDB Feb 2, 2022
@asauta-byr
Copy link

Still the case with AWS provider 5+ as of Dec 2023.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service.
Projects
None yet
Development

No branches or pull requests

3 participants