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

Terraform plan is not showing change to DynamoDB pitr value #15124

Closed
jbigtani opened this issue Sep 11, 2020 · 7 comments
Closed

Terraform plan is not showing change to DynamoDB pitr value #15124

jbigtani opened this issue Sep 11, 2020 · 7 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

@jbigtani
Copy link
Contributor

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 v0.12.29

  • provider.aws v3.4.0

Affected Resource(s)

  • aws_dynamodb_table

Terraform Configuration Files

Step 1: Create Table with point_in_time_recovery enabled.
resource "aws_dynamodb_table" "jb-example" {
  name             = "jb-example"
  hash_key         = "TestTableHashKey"
  billing_mode     = "PAY_PER_REQUEST"
  attribute {
    name = "TestTableHashKey"
    type = "S"
  }
 
   point_in_time_recovery {
        enabled = true
    }
}

Step 2: Update Table with point_in_time_recovery disabled by removing the point_in_time_recovery block .
resource "aws_dynamodb_table" "jb-example" {
  name             = "jb-example"
  hash_key         = "TestTableHashKey"
  billing_mode     = "PAY_PER_REQUEST"
  attribute {
    name = "TestTableHashKey"
    type = "S"
  } 
}

Expected Behavior

After running step 2 to disable point_in_time_recovery, plan should have shown below differences
~ point_in_time_recovery {
~ enabled = true -> false
}

Actual Behavior

No changes. Infrastructure is up-to-date.

Steps to Reproduce

  1. terraform apply to create a dynamodb table with pitr = true
  2. terraform apply or terraform apply after removing pitr block. It does not disable pitr.

Workaround

Instead of removing pitr block if you just turn the flag value to false, it works.

point_in_time_recovery {
        enabled = false
    }
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 11, 2020
@anGie44 anGie44 added bug Addresses a defect in current functionality. service/dynamodb Issues and PRs that pertain to the dynamodb service. and removed needs-triage Waiting for first response or review from a maintainer. labels Sep 14, 2020
@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Related: #14476, #14889, #12334

@anGie44
Copy link
Contributor

anGie44 commented Sep 14, 2020

Hi @jbigtani, thank you for creating this issue. I'm able to reproduce this behavior and there does seem some related issues in the provider regarding changes to nearby attributes. This looks related to the implementation of a CustomizeDiff in the resource and will require further investigation to account for cases where the configuration block is removed; in the meantime, the workaround you provided is a good alternative to ensure differences are shown as expected.

@jbigtani
Copy link
Contributor Author

#12334 is for changes in LSI
#14776 is for changes in GSI
#15124 is for changes in PITR (this one)

@anGie44
Copy link
Contributor

anGie44 commented Sep 15, 2020

Ahh "related" in the sense of the behavior, thanks for catching that @jbigtani 😅 , such that Terraform does not show changes at plan time, not necessarily the attribute in question

@github-actions
Copy link

github-actions bot commented Sep 5, 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 Sep 5, 2022
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 5, 2022
@github-actions
Copy link

github-actions bot commented Nov 5, 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 Nov 5, 2022
@YakDriver YakDriver reopened this Nov 10, 2022
@YakDriver
Copy link
Member

The crux of @jbigtani's question is, "Why isn't TF giving a diff when I remove the point_in_time_recovery argument?"

This issue can be closed because the behavior jbigtani noticed is as expected. The point_in_time_recovery argument does not have a default value and is computed and optional. This means, for example, when creating a new table, if you do not include point_in_time_recovery in the configuration, TF will do nothing -- not mention PITR to AWS at all. AWS will do whatever it does in the absence of PITR info (PITR is not enabled). Since there is no default and PITR is computed/optional, removing the argument from the configuration is sort of like coverting point_in_time_recovery to a read-only attribute. You're saying, "don't manage PITR but tell me about it." Since TF is not going to manage it, no diffs are generated.

The workaround mentioned is actually not a workaround but the correct way to change point_in_time_recovery:

point_in_time_recovery {
  enabled = false
}

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