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

r/dynamodb_table: fix crash when table is updated without GSI updates #39752

Merged
merged 3 commits into from
Oct 16, 2024

Conversation

johnsonaj
Copy link
Contributor

Description

Relations

Relates #37799
Closes #39747

References

Output from Acceptance Testing

Before

% make testacc TESTARGS='-run=TestAccDynamoDBTable_BillingMode_payPerRequestBasic' PKG=dynamodb

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/dynamodb/... -v -count 1 -parallel 20  -run=TestAccDynamoDBTable_BillingMode_payPerRequestBasic -timeout 360m
2024/10/16 09:01:53 Initializing Terraform AWS Provider...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x114f376cc]

After

% make testacc TESTARGS='-run=TestAccDynamoDBTable_' PKG=dynamodb

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/dynamodb/... -v -count 1 -parallel 20  -run=TestAccDynamoDBTable_ -timeout 360m
2024/10/16 10:32:29 Initializing Terraform AWS Provider...
--- PASS: TestAccDynamoDBTable_streamSpecificationValidation (4.34s)
--- PASS: TestAccDynamoDBTable_TTL_validate (12.33s)
--- PASS: TestAccDynamoDBTable_attributeUpdateValidation (12.36s)
--- PASS: TestAccDynamoDBTable_tableClassExplicitDefault (42.88s)
--- PASS: TestAccDynamoDBTable_tableClass_migrate (44.03s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnUpdate_Replace (71.02s)
--- PASS: TestAccDynamoDBTable_gsiOnDemandThroughput (74.98s)
--- PASS: TestAccDynamoDBTable_streamSpecification (75.92s)
--- PASS: TestAccDynamoDBTable_onDemandThroughput (77.87s)
--- PASS: TestAccDynamoDBTable_lsiUpdate (78.25s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_payPerRequestToProvisioned (73.01s)
--- PASS: TestAccDynamoDBTable_disappears (26.14s)
--- PASS: TestAccDynamoDBTable_tags (117.48s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisioned (47.29s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisionedIgnoreChanges (55.15s)
--- PASS: TestAccDynamoDBTable_encryption (128.24s)
--- PASS: TestAccDynamoDBTable_basic (25.97s)
--- PASS: TestAccDynamoDBTable_deletion_protection (33.12s)
--- PASS: TestAccDynamoDBTable_enablePITR (70.30s)
--- PASS: TestAccDynamoDBTable_streamSpecificationDiffs (149.92s)
--- PASS: TestAccDynamoDBTable_Disappears_payPerRequestWithGSI (86.52s)
--- PASS: TestAccDynamoDBTable_tableClass_ConcurrentModification (45.82s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnCreate (29.56s)
--- PASS: TestAccDynamoDBTable_tableClassInfrequentAccess (41.20s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nullNonOverlappingResourceTag (25.99s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnUpdate_Add (45.93s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nullOverlappingResourceTag (28.04s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_emptyProviderOnlyTag (23.97s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_emptyResourceTag (30.87s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_overlapping (77.45s)
--- PASS: TestAccDynamoDBTable_Replica_singleStreamSpecification (226.01s)
--- PASS: TestAccDynamoDBTable_Replica_singleDefaultKeyEncrypted (228.41s)
--- PASS: TestAccDynamoDBTable_GsiUpdateNonKeyAttributes_emptyPlan (38.27s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_updateToProviderOnly (44.65s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_updateToResourceOnly (37.22s)
--- PASS: TestAccDynamoDBTable_TTL_update (42.61s)
--- PASS: TestAccDynamoDBTable_lsiNonKeyAttributes (32.32s)
--- PASS: TestAccDynamoDBTable_TTL_disabled (31.39s)
--- PASS: TestAccDynamoDBTable_TTL_enabled (30.82s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnUpdate_Replace (43.33s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnUpdate_Add (63.32s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nonOverlapping (67.19s)
--- PASS: TestAccDynamoDBTable_gsiUpdateCapacity (58.07s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_providerOnly (84.66s)
--- PASS: TestAccDynamoDBTable_gsiUpdateNonKeyAttributes (109.07s)
--- PASS: TestAccDynamoDBTable_extended (262.20s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestBasic (340.34s)
--- PASS: TestAccDynamoDBTable_tags_AddOnUpdate (41.19s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnCreate (44.48s)
--- PASS: TestAccDynamoDBTable_Replica_tagsUpdate (410.62s)
--- PASS: TestAccDynamoDBTable_tags_EmptyMap (30.68s)
--- PASS: TestAccDynamoDBTable_tags_null (33.13s)
--- PASS: TestAccDynamoDBTable_Replica_single (486.06s)
--- PASS: TestAccDynamoDBTable_importTable (183.10s)
--- PASS: TestAccDynamoDBTable_Replica_singleCMK (295.98s)
--- PASS: TestAccDynamoDBTable_Replica_singleDefaultKeyEncryptedAmazonOwned (304.55s)
--- PASS: TestAccDynamoDBTable_Replica_multiple (649.81s)
--- PASS: TestAccDynamoDBTable_Replica_tagsTwoOfTwo (359.43s)
--- PASS: TestAccDynamoDBTable_Replica_tagsOneOfTwo (357.50s)
--- PASS: TestAccDynamoDBTable_Replica_pitrKMS (395.88s)
--- PASS: TestAccDynamoDBTable_Replica_pitr (315.15s)
--- PASS: TestAccDynamoDBTable_gsiUpdateOtherAttributes (434.69s)
--- PASS: TestAccDynamoDBTable_attributeUpdate (671.06s)
--- PASS: TestAccDynamoDBTable_restoreCrossRegion (839.65s)
--- PASS: TestAccDynamoDBTable_Replica_tagsNext (579.02s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequest (846.49s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequestIgnoreChanges (866.31s)
--- PASS: TestAccDynamoDBTable_backupEncryption (835.07s)
--- PASS: TestAccDynamoDBTable_backup_overrideEncryption (862.95s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_provisionedToPayPerRequest (1171.97s)
--- PASS: TestAccDynamoDBTable_Replica_doubleAddCMK (896.11s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb	1233.211s

@johnsonaj johnsonaj requested a review from a team as a code owner October 16, 2024 16:08
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/dynamodb Issues and PRs that pertain to the dynamodb service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Oct 16, 2024
@johnsonaj johnsonaj added the crash Results from or addresses a Terraform crash or kernel panic. label Oct 16, 2024
@gdavison gdavison self-assigned this Oct 16, 2024
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 🚀

--- PASS: TestAccDynamoDBTable_streamSpecificationValidation (5.60s)
--- PASS: TestAccDynamoDBTable_TTL_validate (13.03s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nullNonOverlappingResourceTag (54.02s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nullOverlappingResourceTag (54.25s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_emptyProviderOnlyTag (54.90s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnCreate (55.68s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_emptyResourceTag (57.24s)
--- PASS: TestAccDynamoDBTable_GsiUpdateNonKeyAttributes_emptyPlan (69.85s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_updateToProviderOnly (70.50s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_updateToResourceOnly (73.37s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnUpdate_Add (75.83s)
--- PASS: TestAccDynamoDBTable_tags_ComputedTag_OnUpdate_Replace (78.97s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnUpdate_Add (97.56s)
--- PASS: TestAccDynamoDBTable_lsiNonKeyAttributes (36.64s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_overlapping (108.13s)
--- PASS: TestAccDynamoDBTable_enablePITR (66.86s)
--- PASS: TestAccDynamoDBTable_gsiOnDemandThroughput (67.29s)
--- PASS: TestAccDynamoDBTable_onDemandThroughput (65.19s)
--- PASS: TestAccDynamoDBTable_streamSpecification (71.71s)
--- PASS: TestAccDynamoDBTable_tags (126.34s)
--- PASS: TestAccDynamoDBTable_attributeUpdateValidation (6.95s)
--- PASS: TestAccDynamoDBTable_extended (134.94s)
--- PASS: TestAccDynamoDBTable_lsiUpdate (61.75s)
--- PASS: TestAccDynamoDBTable_streamSpecificationDiffs (147.97s)
--- PASS: TestAccDynamoDBTable_tags_EmptyMap (37.05s)
--- PASS: TestAccDynamoDBTable_encryption (121.43s)
--- PASS: TestAccDynamoDBTable_tags_AddOnUpdate (57.30s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_nonOverlapping (78.75s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnCreate (48.48s)
--- PASS: TestAccDynamoDBTable_disappears (21.11s)
--- PASS: TestAccDynamoDBTable_tags_DefaultTags_providerOnly (103.21s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisionedIgnoreChanges (208.03s)
--- PASS: TestAccDynamoDBTable_tags_null (28.03s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisioned (218.51s)
--- PASS: TestAccDynamoDBTable_gsiUpdateCapacity (55.01s)
--- PASS: TestAccDynamoDBTable_Replica_singleDefaultKeyEncrypted (228.23s)
--- PASS: TestAccDynamoDBTable_tags_EmptyTag_OnUpdate_Replace (40.25s)
--- PASS: TestAccDynamoDBTable_TTL_disabled (28.17s)
--- PASS: TestAccDynamoDBTable_restoreCrossRegion (247.18s)
--- PASS: TestAccDynamoDBTable_TTL_update (32.51s)
--- PASS: TestAccDynamoDBTable_Disappears_payPerRequestWithGSI (77.27s)
--- PASS: TestAccDynamoDBTable_tableClass_migrate (37.17s)
--- PASS: TestAccDynamoDBTable_Replica_singleStreamSpecification (262.76s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_payPerRequestToProvisioned (215.88s)
--- PASS: TestAccDynamoDBTable_importTable (160.17s)
--- PASS: TestAccDynamoDBTable_tableClass_ConcurrentModification (46.60s)
--- PASS: TestAccDynamoDBTable_TTL_enabled (29.78s)
--- PASS: TestAccDynamoDBTable_tableClassExplicitDefault (26.23s)
--- PASS: TestAccDynamoDBTable_tableClassInfrequentAccess (44.72s)
--- PASS: TestAccDynamoDBTable_deletion_protection (30.77s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestBasic (345.30s)
--- PASS: TestAccDynamoDBTable_gsiUpdateNonKeyAttributes (385.30s)
--- PASS: TestAccDynamoDBTable_basic (22.10s)
--- PASS: TestAccDynamoDBTable_Replica_tagsOneOfTwo (266.90s)
--- PASS: TestAccDynamoDBTable_Replica_pitrKMS (333.85s)
--- PASS: TestAccDynamoDBTable_Replica_single (489.52s)
--- PASS: TestAccDynamoDBTable_Replica_tagsTwoOfTwo (317.62s)
--- PASS: TestAccDynamoDBTable_Replica_tagsUpdate (393.31s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequest (612.65s)
--- PASS: TestAccDynamoDBTable_Replica_singleDefaultKeyEncryptedAmazonOwned (230.44s)
--- PASS: TestAccDynamoDBTable_Replica_pitr (332.20s)
--- PASS: TestAccDynamoDBTable_Replica_singleCMK (250.07s)
--- PASS: TestAccDynamoDBTable_attributeUpdate (661.48s)
--- PASS: TestAccDynamoDBTable_gsiUpdateOtherAttributes (627.31s)
--- PASS: TestAccDynamoDBTable_Replica_tagsNext (578.05s)
--- PASS: TestAccDynamoDBTable_Replica_multiple (619.92s)
--- PASS: TestAccDynamoDBTable_backupEncryption (781.73s)
--- PASS: TestAccDynamoDBTable_backup_overrideEncryption (863.20s)
--- PASS: TestAccDynamoDBTable_Replica_doubleAddCMK (925.39s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequestIgnoreChanges (1071.67s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_provisionedToPayPerRequest (1260.60s)

Comment on lines -1784 to +1824
acctest.MatchResourceAttrRegionalARNRegion(resourceName, names.AttrARN, "dynamodb", acctest.Region(), regexache.MustCompile(`table/XXX`)),
acctest.MatchResourceAttrRegionalARNRegion(resourceNameRestore, names.AttrARN, "dynamodb", acctest.AlternateRegion(), regexache.MustCompile(`table/YYY`)),
acctest.MatchResourceAttrRegionalARNRegion(resourceName, names.AttrARN, "dynamodb", acctest.Region(), regexache.MustCompile(`table/.+$`)),
acctest.MatchResourceAttrRegionalARNRegion(resourceNameRestore, names.AttrARN, "dynamodb", acctest.AlternateRegion(), regexache.MustCompile(`table/.+$`)),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

@johnsonaj johnsonaj merged commit ecb8002 into main Oct 16, 2024
48 checks passed
@johnsonaj johnsonaj deleted the b-dynamodb_table_payperrequest_update branch October 16, 2024 17:07
@github-actions github-actions bot added this to the v5.73.0 milestone Oct 16, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Oct 16, 2024
@johnsonaj johnsonaj modified the milestones: v5.73.0, v5.72.1 Oct 16, 2024
Copy link

This functionality has been released in v5.72.1 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!

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash Results from or addresses a Terraform crash or kernel panic. service/dynamodb Issues and PRs that pertain to the dynamodb service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: The terraform-provider-aws_v5.72.0_x5 plugin crashed!
2 participants