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 = '{{ region }}' AND
Identifier = '{{ stack_id }}';
Lists all stacks in a region.
SELECT
region,
stack_id
FROM awscc.cloudformation.stacks_list_only
WHERE
region = '{{ region }}';
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
/*+ 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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
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 }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
DELETE example
/*+ delete */
DELETE FROM awscc.cloudformation.stacks
WHERE
Identifier = '{{ stack_id }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;
Additional Parameters
Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:
| Parameter | Description |
|---|---|
ClientToken | A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.A client token is valid for 36 hours once used. After that, a resource request with the same client token is treated as a new request. If you do not specify a client token, one is generated for inclusion in the request. |
RoleArn | The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.If you do not specify a role, a temporary session is created using your AWS user credentials. |
TypeVersionId | For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used. |
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