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

resource/aws_dynamodb_table: Fixes perpetual diff when ttl.attribute_name is set when not enabled #37991

Merged
merged 7 commits into from
Jun 17, 2024

Conversation

gdavison
Copy link
Contributor

Description

If ttl.attribute_name is set when not enabled, it would cause a perpetual diff. Adds validation to require attribute_name when enabled, and not allow it when not enabled.

Relations

Closes #10304

References

Output from Acceptance Testing

% make testacc PKG=dynamodb TESTS=TestAccDynamoDBTable

--- PASS: TestAccDynamoDBTable_streamSpecificationValidation (9.82s)
--- PASS: TestAccDynamoDBTable_attributeUpdateValidation (18.27s)
--- PASS: TestAccDynamoDBTableItem_disappears (26.63s)
--- PASS: TestAccDynamoDBTableItem_withDuplicateItemsSameRangeKey (37.70s)
--- PASS: TestAccDynamoDBTableItem_mapOutOfBandUpdate (42.48s)
--- PASS: TestAccDynamoDBTable_TTL_enabled (44.35s)
--- PASS: TestAccDynamoDBTable_TTL_validate (6.02s)
--- PASS: TestAccDynamoDBTableDataSource_basic (57.47s)
--- PASS: TestAccDynamoDBTableItem_updateWithRangeKey (39.22s)
--- PASS: TestAccDynamoDBTable_tags (62.24s)
--- PASS: TestAccDynamoDBTableItem_wonkyItems (26.04s)
--- PASS: TestAccDynamoDBTableItem_withDuplicateItemsDifferentRangeKey (24.68s)
--- PASS: TestAccDynamoDBTable_GsiUpdateNonKeyAttributes_emptyPlan (67.79s)
--- PASS: TestAccDynamoDBTableItem_update (35.36s)
--- PASS: TestAccDynamoDBTable_lsiUpdate (73.77s)
--- PASS: TestAccDynamoDBTable_gsiUpdateCapacity (77.08s)
--- PASS: TestAccDynamoDBTableItemDataSource_projectionExpression (25.43s)
--- PASS: TestAccDynamoDBTable_streamSpecification (84.81s)
--- PASS: TestAccDynamoDBTableItem_withMultipleItems (27.15s)
--- PASS: TestAccDynamoDBTableItem_basic (24.13s)
--- PASS: TestAccDynamoDBTableItem_rangeKey (25.96s)
--- PASS: TestAccDynamoDBTable_TTL_update (40.58s)
--- PASS: TestAccDynamoDBTable_lsiNonKeyAttributes (36.58s)
--- PASS: TestAccDynamoDBTableItemDataSource_basic (25.67s)
--- PASS: TestAccDynamoDBTable_encryption (129.36s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisionedIgnoreChanges (45.03s)
--- PASS: TestAccDynamoDBTable_BillingMode_payPerRequestToProvisioned (45.00s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_payPerRequestToProvisioned (65.59s)
--- PASS: TestAccDynamoDBTable_streamSpecificationDiffs (158.05s)
--- PASS: TestAccDynamoDBTable_enablePITR (61.31s)
--- PASS: TestAccDynamoDBTable_Disappears_payPerRequestWithGSI (85.54s)
--- PASS: TestAccDynamoDBTable_disappears (17.87s)
--- PASS: TestAccDynamoDBTable_deletion_protection (28.42s)
--- PASS: TestAccDynamoDBTable_tableClass_migrate (37.20s)
--- PASS: TestAccDynamoDBTableReplica_pitr (206.87s)
--- PASS: TestAccDynamoDBTable_basic (20.75s)
--- PASS: TestAccDynamoDBTable_tableClassExplicitDefault (25.11s)
--- PASS: TestAccDynamoDBTable_tableClass_ConcurrentModification (36.07s)
--- PASS: TestAccDynamoDBTable_importTable (89.64s)
--- PASS: TestAccDynamoDBTableReplica_basic (248.35s)
--- PASS: TestAccDynamoDBTableReplica_disappears (271.34s)
--- PASS: TestAccDynamoDBTable_tableClassInfrequentAccess (39.89s)
--- PASS: TestAccDynamoDBTable_Replica_single (467.17s)
--- PASS: TestAccDynamoDBTable_Replica_tagsNext (430.13s)
--- PASS: TestAccDynamoDBTable_Replica_pitr (313.67s)
--- PASS: TestAccDynamoDBTable_backup_overrideEncryption (424.39s)
--- PASS: TestAccDynamoDBTable_Replica_multiple (587.80s)
--- PASS: TestAccDynamoDBTable_Replica_tagsUpdate (349.42s)
--- PASS: TestAccDynamoDBTable_Replica_tagsTwoOfTwo (324.01s)
--- PASS: TestAccDynamoDBTableReplica_tableClass (370.98s)
--- PASS: TestAccDynamoDBTableReplica_keys (372.84s)
--- PASS: TestAccDynamoDBTableReplica_tags (251.05s)
--- PASS: TestAccDynamoDBTableItemDataSource_expressionAttributeNames (36.73s)
--- PASS: TestAccDynamoDBTable_TTL_disabled (32.72s)
--- PASS: TestAccDynamoDBTableReplica_pitrKMS (254.06s)
--- PASS: TestAccDynamoDBTable_Replica_singleCMK (252.88s)
--- PASS: TestAccDynamoDBTableReplica_pitrDefault (259.57s)
--- PASS: TestAccDynamoDBTable_Replica_singleStreamSpecification (225.80s)
--- PASS: TestAccDynamoDBTable_Replica_tagsOneOfTwo (273.74s)
--- PASS: TestAccDynamoDBTable_backupEncryption (712.74s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequestIgnoreChanges (843.08s)
--- PASS: TestAccDynamoDBTable_Replica_singleDefaultKeyEncrypted (333.48s)
--- PASS: TestAccDynamoDBTable_BillingMode_provisionedToPayPerRequest (862.75s)
--- PASS: TestAccDynamoDBTable_Replica_pitrKMS (379.43s)
--- PASS: TestAccDynamoDBTable_BillingModeGSI_provisionedToPayPerRequest (918.33s)
--- PASS: TestAccDynamoDBTable_extended (915.90s)
--- PASS: TestAccDynamoDBTable_gsiUpdateNonKeyAttributes (1020.69s)
--- PASS: TestAccDynamoDBTableExport_basic (1001.47s)
--- PASS: TestAccDynamoDBTableExport_kms (1111.90s)
--- PASS: TestAccDynamoDBTable_attributeUpdate (1312.04s)
--- PASS: TestAccDynamoDBTable_gsiUpdateOtherAttributes (1372.22s)
--- PASS: TestAccDynamoDBTable_Replica_doubleAddCMK (851.39s)
--- PASS: TestAccDynamoDBTableExport_s3Prefix (1393.89s)

@gdavison gdavison requested a review from a team as a code owner June 15, 2024 00:24
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 documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/L Managed by automation to categorize the size of a PR. labels Jun 15, 2024
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 15, 2024
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccDynamoDBTable_basic\|TestAccDynamoDBTable_TTL_' PKG=dynamodb ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.2 test ./internal/service/dynamodb/... -v -count 1 -parallel 3  -run=TestAccDynamoDBTable_basic\|TestAccDynamoDBTable_TTL_ -timeout 360m
=== RUN   TestAccDynamoDBTable_basic
=== PAUSE TestAccDynamoDBTable_basic
=== RUN   TestAccDynamoDBTable_TTL_enabled
=== PAUSE TestAccDynamoDBTable_TTL_enabled
=== RUN   TestAccDynamoDBTable_TTL_disabled
=== PAUSE TestAccDynamoDBTable_TTL_disabled
=== RUN   TestAccDynamoDBTable_TTL_update
=== PAUSE TestAccDynamoDBTable_TTL_update
=== RUN   TestAccDynamoDBTable_TTL_validate
=== PAUSE TestAccDynamoDBTable_TTL_validate
=== CONT  TestAccDynamoDBTable_basic
=== CONT  TestAccDynamoDBTable_TTL_update
=== CONT  TestAccDynamoDBTable_TTL_validate
--- PASS: TestAccDynamoDBTable_TTL_validate (4.99s)
=== CONT  TestAccDynamoDBTable_TTL_disabled
--- PASS: TestAccDynamoDBTable_basic (22.47s)
=== CONT  TestAccDynamoDBTable_TTL_enabled
--- PASS: TestAccDynamoDBTable_TTL_disabled (21.78s)
--- PASS: TestAccDynamoDBTable_TTL_update (32.69s)
--- PASS: TestAccDynamoDBTable_TTL_enabled (25.94s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/dynamodb	52.868s

Needs a CHANGELOG entry.

@gdavison gdavison merged commit 46774b5 into main Jun 17, 2024
45 checks passed
@gdavison gdavison deleted the b-dynamo-ttl-disabled branch June 17, 2024 17:58
@github-actions github-actions bot added this to the v5.55.0 milestone Jun 17, 2024
terraform-aws-provider bot pushed a commit that referenced this pull request Jun 17, 2024
Copy link

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

@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 20, 2024
flostadler added a commit to pulumi/pulumi-aws that referenced this pull request Jun 24, 2024
Previously you could set the TTL attribute's name even though TTL
was disabled. This resulted in permadiffs.

Upstream introduced added validation in this PR:
hashicorp/terraform-provider-aws#37991
Copy link

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.
If you have found a problem that seems related to this change, 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 Jul 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. service/dynamodb Issues and PRs that pertain to the dynamodb service. size/L Managed by automation to categorize the size of a PR. 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.

aws_dynamodb_table - with ttl disabled, can't "terraform apply" twice
2 participants