resource_policies
Creates, updates, deletes or gets a resource_policy
resource or lists resource_policies
in a region
Overview
Name | resource_policies |
Type | Resource |
Description | This schema provides construct and validation rules for AWS-XRay Resource Policy resource parameters. |
Id | aws.xray.resource_policies |
Fields
Name | Datatype | Description |
---|---|---|
policy_name | string | The name of the resource policy. Must be unique within a specific AWS account. |
policy_document | string | The resource policy document, which can be up to 5kb in size. |
bypass_policy_lockout_check | boolean | A flag to indicate whether to bypass the resource policy lockout safety check |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | PolicyName, PolicyDocument, 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 resource_policies
in a region.
SELECT
region,
policy_name,
policy_document,
bypass_policy_lockout_check
FROM aws.xray.resource_policies
WHERE region = 'us-east-1';
Gets all properties from an individual resource_policy
.
SELECT
region,
policy_name,
policy_document,
bypass_policy_lockout_check
FROM aws.xray.resource_policies
WHERE region = 'us-east-1' AND data__Identifier = '<PolicyName>';
INSERT
example
Use the following StackQL query and manifest file to create a new resource_policy
resource, using stack-deploy
.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO aws.xray.resource_policies (
PolicyName,
PolicyDocument,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyDocument }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.xray.resource_policies (
PolicyName,
PolicyDocument,
BypassPolicyLockoutCheck,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyDocument }}',
'{{ BypassPolicyLockoutCheck }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: resource_policy
props:
- name: PolicyName
value: '{{ PolicyName }}'
- name: PolicyDocument
value: '{{ PolicyDocument }}'
- name: BypassPolicyLockoutCheck
value: '{{ BypassPolicyLockoutCheck }}'
DELETE
example
/*+ delete */
DELETE FROM aws.xray.resource_policies
WHERE data__Identifier = '<PolicyName>'
AND region = 'us-east-1';
Permissions
To operate on the resource_policies
resource, the following permissions are required:
Create
xray:PutResourcePolicy,
xray:ListResourcePolicies
Read
xray:ListResourcePolicies
Update
xray:PutResourcePolicy,
xray:ListResourcePolicies
Delete
xray:DeleteResourcePolicy
List
xray:ListResourcePolicies