aws.organizations.OrganizationalUnit
Explore with Pulumi AI
Provides a resource to create an organizational unit.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const example = new aws.organizations.OrganizationalUnit("example", {
name: "example",
parentId: exampleAwsOrganizationsOrganization.roots[0].id,
});
import pulumi
import pulumi_aws as aws
example = aws.organizations.OrganizationalUnit("example",
name="example",
parent_id=example_aws_organizations_organization["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 {
_, err := organizations.NewOrganizationalUnit(ctx, "example", &organizations.OrganizationalUnitArgs{
Name: pulumi.String("example"),
ParentId: pulumi.Any(exampleAwsOrganizationsOrganization.Roots[0].Id),
})
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 example = new Aws.Organizations.OrganizationalUnit("example", new()
{
Name = "example",
ParentId = exampleAwsOrganizationsOrganization.Roots[0].Id,
});
});
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()
.name("example")
.parentId(exampleAwsOrganizationsOrganization.roots()[0].id())
.build());
}
}
resources:
example:
type: aws:organizations:OrganizationalUnit
properties:
name: example
parentId: ${exampleAwsOrganizationsOrganization.roots[0].id}
Create OrganizationalUnit Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new OrganizationalUnit(name: string, args: OrganizationalUnitArgs, opts?: CustomResourceOptions);
@overload
def OrganizationalUnit(resource_name: str,
args: OrganizationalUnitArgs,
opts: Optional[ResourceOptions] = None)
@overload
def OrganizationalUnit(resource_name: str,
opts: Optional[ResourceOptions] = None,
parent_id: Optional[str] = None,
name: Optional[str] = None,
tags: Optional[Mapping[str, str]] = 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.
Parameters
- 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.
Constructor example
The following reference example uses placeholder values for all input properties.
var organizationalUnitResource = new Aws.Organizations.OrganizationalUnit("organizationalUnitResource", new()
{
ParentId = "string",
Name = "string",
Tags =
{
{ "string", "string" },
},
});
example, err := organizations.NewOrganizationalUnit(ctx, "organizationalUnitResource", &organizations.OrganizationalUnitArgs{
ParentId: pulumi.String("string"),
Name: pulumi.String("string"),
Tags: pulumi.StringMap{
"string": pulumi.String("string"),
},
})
var organizationalUnitResource = new OrganizationalUnit("organizationalUnitResource", OrganizationalUnitArgs.builder()
.parentId("string")
.name("string")
.tags(Map.of("string", "string"))
.build());
organizational_unit_resource = aws.organizations.OrganizationalUnit("organizationalUnitResource",
parent_id="string",
name="string",
tags={
"string": "string",
})
const organizationalUnitResource = new aws.organizations.OrganizationalUnit("organizationalUnitResource", {
parentId: "string",
name: "string",
tags: {
string: "string",
},
});
type: aws:organizations:OrganizationalUnit
properties:
name: string
parentId: string
tags:
string: string
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:
- Parent
Id string - ID of the parent organizational unit, which may be the root
- Name string
- The name for the organizational unit
- 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.
- Parent
Id string - ID of the parent organizational unit, which may be the root
- Name string
- The name for the organizational unit
- 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.
- parent
Id String - ID of the parent organizational unit, which may be the root
- name String
- The name for the organizational unit
- 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.
- parent
Id string - ID of the parent organizational unit, which may be the root
- name string
- The name for the organizational unit
- {[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
- 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.
- parent
Id String - ID of the parent organizational unit, which may be the root
- name String
- The name for the organizational unit
- 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<Organizational
Unit Account> - 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.
- Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Accounts
[]Organizational
Unit Account - 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.
- map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
List<Organizational
Unit Account> - 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.
- Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
Organizational
Unit Account[] - 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.
- {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
Sequence[Organizational
Unit Account] - 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.
- 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.
- 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.
- Accounts
List<Organizational
Unit Account> - 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
- Parent
Id string - ID of the parent organizational unit, which may be the root
- 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. - Dictionary<string, string>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- Accounts
[]Organizational
Unit Account Args - 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
- Parent
Id string - ID of the parent organizational unit, which may be the root
- 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. - map[string]string
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
List<Organizational
Unit Account> - 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
- parent
Id String - ID of the parent organizational unit, which may be the root
- 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. - Map<String,String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
Organizational
Unit Account[] - 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
- parent
Id string - ID of the parent organizational unit, which may be the root
- {[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. - {[key: string]: string}
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
- accounts
Sequence[Organizational
Unit Account Args] - 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
- 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. - 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
- parent
Id String - ID of the parent organizational unit, which may be the root
- 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. - Map<String>
- A map of tags assigned to the resource, including those inherited from the provider
default_tags
configuration block.
Supporting Types
OrganizationalUnitAccount, OrganizationalUnitAccountArgs
Import
Using pulumi import
, import AWS Organizations Organizational Units using the id
. For example:
$ pulumi import aws:organizations/organizationalUnit:OrganizationalUnit example ou-1234567
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.