Skip to content

fix: use error type to detect document deletion #42175

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nlitchfield
Copy link

As described in #42125 the error message associated with document deletion has changed and consequently terraform fails to detect InvalidDocument errors correctly. This PR proposes using the error type as suggested by AWS in that issue.

Closes #42125

References

#42125 (comment)

Output from Acceptance Testing

% % make testacc TESTS=TestAccSSMDocument PKG=ssm
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.8 test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMDocument'  -timeout 360m -vet=off
go: downloading gopkg.in/dnaeon/go-vcr.v3 v3.2.1
2025/04/08 18:08:35 Initializing Terraform AWS Provider...
=== RUN   TestAccSSMDocumentDataSource_basic
=== PAUSE TestAccSSMDocumentDataSource_basic
=== RUN   TestAccSSMDocumentDataSource_basicAutomation
=== PAUSE TestAccSSMDocumentDataSource_basicAutomation
=== RUN   TestAccSSMDocumentDataSource_managed
=== PAUSE TestAccSSMDocumentDataSource_managed
=== RUN   TestAccSSMDocument_tags
=== PAUSE TestAccSSMDocument_tags
=== RUN   TestAccSSMDocument_tags_null
=== PAUSE TestAccSSMDocument_tags_null
=== RUN   TestAccSSMDocument_tags_EmptyMap
=== PAUSE TestAccSSMDocument_tags_EmptyMap
=== RUN   TestAccSSMDocument_tags_AddOnUpdate
=== PAUSE TestAccSSMDocument_tags_AddOnUpdate
=== RUN   TestAccSSMDocument_tags_EmptyTag_OnCreate
=== PAUSE TestAccSSMDocument_tags_EmptyTag_OnCreate
=== RUN   TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add
=== PAUSE TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add
=== RUN   TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace
=== PAUSE TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace
=== RUN   TestAccSSMDocument_tags_DefaultTags_providerOnly
=== PAUSE TestAccSSMDocument_tags_DefaultTags_providerOnly
=== RUN   TestAccSSMDocument_tags_DefaultTags_nonOverlapping
=== PAUSE TestAccSSMDocument_tags_DefaultTags_nonOverlapping
=== RUN   TestAccSSMDocument_tags_DefaultTags_overlapping
=== PAUSE TestAccSSMDocument_tags_DefaultTags_overlapping
=== RUN   TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly
=== PAUSE TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly
=== RUN   TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly
=== PAUSE TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly
=== RUN   TestAccSSMDocument_tags_DefaultTags_emptyResourceTag
=== PAUSE TestAccSSMDocument_tags_DefaultTags_emptyResourceTag
=== RUN   TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag
=== PAUSE TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag
=== RUN   TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag
=== PAUSE TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag
=== RUN   TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag
=== PAUSE TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag
=== RUN   TestAccSSMDocument_tags_ComputedTag_OnCreate
=== PAUSE TestAccSSMDocument_tags_ComputedTag_OnCreate
=== RUN   TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add
=== PAUSE TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add
=== RUN   TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace
=== PAUSE TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace
=== RUN   TestAccSSMDocument_tags_IgnoreTags_Overlap_DefaultTag
=== PAUSE TestAccSSMDocument_tags_IgnoreTags_Overlap_DefaultTag
=== RUN   TestAccSSMDocument_tags_IgnoreTags_Overlap_ResourceTag
=== PAUSE TestAccSSMDocument_tags_IgnoreTags_Overlap_ResourceTag
=== RUN   TestAccSSMDocument_basic
=== PAUSE TestAccSSMDocument_basic
=== RUN   TestAccSSMDocument_name
=== PAUSE TestAccSSMDocument_name
=== RUN   TestAccSSMDocument_Target_type
=== PAUSE TestAccSSMDocument_Target_type
=== RUN   TestAccSSMDocument_versionName
=== PAUSE TestAccSSMDocument_versionName
=== RUN   TestAccSSMDocument_update
=== PAUSE TestAccSSMDocument_update
=== RUN   TestAccSSMDocument_Permission_public
=== PAUSE TestAccSSMDocument_Permission_public
=== RUN   TestAccSSMDocument_Permission_private
=== PAUSE TestAccSSMDocument_Permission_private
=== RUN   TestAccSSMDocument_Permission_batching
=== PAUSE TestAccSSMDocument_Permission_batching
=== RUN   TestAccSSMDocument_Permission_change
=== PAUSE TestAccSSMDocument_Permission_change
=== RUN   TestAccSSMDocument_params
=== PAUSE TestAccSSMDocument_params
=== RUN   TestAccSSMDocument_automation
=== PAUSE TestAccSSMDocument_automation
=== RUN   TestAccSSMDocument_package
=== PAUSE TestAccSSMDocument_package
=== RUN   TestAccSSMDocument_SchemaVersion_1
=== PAUSE TestAccSSMDocument_SchemaVersion_1
=== RUN   TestAccSSMDocument_session
=== PAUSE TestAccSSMDocument_session
=== RUN   TestAccSSMDocument_DocumentFormat_yaml
=== PAUSE TestAccSSMDocument_DocumentFormat_yaml
=== RUN   TestAccSSMDocument_disappears
=== PAUSE TestAccSSMDocument_disappears
=== CONT  TestAccSSMDocumentDataSource_basic
=== CONT  TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add
=== CONT  TestAccSSMDocument_Permission_private
=== CONT  TestAccSSMDocument_Permission_public
=== CONT  TestAccSSMDocument_tags_DefaultTags_providerOnly
=== CONT  TestAccSSMDocument_name
=== CONT  TestAccSSMDocument_package
=== CONT  TestAccSSMDocument_DocumentFormat_yaml
=== CONT  TestAccSSMDocument_session
=== CONT  TestAccSSMDocument_SchemaVersion_1
=== CONT  TestAccSSMDocument_tags_DefaultTags_emptyResourceTag
=== CONT  TestAccSSMDocument_tags_ComputedTag_OnCreate
=== CONT  TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag
=== CONT  TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag
=== CONT  TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag
=== CONT  TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly
=== CONT  TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly
=== CONT  TestAccSSMDocument_tags_EmptyMap
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace
=== CONT  TestAccSSMDocument_disappears
--- PASS: TestAccSSMDocument_disappears (32.27s)
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccSSMDocument_session (40.33s)
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnCreate
--- PASS: TestAccSSMDocument_Permission_public (40.54s)
=== CONT  TestAccSSMDocument_tags_AddOnUpdate
--- PASS: TestAccSSMDocument_Permission_private (42.42s)
=== CONT  TestAccSSMDocument_params
--- PASS: TestAccSSMDocumentDataSource_basic (56.22s)
=== CONT  TestAccSSMDocument_automation
--- PASS: TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag (57.37s)
=== CONT  TestAccSSMDocument_Permission_change
--- PASS: TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag (58.32s)
=== CONT  TestAccSSMDocument_Permission_batching
--- PASS: TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag (62.78s)
=== CONT  TestAccSSMDocument_tags_IgnoreTags_Overlap_ResourceTag
--- PASS: TestAccSSMDocument_DocumentFormat_yaml (68.36s)
=== CONT  TestAccSSMDocument_basic
--- PASS: TestAccSSMDocument_SchemaVersion_1 (68.57s)
=== CONT  TestAccSSMDocument_tags
--- PASS: TestAccSSMDocument_name (69.08s)
=== CONT  TestAccSSMDocument_tags_null
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace (69.68s)
=== CONT  TestAccSSMDocument_versionName
--- PASS: TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly (70.88s)
=== CONT  TestAccSSMDocument_update
--- PASS: TestAccSSMDocument_tags_EmptyMap (71.28s)
=== CONT  TestAccSSMDocumentDataSource_managed
--- PASS: TestAccSSMDocument_tags_DefaultTags_emptyResourceTag (71.55s)
=== CONT  TestAccSSMDocumentDataSource_basicAutomation
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnCreate (73.21s)
=== CONT  TestAccSSMDocument_Target_type
--- PASS: TestAccSSMDocument_params (38.34s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_overlapping
--- PASS: TestAccSSMDocumentDataSource_managed (27.89s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_nonOverlapping
--- PASS: TestAccSSMDocument_Permission_batching (41.13s)
=== CONT  TestAccSSMDocument_tags_IgnoreTags_Overlap_DefaultTag
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add (104.90s)
=== CONT  TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly (107.19s)
--- PASS: TestAccSSMDocument_basic (43.09s)
--- PASS: TestAccSSMDocument_tags_AddOnUpdate (71.88s)
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnCreate (76.66s)
--- PASS: TestAccSSMDocument_automation (63.41s)
--- PASS: TestAccSSMDocument_tags_null (50.89s)
--- PASS: TestAccSSMDocument_package (124.46s)
--- PASS: TestAccSSMDocument_update (60.39s)
--- PASS: TestAccSSMDocument_versionName (62.46s)
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add (100.45s)
--- PASS: TestAccSSMDocument_Target_type (62.59s)
--- PASS: TestAccSSMDocument_Permission_change (82.37s)
--- PASS: TestAccSSMDocumentDataSource_basicAutomation (70.15s)
--- PASS: TestAccSSMDocument_tags_DefaultTags_providerOnly (145.10s)
--- PASS: TestAccSSMDocument_tags_IgnoreTags_Overlap_ResourceTag (84.66s)
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace (50.64s)
--- PASS: TestAccSSMDocument_tags_IgnoreTags_Overlap_DefaultTag (57.84s)
--- PASS: TestAccSSMDocument_tags_DefaultTags_overlapping (82.66s)
--- PASS: TestAccSSMDocument_tags_DefaultTags_nonOverlapping (72.39s)
--- PASS: TestAccSSMDocument_tags (103.59s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ssm	179.229s

As described in hashicorp#42125 the error message associated with document deletion has changed and consequently terraform fails to detect InvalidDocument errors correctly. This PR proposes using the error type as suggested by AWS.
@nlitchfield nlitchfield requested a review from a team as a code owner April 8, 2025 17:35
Copy link

github-actions bot commented Apr 8, 2025

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • 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 needs-triage Waiting for first response or review from a maintainer. service/ssm Issues and PRs that pertain to the ssm service. size/XS Managed by automation to categorize the size of a PR. labels Apr 8, 2025
@gchristidis
Copy link
Contributor

Another update from AWS support ticket

I have some important updates regarding the SSM document destruction issue:

  1. Immediate Resolution:

Our internal team has completed a rollback of the recent changes in all regions. As a result, you should no longer encounter this specific issue with SSM document destruction. Please try your operations again and let me know if you experience any further problems.

  1. Long-term Fix:

While the immediate issue has been resolved through the rollback, our team is actively working on a permanent solution. We are coordinating with HashiCorp to ensure that the Terraform AWS provider handles the planned changes correctly before we implement them again.

  1. Timeline:
    At this point, I don't have exact dates or ETA for when the permanent fix will be implemented next time.

This issue for the moment is no longer an issue

@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
3 participants