-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 On-Demand doesn't work with GSIs #6736
Comments
I made a PR with the fix for resource creation, currently still pending update logic fix: #6737 |
Confirming the same issue |
@bflad I don't understand why this issue is not labelled as a bug and not prioritized accordingly. It essentially makes |
Same issue, and it should be a high prioritized defect. |
There is a workaround for this issue: #6632 (comment) |
The workaround does not appear to always work. Our integration tests spin up a new stack on each run and they always fail to create the table. We will be stuck with provisioned capacity for now (at least for our integration tests). |
@macbutch - yea, I use workaround around that workaround :) - first created table and indexes with provisioned capacity, then run again with changed it to on-demand and set the 0 as read/write capacity. Then terraform throw few errors, but it works and table and indexes are on-demand. |
This solution works for me, set read/write capacity to "0" in GIS when applied 'pay_per_request'. Thanks. |
Support for on-demand billing with global secondary indices has been merged and will release with version 1.52.0 of the AWS provider, likely later today. 👍 |
This has been released in version 1.52.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
Just hit this issue with version 1.52.0 of the AWS provider. Code: resource "aws_dynamodb_table" "foo" {
name = "foo"
billing_mode = "PAY_PER_REQUEST"
hash_key = "id"
"attribute" {
name = "id"
type = "S"
}
attribute {
name = "userName"
type = "S"
}
global_secondary_index {
name = "UserNameGlobalIndex"
hash_key = "userName"
projection_type = "ALL"
}
} Log output:
One wrinkle in our use case: our DynamoDB table was already created with |
Note that the workaround in #6632 (comment) (setting read and write capacity to 0 in GIS) solved it in our situation too. |
@brikis98 - have you tried to run it twice? Had similar problem, but it disappeared next time I run it. I suppose it was just because it was still PROVISIONED when these fields missing as changing to on-demand takes a while (still the Terraform should know what to do in such case) |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
Community Note
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
I expected to be able to create a DynamoDB table with the new PAY_PER_REQUEST billing option set, and use the table with GSIs.
Actual Behavior
I tried to not specify the read and write capacity units for my GSIs, but that led to the following error at the plan phase, since the schema marks the provisioned throughput arguments as required:
When I tried to specify a dummy value, it fails the call to the AWS DynamoDB API:
Steps to Reproduce
With no capacity specified in the GSI it fails at plan time.
With dummy capacity values specified it fails at apply time.
The text was updated successfully, but these errors were encountered: