organizational_units
Creates, updates, deletes or gets an organizational_unit resource or lists organizational_units in a region
Overview
| Name | organizational_units |
| Type | Resource |
| Description | You can use organizational units (OUs) to group accounts together to administer as a single unit. This greatly simplifies the management of your accounts. For example, you can attach a policy-based control to an OU, and all accounts within the OU automatically inherit the policy. You can create multiple OUs within a single organization, and you can create OUs within other OUs. Each OU can contain multiple accounts, and you can move accounts from one OU to another. However, OU names must be unique within a parent OU or root. |
| Id | awscc.organizations.organizational_units |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
arn | string | The Amazon Resource Name (ARN) of this OU. |
id | string | The unique identifier (ID) associated with this OU. |
name | string | The friendly name of this OU. |
parent_id | string | The unique identifier (ID) of the parent root or OU that you want to create the new OU in. |
tags | array | A list of tags that you want to attach to the newly created OU. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
id | string | The unique identifier (ID) associated with this OU. |
region | string | AWS region. |
For more information, see AWS::Organizations::OrganizationalUnit.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | organizational_units | INSERT | Name, ParentId, region |
delete_resource | organizational_units | DELETE | Identifier, region |
update_resource | organizational_units | UPDATE | Identifier, PatchDocument, region |
list_resources | organizational_units_list_only | SELECT | region |
get_resource | organizational_units | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual organizational_unit.
SELECT
region,
arn,
id,
name,
parent_id,
tags
FROM awscc.organizations.organizational_units
WHERE
region = 'us-east-1' AND
Identifier = '{{ id }}';
Lists all organizational_units in a region.
SELECT
region,
id
FROM awscc.organizations.organizational_units_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new organizational_unit resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.organizations.organizational_units (
Name,
ParentId,
region
)
SELECT
'{{ name }}',
'{{ parent_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ create */
INSERT INTO awscc.organizations.organizational_units (
Name,
ParentId,
Tags,
region
)
SELECT
'{{ name }}',
'{{ parent_id }}',
'{{ tags }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: organizational_unit
props:
- name: name
value: '{{ name }}'
- name: parent_id
value: '{{ parent_id }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
UPDATE example
Use the following StackQL query and manifest file to update a organizational_unit resource, using stack-deploy.
/*+ update */
UPDATE awscc.organizations.organizational_units
SET PatchDocument = string('{{ {
"Name": name,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ id }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.organizations.organizational_units
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
Permissions
To operate on the organizational_units resource, the following permissions are required:
- Create
- Read
- Update
- Delete
- List
organizations:CreateOrganizationalUnit,
organizations:DescribeOrganizationalUnit,
organizations:ListParents,
organizations:ListOrganizationalUnitsForParent,
organizations:ListTagsForResource,
organizations:TagResource
organizations:DescribeOrganizationalUnit,
organizations:ListParents,
organizations:ListTagsForResource
organizations:DescribeOrganizationalUnit,
organizations:ListParents,
organizations:ListTagsForResource,
organizations:TagResource,
organizations:UntagResource,
organizations:UpdateOrganizationalUnit
organizations:DeleteOrganizationalUnit
organizations:ListOrganizationalUnitsForParent