policies
Creates, updates, deletes or gets a policy
resource or lists policies
in a region
Overview
Name | policies |
Type | Resource |
Description | Policies in AWS Organizations enable you to manage different features of the AWS accounts in your organization. You can use policies when all features are enabled in your organization. |
Id | aws.organizations.policies |
Fields
Name | Datatype | Description |
---|---|---|
name | string | Name of the Policy |
type | string | The type of policy to create. You can specify one of the following values: AISERVICES_OPT_OUT_POLICY, BACKUP_POLICY, SERVICE_CONTROL_POLICY, TAG_POLICY |
content | object | The Policy text content. For AWS CloudFormation templates formatted in YAML, you can provide the policy in JSON or YAML format. AWS CloudFormation always converts a YAML policy to JSON format before submitting it. |
description | string | Human readable description of the policy |
target_ids | array | List of unique identifiers (IDs) of the root, OU, or account that you want to attach the policy to |
tags | array | A list of tags that you want to attach to the newly created policy. For each tag in the list, you must specify both a tag key and a value. You can set the value to an empty string, but you can't set it to null. |
id | string | Id of the Policy |
arn | string | ARN of the Policy |
aws_managed | boolean | A boolean value that indicates whether the specified policy is an AWS managed policy. If true, then you can attach the policy to roots, OUs, or accounts, but you cannot edit it. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | Name, Type, Content, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all policies
in a region.
SELECT
region,
name,
type,
content,
description,
target_ids,
tags,
id,
arn,
aws_managed
FROM aws.organizations.policies
WHERE region = 'us-east-1';
Gets all properties from an individual policy
.
SELECT
region,
name,
type,
content,
description,
target_ids,
tags,
id,
arn,
aws_managed
FROM aws.organizations.policies
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';
INSERT
example
Use the following StackQL query and manifest file to create a new policy
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.organizations.policies (
Name,
Type,
Content,
region
)
SELECT
'{{ Name }}',
'{{ Type }}',
'{{ Content }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.organizations.policies (
Name,
Type,
Content,
Description,
TargetIds,
Tags,
region
)
SELECT
'{{ Name }}',
'{{ Type }}',
'{{ Content }}',
'{{ Description }}',
'{{ TargetIds }}',
'{{ Tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: policy
props:
- name: Name
value: '{{ Name }}'
- name: Type
value: '{{ Type }}'
- name: Content
value: {}
- name: Description
value: '{{ Description }}'
- name: TargetIds
value:
- '{{ TargetIds[0] }}'
- name: Tags
value:
- Key: '{{ Key }}'
Value: '{{ Value }}'
DELETE
example
/*+ delete */
DELETE FROM aws.organizations.policies
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the policies
resource, the following permissions are required:
Create
organizations:CreatePolicy,
organizations:DescribePolicy,
organizations:AttachPolicy,
organizations:ListTagsForResource,
organizations:ListTargetsForPolicy,
organizations:TagResource
Read
organizations:DescribePolicy,
organizations:ListTargetsForPolicy,
organizations:ListTagsForResource
Update
organizations:AttachPolicy,
organizations:DetachPolicy,
organizations:UpdatePolicy,
organizations:ListTagsForResource,
organizations:ListTargetsForPolicy,
organizations:TagResource,
organizations:UntagResource,
organizations:DescribePolicy
Delete
organizations:DetachPolicy,
organizations:DeletePolicy
List
organizations:ListPolicies