-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Enhancement]: dynamodb: add arg to set deletion protection for table replica #35359
[Enhancement]: dynamodb: add arg to set deletion protection for table replica #35359
Conversation
Community NoteVoting for Prioritization
For Submitters
|
ad71379
to
e6c9a6f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @andrei-shulaev 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
Hey @DrFaust92, could you please take a peek? |
@ewbankkit @justinretzolk |
❤️ This would be great to have, and stop us from manually touching infrastructure! |
@ewbankkit @justinretzolk @DrFaust92 Hey it's been a while without a review, can i get your help on it please? |
a887fb1
to
e6c9a6f
Compare
Thank you for your contribution! 🚀 A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored. For additional information refer to the AWS SDK for Go Versions page in the contributor guide. |
e6c9a6f
to
b3bb3b6
Compare
b3bb3b6
to
250de7d
Compare
6d84a7a
to
cce05f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @andrei-shulaev, thanks a lot for taking the time to raise this pull request! 👏🏼
I've left a couple drive-by comments before one of the core maintainers takes a look at this PR. Added, please make sure to update the documentation of this resource and data source with the new argument.
cce05f7
to
6f250fb
Compare
…e_replica-add-deletion-protection
Hey @andrei-shulaev, Thank you for your initial work on supporting the I'm now running the tests, because they take some time I'll provide an update here once they're all ran successfully. Thanks again for your work! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀 (had to run tests separately because of some strange context behavior)
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_basic' -v
2024/11/28 14:44:32 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_basic
=== PAUSE TestAccDynamoDBTableReplica_basic
=== CONT TestAccDynamoDBTableReplica_basic
--- PASS: TestAccDynamoDBTableReplica_basic (231.72s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 237.215s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_disappears' -v
2024/11/28 14:53:21 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_disappears
=== PAUSE TestAccDynamoDBTableReplica_disappears
=== CONT TestAccDynamoDBTableReplica_disappears
--- PASS: TestAccDynamoDBTableReplica_disappears (221.18s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 226.806s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_pitrDefault' -v
2024/11/28 14:52:19 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_pitrDefault
=== PAUSE TestAccDynamoDBTableReplica_pitrDefault
=== CONT TestAccDynamoDBTableReplica_pitrDefault
--- PASS: TestAccDynamoDBTableReplica_pitrDefault (351.79s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 357.359s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_pitrKMS' -v
2024/11/28 14:53:29 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_pitrKMS
=== PAUSE TestAccDynamoDBTableReplica_pitrKMS
=== CONT TestAccDynamoDBTableReplica_pitrKMS
--- PASS: TestAccDynamoDBTableReplica_pitrKMS (281.57s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 287.001s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_pitrDefault' -v
2024/11/28 14:52:19 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_pitrDefault
=== PAUSE TestAccDynamoDBTableReplica_pitrDefault
=== CONT TestAccDynamoDBTableReplica_pitrDefault
--- PASS: TestAccDynamoDBTableReplica_pitrDefault (351.79s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 357.359s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_tableClass' -v
2024/11/28 15:00:08 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_tableClass
=== PAUSE TestAccDynamoDBTableReplica_tableClass
=== CONT TestAccDynamoDBTableReplica_tableClass
--- PASS: TestAccDynamoDBTableReplica_tableClass (518.27s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 527.870s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_keys' -v
2024/11/28 15:00:04 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_keys
=== PAUSE TestAccDynamoDBTableReplica_keys
=== CONT TestAccDynamoDBTableReplica_keys
--- PASS: TestAccDynamoDBTableReplica_keys (405.00s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 410.549s
$ go test ./internal/service/dynamodb/... -v -count 1 -parallel 4 -run='TestAccDynamoDBTableReplica_deletionProtection' -v
2024/11/28 15:00:12 Initializing Terraform AWS Provider...
=== RUN TestAccDynamoDBTableReplica_deletionProtection
=== PAUSE TestAccDynamoDBTableReplica_deletionProtection
=== RUN TestAccDynamoDBTableReplica_deletionProtectionDefault
=== PAUSE TestAccDynamoDBTableReplica_deletionProtectionDefault
=== CONT TestAccDynamoDBTableReplica_deletionProtection
=== CONT TestAccDynamoDBTableReplica_deletionProtectionDefault
--- PASS: TestAccDynamoDBTableReplica_deletionProtectionDefault (512.04s)
--- PASS: TestAccDynamoDBTableReplica_deletionProtection (512.90s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 525.348s
Since I’ve made some updates to the code in this PR, I’m requesting another review from the core team. Thanks for your patience!
This is handled outside the scope of the update handler via transparent tagging.
Changes the argument to optional/computed instead. Also consolidates acceptance tests for this argument into a single test which exercies the waiters in both the create and update methods. ```console % make testacc PKG=dynamodb TESTS=TestAccDynamoDBTableReplica_deletionProtection make: Verifying source code with gofmt... ==> Checking that code complies with gofmt requirements... TF_ACC=1 go1.23.3 test ./internal/service/dynamodb/... -v -count 1 -parallel 20 -run='TestAccDynamoDBTableReplica_deletionProtection' -timeout 360m 2024/12/02 15:33:27 Initializing Terraform AWS Provider... --- PASS: TestAccDynamoDBTableReplica_deletionProtection (698.63s) PASS ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 703.869s ```
Adding this argument prevents the need for a second variant which functions similarly but has a built-in delay to account for delayed propagation to the table replica.
…d` default While this value does default to `false` when returned from AWS, the provider does not explicitly set a default value, so this descriptor should be omitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
% make testacc PKG=dynamodb TESTS=TestAccDynamoDBTableReplica_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/dynamodb/... -v -count 1 -parallel 20 -run='TestAccDynamoDBTableReplica_' -timeout 360m
2024/12/03 11:14:52 Initializing Terraform AWS Provider...
--- PASS: TestAccDynamoDBTableReplica_pitr (260.06s)
=== CONT TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_emptyResourceTag (266.37s)
=== CONT TestAccDynamoDBTableReplica_basic
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnUpdate_Replace (267.96s)
=== CONT TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_updateToProviderOnly (270.02s)
=== CONT TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nullOverlappingResourceTag (272.81s)
=== CONT TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nullNonOverlappingResourceTag (273.78s)
=== CONT TestAccDynamoDBTableReplica_tags_EmptyMap
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_emptyProviderOnlyTag (275.60s)
=== CONT TestAccDynamoDBTableReplica_tags_AddOnUpdate
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_updateToResourceOnly (276.02s)
=== CONT TestAccDynamoDBTableReplica_tags_null
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnCreate (277.72s)
=== CONT TestAccDynamoDBTableReplica_tags_ComputedTag_OnCreate
--- PASS: TestAccDynamoDBTableReplica_disappears (290.68s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_overlapping (378.84s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_providerOnly (380.90s)
--- PASS: TestAccDynamoDBTableReplica_pitrKMS (383.09s)
--- PASS: TestAccDynamoDBTableReplica_pitrDefault (383.75s)
--- PASS: TestAccDynamoDBTableReplica_keys (394.85s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nonOverlapping (402.72s)
--- PASS: TestAccDynamoDBTableReplica_tags (404.44s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnUpdate_Add (412.77s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyMap (235.27s)
--- PASS: TestAccDynamoDBTableReplica_tags_null (234.32s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Add (242.74s)
--- PASS: TestAccDynamoDBTableReplica_tags_AddOnUpdate (237.38s)
--- PASS: TestAccDynamoDBTableReplica_tableClass (517.17s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnCreate (240.49s)
--- PASS: TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_DefaultTag (258.90s)
--- PASS: TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_ResourceTag (255.81s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Replace (253.21s)
--- PASS: TestAccDynamoDBTableReplica_basic (260.55s)
--- PASS: TestAccDynamoDBTableReplica_deletionProtection (760.28s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb 766.869s
Thanks for your contribution, @andrei-shulaev! 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🚀
--- PASS: TestAccDynamoDBTableReplica_disappears (211.09s)
--- PASS: TestAccDynamoDBTableReplica_pitr (246.23s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Replace (299.96s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nullOverlappingResourceTag (301.63s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_emptyProviderOnlyTag (309.08s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_updateToProviderOnly (317.87s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_updateToResourceOnly (321.74s)
--- PASS: TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_DefaultTag (322.95s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnUpdate_Add (323.12s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_emptyResourceTag (324.06s)
--- PASS: TestAccDynamoDBTableReplica_basic (326.05s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nullNonOverlappingResourceTag (332.96s)
--- PASS: TestAccDynamoDBTableReplica_pitrKMS (355.25s)
--- PASS: TestAccDynamoDBTableReplica_pitrDefault (381.77s)
--- PASS: TestAccDynamoDBTableReplica_keys (426.55s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_overlapping (429.84s)
--- PASS: TestAccDynamoDBTableReplica_tags_IgnoreTags_Overlap_ResourceTag (431.03s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_nonOverlapping (432.09s)
--- PASS: TestAccDynamoDBTableReplica_tags (435.69s)
--- PASS: TestAccDynamoDBTableReplica_tags_ComputedTag_OnCreate (236.15s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnUpdate_Add (251.82s)
--- PASS: TestAccDynamoDBTableReplica_tags_null (230.41s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnCreate (345.70s)
--- PASS: TestAccDynamoDBTableReplica_tags_DefaultTags_providerOnly (313.03s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyMap (240.15s)
--- PASS: TestAccDynamoDBTableReplica_tags_AddOnUpdate (243.73s)
--- PASS: TestAccDynamoDBTableReplica_tags_EmptyTag_OnUpdate_Replace (271.74s)
--- PASS: TestAccDynamoDBTableReplica_deletionProtection (781.69s)
--- PASS: TestAccDynamoDBTableReplica_tableClass (475.17s)
This functionality has been released in v5.80.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Description
Adds support to enable/disable deletion protection when creating/updating a dynamodb table replica.
Relations
Closes #30213
Output from Acceptance Testing