Skip to main content

generated_templates

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

Overview

Namegenerated_templates
TypeResource
Idaws.cloudformation.generated_templates

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
logical_resource_idstringThe logical id for this resource in the final generated template.
resource_identifierstringA list of up to 256 key-value pairs that identifies the resource in the generated template. The key is the name of one of the primary identifiers for the resource. (Primary identifiers are specified in the primaryIdentifier list in the resource schema.) The value is the value of that primary identifier. For example, for a AWS::DynamoDB::Table resource, the primary identifiers is TableName so the key-value pair could be "TableName": "MyDDBTable". For more information, see primaryIdentifier in the CloudFormation Command Line Interface (CLI) User Guide.
resource_statusstringStatus of the processing of a resource in a generated template. InProgress The resource processing is still in progress. Complete The resource processing is complete. Pending The resource processing is pending. Failed The resource processing has failed.
resource_status_reasonstringThe reason for the resource detail, providing more information if a failure happened.
resource_typestringThe type of the resource, such as AWS::DynamoDB::Table. For the list of supported resources, see Resource type support for imports and drift detection In the CloudFormation User Guide
warningsstringThe warnings generated for this resource.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_generated_templateselectGeneratedTemplateName, regionDescribes a generated template. The output includes details about the progress of the creation of a generated template started by a CreateGeneratedTemplate API action or the update of a generated template started with an UpdateGeneratedTemplate API action.
list_generated_templatesselectregionNextToken, MaxResultsLists your generated templates in this Region.
create_generated_templateinsertGeneratedTemplateName, regionResources, StackName, TemplateConfigurationCreates a template from existing resources that are not already managed with CloudFormation. You can check the status of the template generation using the DescribeGeneratedTemplate API action.
update_generated_templateupdateGeneratedTemplateName, regionNewGeneratedTemplateName, AddResources, RemoveResources, RefreshAllResources, TemplateConfigurationUpdates a generated template. This can be used to change the name, add and remove resources, refresh resources, and change the DeletionPolicy and UpdateReplacePolicy settings. You can check the status of the update to the generated template using the DescribeGeneratedTemplate API action.
delete_generated_templatedeleteGeneratedTemplateName, regionDeleted a generated template.
get_generated_templateexecGeneratedTemplateName, regionFormatRetrieves a generated template. If the template is in an InProgress or Pending status then the template returned will be the template when the template was last in a Complete status. If the template has not yet been in a Complete status then an empty template will be 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
GeneratedTemplateNamestringThe name or Amazon Resource Name (ARN) of the generated template. The format is arn:${Partition}:cloudformation:${Region}:${Account}:generatedtemplate/${Id}. For example, arn:aws:cloudformation:us-east-1:123456789012:generatedtemplate/2e8465c1-9a80-43ea-a3a3-4f2d692fe6dc .
regionstringAWS region (default: us-east-1)
AddResourcesarrayAn optional list of resources to be added to the generated template.
FormatstringThe language to use to retrieve for the generated template. Supported values are: JSON YAML
MaxResultsintegerIf the number of available results exceeds this maximum, the response includes a NextToken value that you can use for the NextToken parameter to get the next set of results. By default the ListGeneratedTemplates API action will return at most 50 results in each response. The maximum value is 100.
NewGeneratedTemplateNamestringAn optional new name to assign to the generated template.
NextTokenstringThe token for the next set of items to return. (You received this token from a previous call.)
RefreshAllResourcesbooleanIf true, update the resource properties in the generated template with their current live state. This feature is useful when the resource properties in your generated a template does not reflect the live state of the resource properties. This happens when a user update the resource properties after generating a template.
RemoveResourcesarrayA list of logical ids for resources to remove from the generated template.
ResourcesarrayAn optional list of resources to be included in the generated template. If no resources are specified,the template will be created without any resources. Resources can be added to the template using the UpdateGeneratedTemplate API action.
StackNamestringAn optional name or ARN of a stack to use as the base stack for the generated template.
TemplateConfigurationobjectThe configuration details of the generated template, including the DeletionPolicy and UpdateReplacePolicy.

SELECT examples

Describes a generated template. The output includes details about the progress of the creation of a generated template started by a CreateGeneratedTemplate API action or the update of a generated template started with an UpdateGeneratedTemplate API action.

SELECT
logical_resource_id,
resource_identifier,
resource_status,
resource_status_reason,
resource_type,
warnings
FROM aws.cloudformation.generated_templates
WHERE GeneratedTemplateName = '{{ GeneratedTemplateName }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates a template from existing resources that are not already managed with CloudFormation. You can check the status of the template generation using the DescribeGeneratedTemplate API action.

INSERT INTO aws.cloudformation.generated_templates (
GeneratedTemplateName,
region,
Resources,
StackName,
TemplateConfiguration
)
SELECT
'{{ GeneratedTemplateName }}',
'{{ region }}',
'{{ Resources }}',
'{{ StackName }}',
'{{ TemplateConfiguration }}'
RETURNING
line_items
;

UPDATE examples

Updates a generated template. This can be used to change the name, add and remove resources, refresh resources, and change the DeletionPolicy and UpdateReplacePolicy settings. You can check the status of the update to the generated template using the DescribeGeneratedTemplate API action.

UPDATE aws.cloudformation.generated_templates
SET
-- No updatable properties
WHERE
GeneratedTemplateName = '{{ GeneratedTemplateName }}' --required
AND region = '{{ region }}' --required
AND NewGeneratedTemplateName = '{{ NewGeneratedTemplateName}}'
AND AddResources = '{{ AddResources}}'
AND RemoveResources = '{{ RemoveResources}}'
AND RefreshAllResources = {{ RefreshAllResources}}
AND TemplateConfiguration = '{{ TemplateConfiguration}}'
RETURNING
line_items;

DELETE examples

Deleted a generated template.

DELETE FROM aws.cloudformation.generated_templates
WHERE GeneratedTemplateName = '{{ GeneratedTemplateName }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Retrieves a generated template. If the template is in an InProgress or Pending status then the template returned will be the template when the template was last in a Complete status. If the template has not yet been in a Complete status then an empty template will be returned.

EXEC aws.cloudformation.generated_templates.get_generated_template
@GeneratedTemplateName='{{ GeneratedTemplateName }}' --required,
@region='{{ region }}' --required,
@Format='{{ Format }}'
;