aws logo
AWS Classic v5.41.0, May 15 23

aws.organizations.OrganizationalUnit

Explore with Pulumi AI

Provides a resource to create an organizational unit.

Example Usage

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;

return await Deployment.RunAsync(() => 
{
    var example = new Aws.Organizations.OrganizationalUnit("example", new()
    {
        ParentId = aws_organizations_organization.Example.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 {
		_, err := organizations.NewOrganizationalUnit(ctx, "example", &organizations.OrganizationalUnitArgs{
			ParentId: pulumi.Any(aws_organizations_organization.Example.Roots[0].Id),
		})
		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.OrganizationalUnit;
import com.pulumi.aws.organizations.OrganizationalUnitArgs;
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) {
        var example = new OrganizationalUnit("example", OrganizationalUnitArgs.builder()        
            .parentId(aws_organizations_organization.example().roots()[0].id())
            .build());

    }
}
import pulumi
import pulumi_aws as aws

example = aws.organizations.OrganizationalUnit("example", parent_id=aws_organizations_organization["example"]["roots"][0]["id"])
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const example = new aws.organizations.OrganizationalUnit("example", {parentId: aws_organizations_organization.example.roots[0].id});
resources:
  example:
    type: aws:organizations:OrganizationalUnit
    properties:
      parentId: ${aws_organizations_organization.example.roots[0].id}

Create OrganizationalUnit Resource

new OrganizationalUnit(name: string, args: OrganizationalUnitArgs, opts?: CustomResourceOptions);
@overload
def OrganizationalUnit(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       name: Optional[str] = None,
                       parent_id: Optional[str] = None,
                       tags: Optional[Mapping[str, str]] = None)
@overload
def OrganizationalUnit(resource_name: str,
                       args: OrganizationalUnitArgs,
                       opts: Optional[ResourceOptions] = None)
func NewOrganizationalUnit(ctx *Context, name string, args OrganizationalUnitArgs, opts ...ResourceOption) (*OrganizationalUnit, error)
public OrganizationalUnit(string name, OrganizationalUnitArgs args, CustomResourceOptions? opts = null)
public OrganizationalUnit(String name, OrganizationalUnitArgs args)
public OrganizationalUnit(String name, OrganizationalUnitArgs args, CustomResourceOptions options)
type: aws:organizations:OrganizationalUnit
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args OrganizationalUnitArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args OrganizationalUnitArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args OrganizationalUnitArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args OrganizationalUnitArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args OrganizationalUnitArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

OrganizationalUnit Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The OrganizationalUnit resource accepts the following input properties:

ParentId string

ID of the parent organizational unit, which may be the root

Name string

The name for the organizational unit

Tags Dictionary<string, string>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

ParentId string

ID of the parent organizational unit, which may be the root

Name string

The name for the organizational unit

Tags map[string]string

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

parentId String

ID of the parent organizational unit, which may be the root

name String

The name for the organizational unit

tags Map<String,String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

parentId string

ID of the parent organizational unit, which may be the root

name string

The name for the organizational unit

tags {[key: string]: string}

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

parent_id str

ID of the parent organizational unit, which may be the root

name str

The name for the organizational unit

tags Mapping[str, str]

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

parentId String

ID of the parent organizational unit, which may be the root

name String

The name for the organizational unit

tags Map<String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

Outputs

All input properties are implicitly available as output properties. Additionally, the OrganizationalUnit resource produces the following output properties:

Accounts List<OrganizationalUnitAccount>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

Arn string

ARN of the organizational unit

Id string

The provider-assigned unique ID for this managed resource.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Accounts []OrganizationalUnitAccount

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

Arn string

ARN of the organizational unit

Id string

The provider-assigned unique ID for this managed resource.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts List<OrganizationalUnitAccount>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn String

ARN of the organizational unit

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts OrganizationalUnitAccount[]

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn string

ARN of the organizational unit

id string

The provider-assigned unique ID for this managed resource.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts Sequence[OrganizationalUnitAccount]

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn str

ARN of the organizational unit

id str

The provider-assigned unique ID for this managed resource.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts List<Property Map>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn String

ARN of the organizational unit

id String

The provider-assigned unique ID for this managed resource.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Look up Existing OrganizationalUnit Resource

Get an existing OrganizationalUnit resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: OrganizationalUnitState, opts?: CustomResourceOptions): OrganizationalUnit
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        accounts: Optional[Sequence[OrganizationalUnitAccountArgs]] = None,
        arn: Optional[str] = None,
        name: Optional[str] = None,
        parent_id: Optional[str] = None,
        tags: Optional[Mapping[str, str]] = None,
        tags_all: Optional[Mapping[str, str]] = None) -> OrganizationalUnit
func GetOrganizationalUnit(ctx *Context, name string, id IDInput, state *OrganizationalUnitState, opts ...ResourceOption) (*OrganizationalUnit, error)
public static OrganizationalUnit Get(string name, Input<string> id, OrganizationalUnitState? state, CustomResourceOptions? opts = null)
public static OrganizationalUnit get(String name, Output<String> id, OrganizationalUnitState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Accounts List<OrganizationalUnitAccountArgs>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

Arn string

ARN of the organizational unit

Name string

The name for the organizational unit

ParentId string

ID of the parent organizational unit, which may be the root

Tags Dictionary<string, string>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll Dictionary<string, string>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Accounts []OrganizationalUnitAccountArgs

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

Arn string

ARN of the organizational unit

Name string

The name for the organizational unit

ParentId string

ID of the parent organizational unit, which may be the root

Tags map[string]string

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

TagsAll map[string]string

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts List<OrganizationalUnitAccountArgs>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn String

ARN of the organizational unit

name String

The name for the organizational unit

parentId String

ID of the parent organizational unit, which may be the root

tags Map<String,String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String,String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts OrganizationalUnitAccountArgs[]

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn string

ARN of the organizational unit

name string

The name for the organizational unit

parentId string

ID of the parent organizational unit, which may be the root

tags {[key: string]: string}

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll {[key: string]: string}

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts Sequence[OrganizationalUnitAccountArgs]

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn str

ARN of the organizational unit

name str

The name for the organizational unit

parent_id str

ID of the parent organizational unit, which may be the root

tags Mapping[str, str]

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tags_all Mapping[str, str]

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

accounts List<Property Map>

List of child accounts for this Organizational Unit. Does not return account information for child Organizational Units. All elements have these attributes:

arn String

ARN of the organizational unit

name String

The name for the organizational unit

parentId String

ID of the parent organizational unit, which may be the root

tags Map<String>

Key-value map of resource tags. .If configured with a provider default_tags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

tagsAll Map<String>

A map of tags assigned to the resource, including those inherited from the provider default_tags configuration block.

Supporting Types

OrganizationalUnitAccount

Arn string

ARN of the organizational unit

Email string

Email of the account

Id string

Identifier of the organization unit

Name string

The name for the organizational unit

Arn string

ARN of the organizational unit

Email string

Email of the account

Id string

Identifier of the organization unit

Name string

The name for the organizational unit

arn String

ARN of the organizational unit

email String

Email of the account

id String

Identifier of the organization unit

name String

The name for the organizational unit

arn string

ARN of the organizational unit

email string

Email of the account

id string

Identifier of the organization unit

name string

The name for the organizational unit

arn str

ARN of the organizational unit

email str

Email of the account

id str

Identifier of the organization unit

name str

The name for the organizational unit

arn String

ARN of the organizational unit

email String

Email of the account

id String

Identifier of the organization unit

name String

The name for the organizational unit

Import

AWS Organizations Organizational Units can be imported by using the id, e.g.,

 $ pulumi import aws:organizations/organizationalUnit:OrganizationalUnit example ou-1234567

Package Details

Repository
AWS Classic pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.