stacks
Creates, updates, deletes or gets a stack resource or lists stacks in a region
Overview
| Name | stacks |
| Type | Resource |
| Description | The AWS::CloudFormation::Stack resource nests a stack as a resource in a top-level template. |
| Id | awscc.cloudformation.stacks |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
capabilities | array | |
role_arn | string | |
outputs | array | |
description | string | |
disable_rollback | boolean | |
enable_termination_protection | boolean | |
notification_arns | array | |
parameters | object | |
parent_id | string | |
root_id | string | |
change_set_id | string | |
stack_name | string | |
stack_id | string | |
stack_policy_body | object | |
stack_policy_url | string | |
stack_status | string | |
stack_status_reason | string | |
tags | array | |
template_body | object | |
template_url | string | |
timeout_in_minutes | integer | |
last_update_time | string | |
creation_time | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
stack_id | string | |
region | string | AWS region. |
For more information, see AWS::CloudFormation::Stack.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | stacks | INSERT | StackName, region |
delete_resource | stacks | DELETE | Identifier, region |
update_resource | stacks | UPDATE | Identifier, PatchDocument, region |
list_resources | stacks_list_only | SELECT | region |
get_resource | stacks | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual stack.
SELECT
region,
capabilities,
role_arn,
outputs,
description,
disable_rollback,
enable_termination_protection,
notification_arns,
parameters,
parent_id,
root_id,
change_set_id,
stack_name,
stack_id,
stack_policy_body,
stack_policy_url,
stack_status,
stack_status_reason,
tags,
template_body,
template_url,
timeout_in_minutes,
last_update_time,
creation_time
FROM awscc.cloudformation.stacks
WHERE
region = 'us-east-1' AND
Identifier = '{{ stack_id }}';
Lists all stacks in a region.
SELECT
region,
stack_id
FROM awscc.cloudformation.stacks_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new stack resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.cloudformation.stacks (
StackName,
region
)
SELECT
'{{ stack_name }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.cloudformation.stacks (
Capabilities,
RoleARN,
Description,
DisableRollback,
EnableTerminationProtection,
NotificationARNs,
Parameters,
StackName,
StackPolicyBody,
StackPolicyURL,
StackStatusReason,
Tags,
TemplateBody,
TemplateURL,
TimeoutInMinutes,
region
)
SELECT
'{{ capabilities }}',
'{{ role_arn }}',
'{{ description }}',
'{{ disable_rollback }}',
'{{ enable_termination_protection }}',
'{{ notification_arns }}',
'{{ parameters }}',
'{{ stack_name }}',
'{{ stack_policy_body }}',
'{{ stack_policy_url }}',
'{{ stack_status_reason }}',
'{{ tags }}',
'{{ template_body }}',
'{{ template_url }}',
'{{ timeout_in_minutes }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: stack
props:
- name: capabilities
value:
- '{{ capabilities[0] }}'
- name: role_arn
value: '{{ role_arn }}'
- name: description
value: '{{ description }}'
- name: disable_rollback
value: '{{ disable_rollback }}'
- name: enable_termination_protection
value: '{{ enable_termination_protection }}'
- name: notification_arns
value:
- '{{ notification_arns[0] }}'
- name: parameters
value: {}
- name: stack_name
value: '{{ stack_name }}'
- name: stack_policy_body
value: {}
- name: stack_policy_url
value: '{{ stack_policy_url }}'
- name: stack_status_reason
value: '{{ stack_status_reason }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
- name: template_body
value: {}
- name: template_url
value: '{{ template_url }}'
- name: timeout_in_minutes
value: '{{ timeout_in_minutes }}'
UPDATE example
Use the following StackQL query and manifest file to update a stack resource, using stack-deploy.
/*+ update */
UPDATE awscc.cloudformation.stacks
SET PatchDocument = string('{{ {
"Capabilities": capabilities,
"RoleARN": role_arn,
"Description": description,
"DisableRollback": disable_rollback,
"EnableTerminationProtection": enable_termination_protection,
"NotificationARNs": notification_arns,
"Parameters": parameters,
"StackPolicyBody": stack_policy_body,
"StackPolicyURL": stack_policy_url,
"StackStatusReason": stack_status_reason,
"Tags": tags,
"TemplateBody": template_body,
"TemplateURL": template_url,
"TimeoutInMinutes": timeout_in_minutes
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ stack_id }}';
DELETE example
/*+ delete */
DELETE FROM awscc.cloudformation.stacks
WHERE
Identifier = '{{ stack_id }}' AND
region = 'us-east-1';
Permissions
To operate on the stacks resource, the following permissions are required:
- Create
- Update
- Delete
- Read
- List
cloudformation:DescribeStacks,
cloudformation:CreateStack,
iam:PassRole
cloudformation:DescribeStacks,
cloudformation:UpdateStack,
cloudformation:UpdateTerminationProtection,
cloudformation:SetStackPolicy,
iam:PassRole
cloudformation:DescribeStacks,
cloudformation:DeleteStack
cloudformation:DescribeStacks,
cloudformation:GetStackPolicy,
cloudformation:GetTemplate
cloudformation:ListStacks