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
DescriptionResource Type definition for AWS::SecretsManager::ResourcePolicy
Idaws.secretsmanager.resource_policies

Fields

NameDatatypeDescription
idstringThe Arn of the secret.
secret_idstringThe ARN or name of the secret to attach the resource-based policy.
resource_policyobjectA JSON-formatted string for an AWS resource-based policy.
block_public_policybooleanSpecifies whether to block resource-based policies that allow broad access to the secret.
regionstringAWS region.

For more information, see AWS::SecretsManager::ResourcePolicy.

Methods

NameAccessible byRequired Params
create_resourceINSERTResourcePolicy, SecretId, 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,
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.

/*+ create */
INSERT INTO aws.secretsmanager.resource_policies (
SecretId,
ResourcePolicy,
region
)
SELECT
'{{ SecretId }}',
'{{ ResourcePolicy }}',
'{{ region }}';

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