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_iam_policy: Do not iterate over all IAM Policies when ARN supplied #25538

Merged
merged 6 commits into from
Jun 23, 2022

Conversation

gdavison
Copy link
Contributor

@gdavison gdavison commented Jun 23, 2022

No longer iterates over all IAM Policies in aws_iam_policy data source when ARN is supplied. Also fixes bug where tags are not retrieved.

Closes #25533.
Closes #25537.
Closes #19878.

Output from acceptance testing:

$ make testacc PKG=iam TESTS=TestAccIAMPolicyDataSource_

--- PASS: TestAccIAMPolicyDataSource_awsManagedArn (26.32s)
--- PASS: TestAccIAMPolicyDataSource_arnTags (29.29s)
--- PASS: TestAccIAMPolicyDataSource_arn (30.15s)
--- PASS: TestAccIAMPolicyDataSource_nameAndPathPrefixTags (30.17s)
--- PASS: TestAccIAMPolicyDataSource_nameAndPathPrefix (30.49s)
--- PASS: TestAccIAMPolicyDataSource_nameTags (39.02s)
--- PASS: TestAccIAMPolicyDataSource_name (40.39s)
--- PASS: TestAccIAMPolicyDataSource_nonExistent (126.49s)

@github-actions github-actions bot added service/iam Issues and PRs that pertain to the iam service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. labels Jun 23, 2022
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=TestAccIAMPolicyDataSource_' PKG=iam ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/iam/... -v -count 1 -parallel 3  -run=TestAccIAMPolicyDataSource_ -timeout 180m
=== RUN   TestAccIAMPolicyDataSource_arn
=== PAUSE TestAccIAMPolicyDataSource_arn
=== RUN   TestAccIAMPolicyDataSource_arnTags
=== PAUSE TestAccIAMPolicyDataSource_arnTags
=== RUN   TestAccIAMPolicyDataSource_name
=== PAUSE TestAccIAMPolicyDataSource_name
=== RUN   TestAccIAMPolicyDataSource_nameTags
=== PAUSE TestAccIAMPolicyDataSource_nameTags
=== RUN   TestAccIAMPolicyDataSource_nameAndPathPrefix
=== PAUSE TestAccIAMPolicyDataSource_nameAndPathPrefix
=== RUN   TestAccIAMPolicyDataSource_nameAndPathPrefixTags
=== PAUSE TestAccIAMPolicyDataSource_nameAndPathPrefixTags
=== RUN   TestAccIAMPolicyDataSource_nonExistent
=== PAUSE TestAccIAMPolicyDataSource_nonExistent
=== CONT  TestAccIAMPolicyDataSource_arn
=== CONT  TestAccIAMPolicyDataSource_nameAndPathPrefix
=== CONT  TestAccIAMPolicyDataSource_name
--- PASS: TestAccIAMPolicyDataSource_arn (16.40s)
=== CONT  TestAccIAMPolicyDataSource_nameTags
--- PASS: TestAccIAMPolicyDataSource_nameAndPathPrefix (16.45s)
=== CONT  TestAccIAMPolicyDataSource_arnTags
--- PASS: TestAccIAMPolicyDataSource_name (20.14s)
=== CONT  TestAccIAMPolicyDataSource_nonExistent
--- PASS: TestAccIAMPolicyDataSource_arnTags (12.70s)
=== CONT  TestAccIAMPolicyDataSource_nameAndPathPrefixTags
--- PASS: TestAccIAMPolicyDataSource_nameTags (16.21s)
--- PASS: TestAccIAMPolicyDataSource_nameAndPathPrefixTags (12.79s)
--- PASS: TestAccIAMPolicyDataSource_nonExistent (121.90s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/iam	145.937s

@ewbankkit
Copy link
Contributor

Needs a CHANGELOG entry.

@gdavison
Copy link
Contributor Author

Needs documentation, too :)

@github-actions github-actions bot added the documentation Introduces or discusses updates to documentation. label Jun 23, 2022
```

```release-note:bug
data-source/aws_iam_policy: Now loads tags.
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space.

Suggested change
data-source/aws_iam_policy: Now loads tags.
data-source/aws_iam_policy: Now loads tags.

@gdavison gdavison merged commit ffeec8c into main Jun 23, 2022
@gdavison gdavison deleted the b-iam-policy-get branch June 23, 2022 18:45
@github-actions github-actions bot added this to the v4.20.0 milestone Jun 23, 2022
github-actions bot pushed a commit that referenced this pull request Jun 23, 2022
@github-actions
Copy link

This functionality has been released in v4.20.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
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 25, 2022
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/iam Issues and PRs that pertain to the iam service. size/XL 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
2 participants