Skip to content

d/aws_iam_role_policies: new data source#46936

Open
Eiji-Kudo wants to merge 3 commits intohashicorp:mainfrom
Eiji-Kudo:f-iam-role-policies-data-sources
Open

d/aws_iam_role_policies: new data source#46936
Eiji-Kudo wants to merge 3 commits intohashicorp:mainfrom
Eiji-Kudo:f-iam-role-policies-data-sources

Conversation

@Eiji-Kudo
Copy link

@Eiji-Kudo Eiji-Kudo commented Mar 14, 2026

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request to help the community and maintainers prioritize for review
  • Please do not leave "+1" or "me too" comments, they generate extra noise for pull request followers and do not help prioritize for review

Description

Adds a new data source aws_iam_role_policies that lists the names of inline policies embedded in a specified IAM role using the ListRolePolicies API.

This is part of the request in #46579. The other two data sources (aws_iam_attached_role_policies and aws_iam_custom_policy_simulation) will be submitted as separate PRs.

PR Checklist

  • Acceptance test covering the new data source
  • Documentation (website/docs/d/iam_role_policies.html.markdown)
  • Code generation (service_package_gen.go updated)

New Data Source

  • aws_iam_role_policies

Example Usage

data "aws_iam_role_policies" "example" {
  role_name = "my-role-name"
}

Arguments

  • role_name (Required) - Name of the IAM role.

Attributes

  • policy_names - List of inline policy names associated with the role.

Testing

New acceptance tests:

  • TestAccIAMRolePoliciesDataSource_basic
  • TestAccIAMRolePoliciesDataSource_empty

Partially addresses #46579

Add data source to list inline policy names for an IAM role
using the ListRolePolicies API.

Closes hashicorp#46579
@Eiji-Kudo Eiji-Kudo requested a review from a team as a code owner March 14, 2026 14:48
@github-actions
Copy link
Contributor

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
Copy link
Contributor

github-actions bot commented Mar 14, 2026

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions bot added needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/iam Issues and PRs that pertain to the iam service. generators Relates to code generators. size/L Managed by automation to categorize the size of a PR. labels Mar 14, 2026
@dosubot dosubot bot added the new-data-source Introduces a new data source. label Mar 14, 2026
@github-actions github-actions bot added the size/XL Managed by automation to categorize the size of a PR. label Mar 14, 2026
- Migrate from SDK V2 to Framework (FrameworkDataSource)
- Reuse findRolePoliciesByName from role_policies_exclusive.go
- Change policy_names from List to Set for consistency
- Add role_name validators (length, regex)
- Add DONOTCOPY comment
- Add twoPolicies test case
@Eiji-Kudo Eiji-Kudo force-pushed the f-iam-role-policies-data-sources branch from 0af05b3 to 9eed027 Compare March 14, 2026 15:21
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Mar 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Introduces or discusses updates to documentation. generators Relates to code generators. new-data-source Introduces a new data source. service/iam Issues and PRs that pertain to the iam service. size/L Managed by automation to categorize the size of a PR. 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

Development

Successfully merging this pull request may close these issues.

2 participants