-
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_table changing on every terraform apply #2467
Comments
I'm not sure AWS supports updating a GSI projection type: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_GlobalSecondaryIndexUpdate.html So its certainly seems like a bug that the provider is not deleting and recreating the index in this case. |
Hi @chgangaraju! Sorry for this confusing behavior. Based on the diff output here, it seems like Terraform's "refresh" step is not finding the secondary index when it reads the table back from the API. However, it is strange that this appears only to happen for that single table. Do you see this error when the table is created from scratch with the index already applied, or does it appear only if the index is added to the table subsequently via an update? That would help to determine whether the bug is in the If you're able to produce this with the simple configuration file you shared in the issue here, it'd be helpful if you could share the result of applying this configuration with the environment variable |
Sorry, I could not replicate the exact scenario now. Maybe i am getting newer version of aws provider. I haven't noted You can close this issue. I will reopen/create a new issue with the specified(more detailed) information, if i could reproduce this issue. |
+1 having the same issue with aws provider version v1.3.1 as well as v1.9.0. |
@llKetanll can you open a new issue following the issue template with the latest version of the AWS provider (1.9.0 as of this writing)? We've been working on this recently and it would certainly help us know if we missed a use case, with full details. Thanks! |
I have seen a similar issue with v1.10.0, however the details are slightly different: I have found that if "non_key_attributes" in a secondary index is not sorted into lexical order in the .tf file then the secondary index is torn down and recreated every run. |
@jamesba can you open a new issue following the issue template so we can have the details? That sounds like it should be fairly trivial to fix. |
I am also experiencing the same behaviour as described in the issue and the sort order of non_key_attributes in the .tf file is already correct. Using Terraform 0.11.7 and AWS provider version 1.17.0. |
Scratch that. The order is important, it's just that it's not necessarily lexical order. See #3807. |
I am still seeing this issue with terraform 0.11.11 and aws provider 1.59. I'm trying to import state of an existing table and run the plan against it. As explained in the above comments, I do not have any non-key attributes in the GSI as the projection type is ALL. |
nvm, I made a silly mistake (case sensitivity on a letter) |
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! |
Terraform Version
Terraform v0.11.0
Affected Resource(s)
Terraform Configuration Files
Output
Expected Behavior
It should not treat this as a change on every run.
Actual Behavior
Its treating this as a change and creating on every run.
Steps to reproduce/ More details
Table 1: hash_key, range_key, global_secondary_index with projection_type = "KEYS_ONLY" - Working
Table 2: hash_key, range_key, global_secondary_index with projection_type = "ALL" - Not working
Table 3: hash_key, global_secondary_index with projection_type = "KEYS_ONLY" - Working
Table 4: hash_key, global_secondary_index with projection_type = "ALL" - Working
The text was updated successfully, but these errors were encountered: