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
DescriptionThe resource schema for AWSLogs ResourcePolicy
Idaws.logs.resource_policies

Fields

NameDatatypeDescription
policy_namestringA name for resource policy
policy_documentstringThe policy document
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
FROM aws.logs.resource_policies
WHERE region = 'us-east-1';

Gets all properties from an individual resource_policy.

SELECT
region,
policy_name,
policy_document
FROM aws.logs.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.logs.resource_policies (
PolicyName,
PolicyDocument,
region
)
SELECT
'{{ PolicyName }}',
'{{ PolicyDocument }}',
'{{ region }}';

DELETE example

/*+ delete */
DELETE FROM aws.logs.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

logs:PutResourcePolicy,
logs:DescribeResourcePolicies

Read

logs:DescribeResourcePolicies

Update

logs:PutResourcePolicy,
logs:DescribeResourcePolicies,
logs:DeleteResourcePolicy

Delete

logs:DeleteResourcePolicy

List

logs:DescribeResourcePolicies