Skip to main content

Module cfn_template

Module cfn_template 

Source
Expand description

Parsing for CloudFormation-shaped template bodies.

A template body arrives as either JSON or YAML, and the YAML dialect CloudFormation accepts is not plain YAML: intrinsic functions may be written as short-form node tags (!Ref, !GetAtt, !Sub, …). A plain YAML-to-JSON deserialize rejects those outright — the whole document fails, not just the tagged node — so a template using the short forms parsed to nothing at all and stacks came up empty (#2480).

Everything that reads a template body (CloudFormation, Serverless Application Repository, Config conformance packs) goes through here, so a short form behaves exactly like its {"Fn::Sub": ...} long-form spelling.

Functions§

is_template_document
Whether a body is meant to be a CloudFormation template document, as opposed to a placeholder scalar (the conformance probe sends "test"-style strings for TemplateBody).
parse_template_body
Parse a CloudFormation template body (JSON or YAML, short-form tags included) into a JSON value with every intrinsic in its long form.
parse_template_object
Convenience wrapper for callers that only want a template-shaped object and treat anything else (a placeholder scalar, a parse failure) as absent.