GetOrganizationalUnits

Get all direct child organizational units under a parent organizational unit. This only provides immediate children, not all children.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var org = Output.Create(Aws.Organizations.GetOrganization.InvokeAsync());
        var ou = org.Apply(org => Output.Create(Aws.Organizations.GetOrganizationalUnits.InvokeAsync(new Aws.Organizations.GetOrganizationalUnitsArgs
        {
            ParentId = org.Roots[0].Id,
        })));
    }

}
package main

import (
    "github.com/pulumi/pulumi-aws/sdk/v2/go/aws/organizations"
    "github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)

func main() {
    pulumi.Run(func(ctx *pulumi.Context) error {
        org, err := organizations.LookupOrganization(ctx, nil, nil)
        if err != nil {
            return err
        }
        _, err = organizations.GetOrganizationalUnits(ctx, &organizations.GetOrganizationalUnitsArgs{
            ParentId: org.Roots[0].Id,
        }, nil)
        if err != nil {
            return err
        }
        return nil
    })
}
import pulumi
import pulumi_aws as aws

org = aws.organizations.get_organization()
ou = aws.organizations.get_organizational_units(parent_id=org.roots[0]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const org = aws.organizations.getOrganization({});
const ou = org.then(org => aws.organizations.getOrganizationalUnits({
    parentId: org.roots[0].id,
}));

Using GetOrganizationalUnits

function getOrganizationalUnits(args: GetOrganizationalUnitsArgs, opts?: InvokeOptions): Promise<GetOrganizationalUnitsResult>
function  get_organizational_units(parent_id=None, opts=None)
func GetOrganizationalUnits(ctx *Context, args *GetOrganizationalUnitsArgs, opts ...InvokeOption) (*GetOrganizationalUnitsResult, error)
public static class GetOrganizationalUnits {
    public static Task<GetOrganizationalUnitsResult> InvokeAsync(GetOrganizationalUnitsArgs args, InvokeOptions? opts = null)
}

The following arguments are supported:

ParentId string

The parent ID of the organizational unit.

ParentId string

The parent ID of the organizational unit.

parentId string

The parent ID of the organizational unit.

parent_id str

The parent ID of the organizational unit.

GetOrganizationalUnits Result

The following output properties are available:

Childrens List<GetOrganizationalUnitsChildren>

List of child organizational units, which have the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

ParentId string
Childrens []GetOrganizationalUnitsChildren

List of child organizational units, which have the following attributes:

Id string

The provider-assigned unique ID for this managed resource.

ParentId string
childrens GetOrganizationalUnitsChildren[]

List of child organizational units, which have the following attributes:

id string

The provider-assigned unique ID for this managed resource.

parentId string
childrens List[GetOrganizationalUnitsChildren]

List of child organizational units, which have the following attributes:

id str

The provider-assigned unique ID for this managed resource.

parent_id str

Supporting Types

GetOrganizationalUnitsChildren

See the output API doc for this type.

See the output API doc for this type.

See the output API doc for this type.

Arn string

ARN of the organizational unit

Id string

ID of the organizational unit

Name string

Name of the organizational unit

Arn string

ARN of the organizational unit

Id string

ID of the organizational unit

Name string

Name of the organizational unit

arn string

ARN of the organizational unit

id string

ID of the organizational unit

name string

Name of the organizational unit

arn str

ARN of the organizational unit

id str

ID of the organizational unit

name str

Name of the organizational unit

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.