Skip to main content

stack_policies

Creates, updates, deletes, gets or lists a stack_policies resource.

Overview

Namestack_policies
TypeResource
Idaws.cloudformation.stack_policies

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
line_itemsarray

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_stack_policyselectStackName, regionReturns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.
set_stack_policyupdateStackName, regionStackPolicyBody, StackPolicyURLSets a stack policy for a specified stack.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
StackNamestringThe name or unique stack ID that you want to associate a policy with.
regionstringAWS region (default: us-east-1)
StackPolicyBodystringStructure that contains the stack policy body. For more information, see Prevent updates to stack resources in the CloudFormation User Guide. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.
StackPolicyURLstringLocation of a file that contains the stack policy. The URL must point to a policy (maximum size: 16 KB) located in an Amazon S3 bucket in the same Amazon Web Services Region as the stack. The location for an Amazon S3 bucket must start with https:​//. URLs from S3 static websites are not supported. You can specify either the StackPolicyBody or the StackPolicyURL parameter, but not both.

SELECT examples

Returns the stack policy for a specified stack. If a stack doesn't have a policy, a null value is returned.

SELECT
line_items
FROM aws.cloudformation.stack_policies
WHERE StackName = '{{ StackName }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Sets a stack policy for a specified stack.

UPDATE aws.cloudformation.stack_policies
SET
-- No updatable properties
WHERE
StackName = '{{ StackName }}' --required
AND region = '{{ region }}' --required
AND StackPolicyBody = '{{ StackPolicyBody}}'
AND StackPolicyURL = '{{ StackPolicyURL}}';