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

Add account ID to the SSM document ARN #4436

Merged

Conversation

tomelliff
Copy link
Contributor

Without the account ID being specified if the ARN output is used as an allowed resource in an IAM policy then the IAM policy doesn't match the document and you get a permissions error from IAM when executing the document.

@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label May 3, 2018
Without the account ID being specified if the ARN output is used as an allowed resource in an IAM policy then the IAM policy doesn't match the document and you get a permissions error from IAM when executing the document.
@tomelliff tomelliff force-pushed the add-account-id-to-ssm-document-arn branch from d784383 to 02d074b Compare May 3, 2018 09:12
@ghost ghost added the size/XS Managed by automation to categorize the size of a PR. label May 3, 2018
@bflad bflad added bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. labels May 4, 2018
@ghost ghost added size/S Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels May 4, 2018
@bflad bflad added this to the v1.18.0 milestone May 4, 2018
Config: testAccAWSSSMDocumentBasicConfig(name),
Check: resource.ComposeTestCheckFunc(
testAccCheckAWSSSMDocumentExists("aws_ssm_document.foo"),
resource.TestCheckResourceAttr("aws_ssm_document.foo", "document_format", "JSON"),
resource.TestMatchResourceAttr("aws_ssm_document.foo", "arn",
regexp.MustCompile(`^arn:aws:ssm:[a-z]{2}-[a-z]+-\d{1}:\d{12}:document/.*$`)),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for this very accurate test check for the Commercial partition -- we'll be making these more generic so we can also support testing in GovCloud (US) and China at some point in the near future:

regexp.MustCompile(`^arn:[^:]+:ssm:[^:]+:\d{12}:document/.*$`))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ha, I originally had the regex match gov-cloud as well and figured it was a waste of time because we didn't run the tests in gov-cloud/china and so took it out to simplify the regex. Didn't think about matching all non colon characters for the region and partition though.

I'll keep that in mind for anything else I add in future.

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks @tomelliff! 🚀

Commercial

6 tests passed (all tests)
=== RUN   TestAccAWSSSMDocument_params
--- PASS: TestAccAWSSSMDocument_params (8.94s)
=== RUN   TestAccAWSSSMDocument_permission
--- PASS: TestAccAWSSSMDocument_permission (12.54s)
=== RUN   TestAccAWSSSMDocument_update
--- PASS: TestAccAWSSSMDocument_update (15.31s)
=== RUN   TestAccAWSSSMDocument_basic
--- PASS: TestAccAWSSSMDocument_basic (15.48s)
=== RUN   TestAccAWSSSMDocument_DocumentFormat_YAML
--- PASS: TestAccAWSSSMDocument_DocumentFormat_YAML (21.07s)
=== RUN   TestAccAWSSSMDocument_automation
--- PASS: TestAccAWSSSMDocument_automation (33.68s)

@bflad bflad merged commit 4b1943d into hashicorp:master May 4, 2018
bflad added a commit that referenced this pull request May 4, 2018
@tomelliff
Copy link
Contributor Author

@bflad thanks for the review and merge again :)

@bflad
Copy link
Contributor

bflad commented May 10, 2018

This has been released in version 1.18.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/ssm Issues and PRs that pertain to the ssm service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants