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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB Table with replica v2019.11.21 and PAY_PER_REQUEST makes GSI modifications in a loop #12872

Closed
Seldaek opened this issue Apr 17, 2020 · 5 comments
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.

Comments

@Seldaek
Copy link

Seldaek commented Apr 17, 2020

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 Version

Terraform v0.12.24

  • provider.aws v2.58.0
  • provider.template v2.1.2

Affected Resource(s)

  • aws_dynamodb_table

Terraform Configuration Files

resource "aws_dynamodb_table" "sessions_us-west-2" {
  name           = "sessions"
  billing_mode   = "PAY_PER_REQUEST"
  hash_key       = "SessionId"

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

  attribute {
    name = "UserId"
    type = "N"
  }

  attribute {
    name = "ExpiresAt"
    type = "N"
  }

  global_secondary_index {
    name               = "UserSessionsIndex"
    hash_key           = "UserId"
    range_key          = "ExpiresAt"
    projection_type    = "INCLUDE"
    non_key_attributes = ["UserId", "ExpiresAt", "SessionId"]
  }

  ttl {
    attribute_name = "ExpiresAt"
    enabled        = true
  }

  server_side_encryption {
    enabled = true
  }

  stream_enabled = true
  stream_view_type = "NEW_AND_OLD_IMAGES"

  replica {
    region_name = "eu-west-1"
  }
}

Expected Behavior

terraform apply should not do any changes

Actual Behavior

Every time I run, it wants to update the GSI with the same data..

      + global_secondary_index {
          + hash_key           = "UserId"
          + name               = "UserSessionsIndex"
          + non_key_attributes = [
              + "UserId",
              + "ExpiresAt",
              + "SessionId",
            ]
          + projection_type    = "INCLUDE"
          + range_key          = "ExpiresAt"
          + read_capacity      = 0
          + write_capacity     = 0
        }
      - global_secondary_index {
          - hash_key           = "UserId" -> null
          - name               = "UserSessionsIndex" -> null
          - non_key_attributes = [
              - "UserId",
              - "ExpiresAt",
              - "SessionId",
            ] -> null
          - projection_type    = "INCLUDE" -> null
          - range_key          = "ExpiresAt" -> null
          - read_capacity      = 0 -> null
          - write_capacity     = 0 -> null
        }

I tried specifying the read_capacity/write_capacity as that was the only missing thing I saw, which might be causing this, but it doesn't help, still does the same with this:

  global_secondary_index {
    name               = "UserSessionsIndex"
    hash_key           = "UserId"
    range_key          = "ExpiresAt"
    projection_type    = "INCLUDE"
    non_key_attributes = ["UserId", "ExpiresAt", "SessionId"]
    read_capacity      = 0
    write_capacity     = 0
  }

Note that it should not be required to specify these as we are using PAY_PER_REQUEST billing_mode.

Steps to Reproduce

  1. terraform apply, twice

References

@ghost ghost added the service/dynamodb Issues and PRs that pertain to the dynamodb service. label Apr 17, 2020
@cmonty
Copy link
Contributor

cmonty commented Apr 17, 2020

Thanks @Seldaek!

We had this come up in testing and I think is related to #3828

@Seldaek
Copy link
Author

Seldaek commented Apr 17, 2020

Ah thanks that one has a workaround in #3828 (comment) 👍

@maryelizbeth
Copy link
Contributor

Hi Y'all, we are currently tracking this issue alongside #671.

We've added #671 to our team's prioritization board and are planning to address it and its related PRs in a near-term release. As this issue is related, we'll keep an eye on this and check back to see if our solution to #671 fixes/closes this as well.

Thanks!

@maryelizbeth maryelizbeth added the bug Addresses a defect in current functionality. label Aug 17, 2020
@github-actions
Copy link

github-actions bot commented Aug 8, 2022

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

@github-actions github-actions bot added the stale Old or inactive issues managed by automation, if no further action taken these will get closed. label Aug 8, 2022
@github-actions github-actions bot closed this as completed Sep 7, 2022
@github-actions
Copy link

github-actions bot commented Oct 9, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. stale Old or inactive issues managed by automation, if no further action taken these will get closed.
Projects
None yet
Development

No branches or pull requests

3 participants