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 }}';
/*+ create */
INSERT INTO awscc.organizations.organizational_units (
Name,
ParentId,
Tags,
region
)
SELECT
'{{ name }}',
'{{ parent_id }}',
'{{ tags }}',
'{{ region }}';
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.organizations.organizational_units
WHERE
Identifier = '{{ id }}' AND
region = 'us-east-1';
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