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

[New Data Source]: Datasource for Organizations Policies #30682

Closed
danielw-aws opened this issue Apr 12, 2023 · 5 comments · Fixed by #31682
Closed

[New Data Source]: Datasource for Organizations Policies #30682

danielw-aws opened this issue Apr 12, 2023 · 5 comments · Fixed by #31682
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. service/organizations Issues and PRs that pertain to the organizations service.
Milestone

Comments

@danielw-aws
Copy link
Contributor

Description

There currently is no way to list all of the policies that are associated with a target account outside of the root account making it hard to define what has been applied to a root, OU or account. More specifically 4 different types of policies (SERVICE_CONTROL_POLICY | TAG_POLICY | BACKUP_POLICY | AISERVICES_OPT_OUT_POLICY) can all be applied to an OU, account or root but currently only the root can have policies listed. By providing this data source this allows any account in an organization to provide all of the policies associated.

Requested Resource(s) and/or Data Source(s)

aws_organizations_organizational_policies

Potential Terraform Configuration

This would be a wrapping of the ListPolciesForTarget which can target a ou,root or an account to provide all of the polices that are associated with the target id.

References

https://docs.aws.amazon.com/organizations/latest/APIReference/API_ListPoliciesForTarget.html

Would you like to implement a fix?

Yes

@danielw-aws danielw-aws added the needs-triage Waiting for first response or review from a maintainer. label Apr 12, 2023
@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@ewbankkit ewbankkit added new-data-source Introduces a new data source. service/organizations Issues and PRs that pertain to the organizations service. enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 13, 2023
@danielw-aws danielw-aws changed the title [New Data Source]: Datasoure for Organizations Policies [New Data Source]: Datasource for Organizations Policies Apr 21, 2023
@ghost
Copy link

ghost commented Jun 7, 2023

Somewhat oddly, and maybe worth filing a separate bug, but the published docs for Provider 5.1.0 list a Data that purports to do this:

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/organizations_policy

With full example code that includes a misspelling of "organizational" as oorganizational. It doesn't work, even if you fix the spelling of the name, and as far as I can tell in the code the resource doesn't actually exist.

@danielw-aws
Copy link
Contributor Author

danielw-aws commented Jun 7, 2023

The resource and code don't exist in 5.1.0. I had tried doing two parallel pull requests for the same release one relying on the other. One got accepted the other one (this one) got punted with some fixes. The current pull request that closes this will update the documentation to be correct, not have a typo, and enable aws_organizations_policies_for_target datasource once its accepted.

@github-actions github-actions bot added this to the v5.4.0 milestone Jun 15, 2023
@github-actions
Copy link

This functionality has been released in v5.4.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 issue 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 similar to this, 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 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. service/organizations Issues and PRs that pertain to the organizations service.
Projects
None yet
2 participants