AWS v6.60.0 published on Tuesday, Nov 19, 2024 by Pulumi
aws.organizations.getOrganizationalUnitChildAccounts
Explore with Pulumi AI
Get all direct child accounts under a parent organizational unit. This only provides immediate children, not all children.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const org = aws.organizations.getOrganization({});
const accounts = org.then(org => aws.organizations.getOrganizationalUnitChildAccounts({
parentId: org.roots?.[0]?.id,
}));
import pulumi
import pulumi_aws as aws
org = aws.organizations.get_organization()
accounts = aws.organizations.get_organizational_unit_child_accounts(parent_id=org.roots[0].id)
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.GetOrganizationalUnitChildAccounts(ctx, &organizations.GetOrganizationalUnitChildAccountsArgs{
ParentId: org.Roots[0].Id,
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var org = Aws.Organizations.GetOrganization.Invoke();
var accounts = Aws.Organizations.GetOrganizationalUnitChildAccounts.Invoke(new()
{
ParentId = org.Apply(getOrganizationResult => getOrganizationResult.Roots[0]?.Id),
});
});
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.GetOrganizationalUnitChildAccountsArgs;
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 accounts = OrganizationsFunctions.getOrganizationalUnitChildAccounts(GetOrganizationalUnitChildAccountsArgs.builder()
.parentId(org.applyValue(getOrganizationResult -> getOrganizationResult.roots()[0].id()))
.build());
}
}
variables:
org:
fn::invoke:
Function: aws:organizations:getOrganization
Arguments: {}
accounts:
fn::invoke:
Function: aws:organizations:getOrganizationalUnitChildAccounts
Arguments:
parentId: ${org.roots[0].id}
Using getOrganizationalUnitChildAccounts
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 getOrganizationalUnitChildAccounts(args: GetOrganizationalUnitChildAccountsArgs, opts?: InvokeOptions): Promise<GetOrganizationalUnitChildAccountsResult>
function getOrganizationalUnitChildAccountsOutput(args: GetOrganizationalUnitChildAccountsOutputArgs, opts?: InvokeOptions): Output<GetOrganizationalUnitChildAccountsResult>
def get_organizational_unit_child_accounts(parent_id: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetOrganizationalUnitChildAccountsResult
def get_organizational_unit_child_accounts_output(parent_id: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetOrganizationalUnitChildAccountsResult]
func GetOrganizationalUnitChildAccounts(ctx *Context, args *GetOrganizationalUnitChildAccountsArgs, opts ...InvokeOption) (*GetOrganizationalUnitChildAccountsResult, error)
func GetOrganizationalUnitChildAccountsOutput(ctx *Context, args *GetOrganizationalUnitChildAccountsOutputArgs, opts ...InvokeOption) GetOrganizationalUnitChildAccountsResultOutput
> Note: This function is named GetOrganizationalUnitChildAccounts
in the Go SDK.
public static class GetOrganizationalUnitChildAccounts
{
public static Task<GetOrganizationalUnitChildAccountsResult> InvokeAsync(GetOrganizationalUnitChildAccountsArgs args, InvokeOptions? opts = null)
public static Output<GetOrganizationalUnitChildAccountsResult> Invoke(GetOrganizationalUnitChildAccountsInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetOrganizationalUnitChildAccountsResult> getOrganizationalUnitChildAccounts(GetOrganizationalUnitChildAccountsArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws:organizations/getOrganizationalUnitChildAccounts:getOrganizationalUnitChildAccounts
arguments:
# arguments dictionary
The following arguments are supported:
- Parent
Id string - The parent ID of the accounts.
- Parent
Id string - The parent ID of the accounts.
- parent
Id String - The parent ID of the accounts.
- parent
Id string - The parent ID of the accounts.
- parent_
id str - The parent ID of the accounts.
- parent
Id String - The parent ID of the accounts.
getOrganizationalUnitChildAccounts Result
The following output properties are available:
- Accounts
List<Get
Organizational Unit Child Accounts Account> - List of child accounts, which have the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Parent
Id string
- Accounts
[]Get
Organizational Unit Child Accounts Account - List of child accounts, which have the following attributes:
- Id string
- The provider-assigned unique ID for this managed resource.
- Parent
Id string
- accounts
List<Get
Organizational Unit Child Accounts Account> - List of child accounts, which have the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- parent
Id String
- accounts
Get
Organizational Unit Child Accounts Account[] - List of child accounts, which have the following attributes:
- id string
- The provider-assigned unique ID for this managed resource.
- parent
Id string
- accounts
Sequence[Get
Organizational Unit Child Accounts Account] - List of child accounts, which have the following attributes:
- id str
- The provider-assigned unique ID for this managed resource.
- parent_
id str
- accounts List<Property Map>
- List of child accounts, which have the following attributes:
- id String
- The provider-assigned unique ID for this managed resource.
- parent
Id String
Supporting Types
GetOrganizationalUnitChildAccountsAccount
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.