Viewing docs for AWS v5.43.0 (Older version)
published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
Viewing docs for AWS v5.43.0 (Older version)
published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
Get all direct child organizational units under a parent organizational unit. This only provides immediate children, not all children.
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var org = Aws.Organizations.GetOrganization.Invoke();
var ou = Aws.Organizations.GetOrganizationalUnits.Invoke(new()
{
ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
});
});
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v5/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, 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
})
}
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.GetOrganizationalUnitsArgs;
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();
final var ou = OrganizationsFunctions.getOrganizationalUnits(GetOrganizationalUnitsArgs.builder()
.parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
.build());
}
}
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,
}));
import pulumi
import pulumi_aws as aws
org = aws.organizations.get_organization()
ou = aws.organizations.get_organizational_units(parent_id=org.roots[0].id)
variables:
org:
fn::invoke:
Function: aws:organizations:getOrganization
Arguments: {}
ou:
fn::invoke:
Function: aws:organizations:getOrganizationalUnits
Arguments:
parentId: ${org.roots[0].id}
Using getOrganizationalUnits
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 getOrganizationalUnits(args: GetOrganizationalUnitsArgs, opts?: InvokeOptions): Promise<GetOrganizationalUnitsResult>
function getOrganizationalUnitsOutput(args: GetOrganizationalUnitsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationalUnitsResult>def get_organizational_units(parent_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetOrganizationalUnitsResult
def get_organizational_units_output(parent_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationalUnitsResult]func GetOrganizationalUnits(ctx *Context, args *GetOrganizationalUnitsArgs, opts ...InvokeOption) (*GetOrganizationalUnitsResult, error)
func GetOrganizationalUnitsOutput(ctx *Context, args *GetOrganizationalUnitsOutputArgs, opts ...InvokeOption) GetOrganizationalUnitsResultOutput> Note: This function is named GetOrganizationalUnits in the Go SDK.
public static class GetOrganizationalUnits
{
public static Task<GetOrganizationalUnitsResult> InvokeAsync(GetOrganizationalUnitsArgs args, InvokeOptions? opts = null)
public static Output<GetOrganizationalUnitsResult> Invoke(GetOrganizationalUnitsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetOrganizationalUnitsResult> getOrganizationalUnits(GetOrganizationalUnitsArgs args, InvokeOptions options)
public static Output<GetOrganizationalUnitsResult> getOrganizationalUnits(GetOrganizationalUnitsArgs args, InvokeOptions options)
fn::invoke:
function: aws:organizations/getOrganizationalUnits:getOrganizationalUnits
arguments:
# arguments dictionaryThe following arguments are supported:
- Parent
Id string - Parent ID of the organizational unit.
- Parent
Id string - Parent ID of the organizational unit.
- parent
Id String - Parent ID of the organizational unit.
- parent
Id string - Parent ID of the organizational unit.
- parent_
id str - Parent ID of the organizational unit.
- parent
Id String - Parent ID of the organizational unit.
getOrganizationalUnits Result
The following output properties are available:
- Childrens
List<Get
Organizational Units Children> - List of child organizational units, which have the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Parent
Id string
- Childrens
[]Get
Organizational Units Children - List of child organizational units, which have the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Parent
Id string
- childrens
List<Get
Organizational Units Children> - List of child organizational units, which have the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- parent
Id String
- childrens
Get
Organizational Units Children[] - List of child organizational units, which have the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- parent
Id string
- childrens
Sequence[Get
Organizational Units Children] - 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.
- parent
Id String
Supporting Types
GetOrganizationalUnitsChildren
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
Viewing docs for AWS v5.43.0 (Older version)
published on Tuesday, Mar 10, 2026 by Pulumi
published on Tuesday, Mar 10, 2026 by Pulumi
