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 | Resource Type definition for AWS::SecretsManager::ResourcePolicy |
Id | aws.secretsmanager.resource_policies |
Fields
Name | Datatype | Description |
---|---|---|
id | string | The Arn of the secret. |
secret_id | string | The ARN or name of the secret to attach the resource-based policy. |
resource_policy | object | A JSON-formatted string for an AWS resource-based policy. |
block_public_policy | boolean | Specifies whether to block resource-based policies that allow broad access to the secret. |
region | string | AWS region. |
For more information, see AWS::SecretsManager::ResourcePolicy
.
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | ResourcePolicy, SecretId, 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,
id,
secret_id,
resource_policy,
block_public_policy
FROM aws.secretsmanager.resource_policies
WHERE region = 'us-east-1';
Gets all properties from an individual resource_policy
.
SELECT
region,
id,
secret_id,
resource_policy,
block_public_policy
FROM aws.secretsmanager.resource_policies
WHERE region = 'us-east-1' AND data__Identifier = '<Id>';
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.secretsmanager.resource_policies (
SecretId,
ResourcePolicy,
region
)
SELECT
'{{ SecretId }}',
'{{ ResourcePolicy }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.secretsmanager.resource_policies (
SecretId,
ResourcePolicy,
BlockPublicPolicy,
region
)
SELECT
'{{ SecretId }}',
'{{ ResourcePolicy }}',
'{{ BlockPublicPolicy }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: resource_policy
props:
- name: SecretId
value: '{{ SecretId }}'
- name: ResourcePolicy
value: {}
- name: BlockPublicPolicy
value: '{{ BlockPublicPolicy }}'
DELETE
example
/*+ delete */
DELETE FROM aws.secretsmanager.resource_policies
WHERE data__Identifier = '<Id>'
AND region = 'us-east-1';
Permissions
To operate on the resource_policies
resource, the following permissions are required:
Create
secretsmanager:PutResourcePolicy,
secretsmanager:GetResourcePolicy
Read
secretsmanager:GetResourcePolicy
Update
secretsmanager:PutResourcePolicy,
secretsmanager:GetResourcePolicy
Delete
secretsmanager:DeleteResourcePolicy,
secretsmanager:GetResourcePolicy
List
secretsmanager:GetResourcePolicy,
secretsmanager:ListSecrets