-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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 data sources aws_organizations_organizational_unit_child_accounts and aws_organizations_organizational_unit_descendant_accounts #24350
Conversation
Finalize `aws_organizations_accounts` data source
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @ahublersos 👋
It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTING guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.
Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.
Thanks again, and welcome to the community! 😃
I'm still having trouble getting tests to run. Below is the output I get when attempting to run the Some observations/things I've tried:
Test output:
|
Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like hashicorp/terraform-provider-aws#24350 will get merged any time soon, so mcaf_aws_all_organizational_units fills this gap until such a resource exists in the community AWS provider. Signed-off-by: Stephen Hoekstra <[email protected]>
Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like hashicorp/terraform-provider-aws#24350 will get merged any time soon, so mcaf_aws_all_organizational_units fills this gap until such a resource exists in the community AWS provider. Signed-off-by: Stephen Hoekstra <[email protected]>
Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like hashicorp/terraform-provider-aws#24350 will get merged any time soon, so mcaf_aws_all_organizational_units fills this gap until such a resource exists in the community AWS provider. Signed-off-by: Stephen Hoekstra <[email protected]>
Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like hashicorp/terraform-provider-aws#24350 will get merged any time soon, so mcaf_aws_all_organizational_units fills this gap until such a resource exists in the community AWS provider. Signed-off-by: Stephen Hoekstra <[email protected]>
Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like hashicorp/terraform-provider-aws#24350 will get merged any time soon, so mcaf_aws_all_organizational_units fills this gap until such a resource exists in the community AWS provider. Signed-off-by: Stephen Hoekstra <[email protected]>
There was a problem hiding this 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=TestAccOrganizations_serial/Organization/ChildAccountsDataSource' PKG=organizations
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/organizations/... -v -count 1 -parallel 20 -run=TestAccOrganizations_serial/Organization/ChildAccountsDataSource -timeout 180m
=== RUN TestAccOrganizations_serial
=== PAUSE TestAccOrganizations_serial
=== CONT TestAccOrganizations_serial
=== RUN TestAccOrganizations_serial/Organization
=== RUN TestAccOrganizations_serial/Organization/ChildAccountsDataSource
=== RUN TestAccOrganizations_serial/OrganizationalUnit
=== RUN TestAccOrganizations_serial/OrganizationalUnits
--- PASS: TestAccOrganizations_serial (14.35s)
--- PASS: TestAccOrganizations_serial/Organization (14.35s)
--- PASS: TestAccOrganizations_serial/Organization/ChildAccountsDataSource (14.35s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnit (0.00s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnits (0.00s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/organizations 19.574s
% make testacc TESTARGS='-run=TestAccOrganizations_serial/OrganizationalUnits/DataSource' PKG=organizations
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/organizations/... -v -count 1 -parallel 20 -run=TestAccOrganizations_serial/OrganizationalUnits/DataSource -timeout 180m
=== RUN TestAccOrganizations_serial
=== PAUSE TestAccOrganizations_serial
=== CONT TestAccOrganizations_serial
=== RUN TestAccOrganizations_serial/OrganizationalUnits
=== RUN TestAccOrganizations_serial/OrganizationalUnits/DataSource
--- PASS: TestAccOrganizations_serial (17.59s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnits (17.59s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnits/DataSource (17.59s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/organizations 23.246s
% make testacc TESTARGS='-run=TestAccOrganizations_serial/Organization/DescendantAccountsDataSource' PKG=organizations
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/organizations/... -v -count 1 -parallel 20 -run=TestAccOrganizations_serial/Organization/DescendantAccountsDataSource -timeout 180m
=== RUN TestAccOrganizations_serial
=== PAUSE TestAccOrganizations_serial
=== CONT TestAccOrganizations_serial
=== RUN TestAccOrganizations_serial/Organization
=== RUN TestAccOrganizations_serial/Organization/DescendantAccountsDataSource
=== RUN TestAccOrganizations_serial/OrganizationalUnit
=== RUN TestAccOrganizations_serial/OrganizationalUnits
--- PASS: TestAccOrganizations_serial (24.31s)
--- PASS: TestAccOrganizations_serial/Organization (24.31s)
--- PASS: TestAccOrganizations_serial/Organization/DescendantAccountsDataSource (24.31s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnit (0.00s)
--- PASS: TestAccOrganizations_serial/OrganizationalUnits (0.00s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/organizations 29.616s
@ahublersos @ebi-yade Thanks for the contribution 🎉 👏. |
This functionality has been released in v4.55.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! |
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. |
Community Note
Description
Closes #16153
Closes #18589.
This PR adds two data sources that allow the retrieval of a list of account IDs based on an AWS organizations Organizational Unit ID.
The
aws_organizations_organizational_unit_child_accounts
data source provides the immediate child accounts while theaws_organizations_organizational_unit_descendant_accounts
provides all generations of child account IDs under the given OU.Output from acceptance testing:
I'm still having trouble getting acceptance tests to run. I'm sure it's something simple I'm missing with the test framework. (Open to any suggestions!)
Cleanup from testing is tricky since all the accounts need to be manually deleted.
I did do some manual testing. Info on that is below, with emails and account IDs replaced with generic values.
My test org for manual testing looks like this:
My test config:
Output from some manual testing: