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

Fix Automation SSM Document ARN for Resource and Data Source #39705

Conversation

eugercek
Copy link
Contributor

@eugercek eugercek commented Oct 13, 2024

Description

The problem was hardcoded arn resource prefix. Investigated doc to make sure we cover rest of them:

Although there are many types of documents in the doc there are only 2 types of ARNs in the doc. Onlysession resource looked like the session document type but apperantly it's not from the session doc and a quick github search shows it's the actual session not the document.


Also data source gives wrong ARN, fixed that.

Relations

Closes #34506

Output from Acceptance Testing

> make testacc TESTS='TestAccSSMDocument_automation|TestAccSSMDocumentDataSource_basic|TestAccSSMDocumentDataSource_basicAutomation' PKG=ssm
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ssm/... -v -count 1 -parallel 20 -run='TestAccSSMDocument_automation|TestAccSSMDocumentDataSource_basic|TestAccSSMDocumentDataSource_basicAutomation'  -timeout 360m
2024/10/14 02:12:41 Initializing Terraform AWS Provider...
=== RUN   TestAccSSMDocumentDataSource_basic
=== PAUSE TestAccSSMDocumentDataSource_basic
=== RUN   TestAccSSMDocumentDataSource_basicAutomation
=== PAUSE TestAccSSMDocumentDataSource_basicAutomation
=== RUN   TestAccSSMDocument_automation
=== PAUSE TestAccSSMDocument_automation
=== CONT  TestAccSSMDocumentDataSource_basic
=== CONT  TestAccSSMDocument_automation
=== CONT  TestAccSSMDocumentDataSource_basicAutomation
--- PASS: TestAccSSMDocument_automation (34.16s)
--- PASS: TestAccSSMDocumentDataSource_basic (34.40s)
--- PASS: TestAccSSMDocumentDataSource_basicAutomation (45.56s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ssm        52.200s

@eugercek eugercek requested a review from a team as a code owner October 13, 2024 20:06
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/ssm Issues and PRs that pertain to the ssm service. needs-triage Waiting for first response or review from a maintainer. labels Oct 13, 2024
@eugercek eugercek force-pushed the b-aws_ssm_document-fix-automation-document-arn branch from cd28da4 to 24821a0 Compare October 13, 2024 20:08
@eugercek eugercek changed the title Fix Automation SSM Document fix ARN Fix Automation SSM Document ARN Oct 13, 2024
@eugercek eugercek changed the title Fix Automation SSM Document ARN Fix Automation SSM Document ARN for Resource and Data Source Oct 13, 2024
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Oct 14, 2024
@ewbankkit ewbankkit self-assigned this Oct 14, 2024
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Oct 14, 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=TestAccSSMDocument_\|TestAccSSMDocumentDataSource_' PKG=ssm ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.2 test ./internal/service/ssm/... -v -count 1 -parallel 3  -run=TestAccSSMDocument_\|TestAccSSMDocumentDataSource_ -timeout 360m
2024/10/14 09:02:12 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_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_OnCreate
=== CONT  TestAccSSMDocument_Permission_batching
--- PASS: TestAccSSMDocument_Permission_batching (15.73s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_providerOnly
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnCreate (19.45s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag
--- PASS: TestAccSSMDocumentDataSource_basic (19.60s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag
--- PASS: TestAccSSMDocument_tags_DefaultTags_nullOverlappingResourceTag (14.91s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag
--- PASS: TestAccSSMDocument_tags_DefaultTags_nullNonOverlappingResourceTag (15.16s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_emptyResourceTag
--- PASS: TestAccSSMDocument_tags_DefaultTags_emptyResourceTag (14.87s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly
--- PASS: TestAccSSMDocument_tags_DefaultTags_emptyProviderOnlyTag (15.06s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly
--- PASS: TestAccSSMDocument_tags_DefaultTags_providerOnly (52.02s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_overlapping
--- PASS: TestAccSSMDocument_tags_DefaultTags_updateToResourceOnly (22.50s)
=== CONT  TestAccSSMDocument_tags_DefaultTags_nonOverlapping
--- PASS: TestAccSSMDocument_tags_DefaultTags_updateToProviderOnly (24.17s)
=== CONT  TestAccSSMDocument_SchemaVersion_1
--- PASS: TestAccSSMDocument_SchemaVersion_1 (22.06s)
=== CONT  TestAccSSMDocument_disappears
--- PASS: TestAccSSMDocument_disappears (11.13s)
=== CONT  TestAccSSMDocument_DocumentFormat_yaml
--- PASS: TestAccSSMDocument_tags_DefaultTags_overlapping (39.99s)
=== CONT  TestAccSSMDocument_session
--- PASS: TestAccSSMDocument_tags_DefaultTags_nonOverlapping (39.59s)
=== CONT  TestAccSSMDocument_tags_EmptyMap
--- PASS: TestAccSSMDocument_session (13.61s)
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace
--- PASS: TestAccSSMDocument_DocumentFormat_yaml (22.03s)
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add
--- PASS: TestAccSSMDocument_tags_EmptyMap (18.01s)
=== CONT  TestAccSSMDocument_tags_EmptyTag_OnCreate
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnUpdate_Replace (23.85s)
=== CONT  TestAccSSMDocument_tags_AddOnUpdate
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnCreate (26.43s)
=== CONT  TestAccSSMDocument_automation
--- PASS: TestAccSSMDocument_tags_EmptyTag_OnUpdate_Add (35.98s)
=== CONT  TestAccSSMDocument_package
--- PASS: TestAccSSMDocument_tags_AddOnUpdate (23.59s)
=== CONT  TestAccSSMDocument_params
--- PASS: TestAccSSMDocument_params (13.86s)
=== CONT  TestAccSSMDocument_Target_type
--- PASS: TestAccSSMDocument_Target_type (24.02s)
=== CONT  TestAccSSMDocument_Permission_private
--- PASS: TestAccSSMDocument_package (47.94s)
=== CONT  TestAccSSMDocument_Permission_public
--- PASS: TestAccSSMDocument_Permission_private (13.99s)
=== CONT  TestAccSSMDocument_update
=== CONT  TestAccSSMDocument_versionName
--- PASS: TestAccSSMDocument_automation (68.72s)
--- PASS: TestAccSSMDocument_Permission_public (14.10s)
=== CONT  TestAccSSMDocument_basic
--- PASS: TestAccSSMDocument_basic (13.93s)
=== CONT  TestAccSSMDocument_name
--- PASS: TestAccSSMDocument_update (22.04s)
=== CONT  TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace
--- PASS: TestAccSSMDocument_versionName (22.17s)
=== CONT  TestAccSSMDocumentDataSource_managed
--- PASS: TestAccSSMDocumentDataSource_managed (8.35s)
=== CONT  TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add
--- PASS: TestAccSSMDocument_name (22.57s)
=== CONT  TestAccSSMDocument_tags_null
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnUpdate_Replace (27.66s)
=== CONT  TestAccSSMDocumentDataSource_basicAutomation
--- PASS: TestAccSSMDocument_tags_null (18.72s)
=== CONT  TestAccSSMDocument_Permission_change
--- PASS: TestAccSSMDocument_tags_ComputedTag_OnUpdate_Add (27.81s)
=== CONT  TestAccSSMDocument_tags
--- PASS: TestAccSSMDocument_Permission_change (30.65s)
--- PASS: TestAccSSMDocument_tags (51.26s)
--- PASS: TestAccSSMDocumentDataSource_basicAutomation (91.97s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ssm	367.458s

@ewbankkit
Copy link
Contributor

@eugercek Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit b862462 into hashicorp:main Oct 14, 2024
40 checks passed
@github-actions github-actions bot added this to the v5.72.0 milestone Oct 14, 2024
Copy link

This functionality has been released in v5.72.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 Oct 15, 2024
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. 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]: aws_ssm_document constructs document ARN regardless of type
2 participants