Skip to main content

resource_policies

Creates, updates, deletes or gets a resource_policy resource or lists resource_policies in a region

Overview

Nameresource_policies
TypeResource
DescriptionThis schema provides construct and validation rules for AWS-XRay Resource Policy resource parameters.
Idaws.xray.resource_policies

Fields

NameDatatypeDescription
policy_namestringThe name of the resource policy. Must be unique within a specific AWS account.
policy_documentstringThe resource policy document, which can be up to 5kb in size.
bypass_policy_lockout_checkbooleanA flag to indicate whether to bypass the resource policy lockout safety check
regionstringAWS region.

Methods

NameAccessible byRequired Params
create_resourceINSERTPolicyName, PolicyDocument, region
delete_resourceDELETEdata__Identifier, region
update_resourceUPDATEdata__Identifier, data__PatchDocument, region
list_resourcesSELECTregion
get_resourceSELECTdata__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.

/*+ create */
INSERT INTO aws.xray.resource_policies (
PolicyName,
PolicyDocument,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyDocument }}',
'{{ region }}';

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