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

Add mcaf_aws_all_organizational_units data resource #15

Merged
merged 1 commit into from
Nov 2, 2022

Conversation

shoekstra
Copy link
Member

Currently there is no way to recursively find all OUs in an AWS Organisation via a data resource and doesn't look like this open PR 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.

Still need to fix the AWS tests and create an account to test in, but for now it works locally running Terraform in the examples/data-sources/mcaf_aws_all_organizations_organizational_units directory with valid credentials in a master account:

data.mcaf_aws_all_organizational_units.example: Reading...
data.mcaf_aws_all_organizational_units.example: Read complete after 4s [id=r-095u]

Changes to Outputs:
  + mcaf_aws_all_organizational_units = [
      + {
          + arn  = "arn:aws:organizations::111222333444:ou/o-siy7xxxxxx/ou-095u-2e2tdhww"
          + id   = "ou-095u-2e2tdhww"
          + name = "Non-Production"
          + path = "Root/Non-Production"
        },
      + {
          + arn  = "arn:aws:organizations::111222333444:ou/o-siy7xxxxxx/ou-095u-eml4rsd9"
          + id   = "ou-095u-eml4rsd9"
          + name = "Production"
          + path = "Root/Production"
        },
...
      + {
          + arn  = "arn:aws:organizations::111222333444:ou/o-siy7xxxxxx/ou-095u-ytrccguj"
          + id   = "ou-095u-ytrccguj"
          + name = "Test1"
          + path = "Root/Custom/Test1"
        },
    ]

Signed-off-by: Stephen Hoekstra shoekstra@schubergphilis.com

@shoekstra shoekstra force-pushed the aws_ou_data_source branch 2 times, most recently from fd66b38 to 9964a3b Compare October 30, 2022 20:35
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 <shoekstra@schubergphilis.com>
@shoekstra shoekstra merged commit 2bc81d0 into master Nov 2, 2022
@shoekstra shoekstra deleted the aws_ou_data_source branch November 2, 2022 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants