1. Packages
  2. AWS
  3. API Docs
  4. organizations
  5. getOrganizationalUnitDescendantOrganizationalUnits
AWS v6.77.0 published on Wednesday, Apr 9, 2025 by Pulumi

aws.organizations.getOrganizationalUnitDescendantOrganizationalUnits

Explore with Pulumi AI

Get all direct child organizational units under a parent organizational unit. This provides all children.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const org = aws.organizations.getOrganization({});
const ous = org.then(org => aws.organizations.getOrganizationalUnitDescendantOrganizationalUnits({
    parentId: org.roots?.[0]?.id,
}));
Copy
import pulumi
import pulumi_aws as aws

org = aws.organizations.get_organization()
ous = aws.organizations.get_organizational_unit_descendant_organizational_units(parent_id=org.roots[0].id)
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		org, err := organizations.LookupOrganization(ctx, map[string]interface{}{}, nil)
		if err != nil {
			return err
		}
		_, err = organizations.GetOrganizationalUnitDescendantOrganizationalUnits(ctx, &organizations.GetOrganizationalUnitDescendantOrganizationalUnitsArgs{
			ParentId: org.Roots[0].Id,
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var org = Aws.Organizations.GetOrganization.Invoke();

    var ous = Aws.Organizations.GetOrganizationalUnitDescendantOrganizationalUnits.Invoke(new()
    {
        ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.organizations.OrganizationsFunctions;
import com.pulumi.aws.organizations.inputs.GetOrganizationalUnitDescendantOrganizationalUnitsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var org = OrganizationsFunctions.getOrganization(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference);

        final var ous = OrganizationsFunctions.getOrganizationalUnitDescendantOrganizationalUnits(GetOrganizationalUnitDescendantOrganizationalUnitsArgs.builder()
            .parentId(org.roots()[0].id())
            .build());

    }
}
Copy
variables:
  org:
    fn::invoke:
      function: aws:organizations:getOrganization
      arguments: {}
  ous:
    fn::invoke:
      function: aws:organizations:getOrganizationalUnitDescendantOrganizationalUnits
      arguments:
        parentId: ${org.roots[0].id}
Copy

Using getOrganizationalUnitDescendantOrganizationalUnits

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getOrganizationalUnitDescendantOrganizationalUnits(args: GetOrganizationalUnitDescendantOrganizationalUnitsArgs, opts?: InvokeOptions): Promise<GetOrganizationalUnitDescendantOrganizationalUnitsResult>
function getOrganizationalUnitDescendantOrganizationalUnitsOutput(args: GetOrganizationalUnitDescendantOrganizationalUnitsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationalUnitDescendantOrganizationalUnitsResult>
Copy
def get_organizational_unit_descendant_organizational_units(parent_id: Optional[str] = None,
                                                            opts: Optional[InvokeOptions] = None) -> GetOrganizationalUnitDescendantOrganizationalUnitsResult
def get_organizational_unit_descendant_organizational_units_output(parent_id: Optional[pulumi.Input[str]] = None,
                                                            opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationalUnitDescendantOrganizationalUnitsResult]
Copy
func GetOrganizationalUnitDescendantOrganizationalUnits(ctx *Context, args *GetOrganizationalUnitDescendantOrganizationalUnitsArgs, opts ...InvokeOption) (*GetOrganizationalUnitDescendantOrganizationalUnitsResult, error)
func GetOrganizationalUnitDescendantOrganizationalUnitsOutput(ctx *Context, args *GetOrganizationalUnitDescendantOrganizationalUnitsOutputArgs, opts ...InvokeOption) GetOrganizationalUnitDescendantOrganizationalUnitsResultOutput
Copy

> Note: This function is named GetOrganizationalUnitDescendantOrganizationalUnits in the Go SDK.

public static class GetOrganizationalUnitDescendantOrganizationalUnits 
{
    public static Task<GetOrganizationalUnitDescendantOrganizationalUnitsResult> InvokeAsync(GetOrganizationalUnitDescendantOrganizationalUnitsArgs args, InvokeOptions? opts = null)
    public static Output<GetOrganizationalUnitDescendantOrganizationalUnitsResult> Invoke(GetOrganizationalUnitDescendantOrganizationalUnitsInvokeArgs args, InvokeOptions? opts = null)
}
Copy
public static CompletableFuture<GetOrganizationalUnitDescendantOrganizationalUnitsResult> getOrganizationalUnitDescendantOrganizationalUnits(GetOrganizationalUnitDescendantOrganizationalUnitsArgs args, InvokeOptions options)
public static Output<GetOrganizationalUnitDescendantOrganizationalUnitsResult> getOrganizationalUnitDescendantOrganizationalUnits(GetOrganizationalUnitDescendantOrganizationalUnitsArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: aws:organizations/getOrganizationalUnitDescendantOrganizationalUnits:getOrganizationalUnitDescendantOrganizationalUnits
  arguments:
    # arguments dictionary
Copy

The following arguments are supported:

ParentId This property is required. string
Parent ID of the organizational unit.
ParentId This property is required. string
Parent ID of the organizational unit.
parentId This property is required. String
Parent ID of the organizational unit.
parentId This property is required. string
Parent ID of the organizational unit.
parent_id This property is required. str
Parent ID of the organizational unit.
parentId This property is required. String
Parent ID of the organizational unit.

getOrganizationalUnitDescendantOrganizationalUnits Result

The following output properties are available:

Childrens List<GetOrganizationalUnitDescendantOrganizationalUnitsChildren>
List of child organizational units, which have the following attributes:
Id string
The provider-assigned unique ID for this managed resource.
ParentId string
Childrens []GetOrganizationalUnitDescendantOrganizationalUnitsChildren
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<GetOrganizationalUnitDescendantOrganizationalUnitsChildren>
List of child organizational units, which have the following attributes:
id String
The provider-assigned unique ID for this managed resource.
parentId String
childrens GetOrganizationalUnitDescendantOrganizationalUnitsChildren[]
List of child organizational units, which have the following attributes:
id string
The provider-assigned unique ID for this managed resource.
parentId string
childrens Sequence[GetOrganizationalUnitDescendantOrganizationalUnitsChildren]
List of child organizational units, which have the following attributes:
id str
The provider-assigned unique ID for this managed resource.
parent_id str
childrens List<Property Map>
List of child organizational units, which have the following attributes:
id String
The provider-assigned unique ID for this managed resource.
parentId String

Supporting Types

GetOrganizationalUnitDescendantOrganizationalUnitsChildren

Arn This property is required. string
ARN of the organizational unit
Id This property is required. string
Parent identifier of the organizational units.
Name This property is required. string
Name of the organizational unit
Arn This property is required. string
ARN of the organizational unit
Id This property is required. string
Parent identifier of the organizational units.
Name This property is required. string
Name of the organizational unit
arn This property is required. String
ARN of the organizational unit
id This property is required. String
Parent identifier of the organizational units.
name This property is required. String
Name of the organizational unit
arn This property is required. string
ARN of the organizational unit
id This property is required. string
Parent identifier of the organizational units.
name This property is required. string
Name of the organizational unit
arn This property is required. str
ARN of the organizational unit
id This property is required. str
Parent identifier of the organizational units.
name This property is required. str
Name of the organizational unit
arn This property is required. String
ARN of the organizational unit
id This property is required. String
Parent identifier of the organizational units.
name This property is required. String
Name of the organizational unit

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes
This Pulumi package is based on the aws Terraform Provider.