Skip to main content

templates

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

Overview

Nametemplates
TypeResource
Idaws.cloudformation.templates

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_templateselectregionStackName, ChangeSetName, TemplateStageReturns the template body for a specified stack. You can get the template for running or deleted stacks. For deleted stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted. If the template doesn't exist, a ValidationError is returned.

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
regionstringAWS region (default: us-east-1)
ChangeSetNamestringThe name or Amazon Resource Name (ARN) of a change set for which CloudFormation returns the associated template. If you specify a name, you must also specify the StackName.
StackNamestringThe name or the unique stack ID that's associated with the stack, which aren't always interchangeable: Running stacks: You can specify either the stack's name or its unique stack ID. Deleted stacks: You must specify the unique stack ID.
TemplateStagestringFor templates that include transforms, the stage of the template that CloudFormation returns. To get the user-submitted template, specify Original. To get the template after CloudFormation has processed all transforms, specify Processed. If the template doesn't include transforms, Original and Processed return the same template. By default, CloudFormation specifies Processed.

SELECT examples

Returns the template body for a specified stack. You can get the template for running or deleted stacks. For deleted stacks, GetTemplate returns the template for up to 90 days after the stack has been deleted. If the template doesn't exist, a ValidationError is returned.

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