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

[Enhancement]: Return complete Organization data for Delegated Administrator accounts #32055

Closed
bodgit opened this issue Jun 16, 2023 · 3 comments · Fixed by #32056
Closed

[Enhancement]: Return complete Organization data for Delegated Administrator accounts #32055

bodgit opened this issue Jun 16, 2023 · 3 comments · Fixed by #32056
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/organizations Issues and PRs that pertain to the organizations service. service/sts Issues and PRs that pertain to the sts service.
Milestone

Comments

@bodgit
Copy link
Contributor

bodgit commented Jun 16, 2023

Description

If an AWS account is a Delegated Administrator for a service within an Organization, it has read-only access to the Organization data such as account lists. This means the aws_organizations_organization data source can return the complete set of Organization data, just like the master account does.

Currently the data source code checks that the current account ID running Terraform is the same as the master account ID before gathering the rest of the data, therefore it should be possible to also request the list of delegated administrators and check that the current account is within that list somewhere. If the ListDelegatedAdministrators call fails with access denied then the account isn't a delegated administrator.

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

  • aws_organizations_organization data source

Potential Terraform Configuration

data "aws_caller_identity" "delegated" {
  provider = "awsalternate"
}

resource "aws_organizations_delegated_administrator" "test" {
  account_id        = data.aws_caller_identity.delegated.account_id
  service_principal = "..."
}

data "aws_organizations_organization" "current" {
  provider = "awsalternate"

  depends_on = [
    aws_organizations_delegated_administrator.test,
  ]
}

output "account_ids" {
  value = data.aws_organizations_organization.current.accounts[*].id
}

References

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

... It grants read-only access to AWS Organizations service data.

Would you like to implement a fix?

Yes

@bodgit bodgit added enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Jun 16, 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.

@github-actions github-actions bot added service/organizations Issues and PRs that pertain to the organizations service. service/sts Issues and PRs that pertain to the sts service. labels Jun 16, 2023
@ewbankkit ewbankkit removed the needs-triage Waiting for first response or review from a maintainer. label Jun 16, 2023
@github-actions github-actions bot added this to the v5.5.0 milestone Jun 20, 2023
@github-actions
Copy link

This functionality has been released in v5.5.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 23, 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. service/organizations Issues and PRs that pertain to the organizations service. service/sts Issues and PRs that pertain to the sts service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants