AWS::LanguageExtensions transform - AWS CloudFormation

AWS::LanguageExtensions transform

The AWS::LanguageExtensions transform is a macro hosted by AWS CloudFormation that lets you use intrinsic functions and other functionalities not included by default in AWS CloudFormation. When a template references AWS::LanguageExtensions, and you're creating or updating stacks using change sets, AWS CloudFormation updates any intrinsic function defined by the transform to its resolved value within the template. When you add the AWS::LanguageExtensions transform in a AWS CloudFormation template, you can use intrinsic functions as a parameter to Ref and Fn::GetAtt.

The AWS::LanguageExtensions transform supports the following functions and attributes:

Usage

The value for the transform declaration must be a literal string. You can't use a parameter or function to specify a transform value. See this snippet for an example of a transform declaration:

Syntax at the top level of a template

Use the AWS::LanguageExtensions transform at the top level of a template. You can't use the AWS::LanguageExtensions transform as an embedded transform in any other template section.

JSON

"Transform": "AWS::LanguageExtensions"

YAML

Transform: AWS::LanguageExtensions

Parameters

The AWS::LanguageExtensions transform doesn't accept parameters.

Remarks

When using the AWS::LanguageExtensions transform, keep the following considerations in mind:

  • If you update a stack using a different parameter value, don't use the --use-previous-template option where the original template contains the transform. Use the original template, before transformation, in the UpdateStack call. The stack will update with the new parameter values.

  • Short-form YAML syntax isn't supported within a template for intrinsic functions that are only available in the AWS::LanguageExtensions transform. Examples of intrinsic functions only available in the AWS::LanguageExtensions transform are Fn::Length and Fn::ToJsonString. Use explicit references to these functions. For example, use Fn::Length instead of !Length.

  • If you're using multiple transforms, use a list format. If you're using custom macros, place AWS-provided transforms after your custom macros. If you're using both the AWS::LanguageExtensions and AWS::Serverless transforms, the AWS::LanguageExtensions transform must come before the AWS::Serverless transform in the list.

  • Functions and attributes provided by the AWS::LanguageExtensions transform are only supported in the Resources, Conditions, and Outputs sections of a template.

For more information on using macros, see Create a CloudFormation macro definition.

Example

The following example shows how to use the AWS::LanguageExtensions transform to use the Fn::Length intrinsic function, defined by the transform.

JSON

{ "AWSTemplateFormatVersion": "2010-09-09", "Transform": "AWS::LanguageExtensions", "Parameters": { "QueueList": { "Type": "CommaDelimitedList" }, "QueueNameParam": { "Description": "Name for your SQS queue", "Type": "String" } }, "Resources": { "Queue": { "Type": "AWS::SQS::Queue", "Properties": { "QueueName": { "Ref": "QueueNameParam" }, "DelaySeconds": { "Fn::Length": { "Ref": "QueueList" } } } } } }

YAML

AWSTemplateFormatVersion: 2010-09-09 Transform: 'AWS::LanguageExtensions' Parameters: QueueList: Type: CommaDelimitedList QueueNameParam: Description: Name for your SQS queue Type: String Resources: Queue: Type: AWS::SQS::Queue Properties: QueueName: !Ref QueueNameParam DelaySeconds: 'Fn::Length': !Ref QueueList