Fn::Transform - Amazon CloudFormation
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China.

Fn::Transform

The intrinsic function Fn::Transform specifies a macro to perform custom processing on part of a stack template. Macros enable you to perform custom processing on templates, from simple actions like find-and-replace operations to extensive transformations of entire templates. For more information, see Using Amazon CloudFormation macros to perform custom processing on templates.

You can also use Fn::Transform to call the AWS::Include transform transform, which is a macro hosted by Amazon CloudFormation.

Declaration

JSON

Syntax for the full function name:

{ "Fn::Transform": { "Name": "macro name", "Parameters": { "Key": "value" } } }

Syntax for the short form:

{ "Transform": { "Name": "macro name", "Parameters": { "Key": "value" } } }

YAML

Syntax for the full function name:

Fn::Transform: Name : macro name Parameters : Key : value

Syntax for the short form:

Transform: Name: macro name Parameters: Key: value

Parameters

Name

The name of the macro you want to perform the processing.

Parameters

The list parameters, specified as key-value pairs, to pass to the macro.

Return value

The processed template snippet to be included in the processed stack template.

Examples

The following example calls the AWS::Include transform, specifying that the location to retrieve a template snippet from is passed in the InputValue parameter.

JSON

{ "Fn::Transform": { "Name": "AWS::Include", "Parameters": { "Location": { "Ref": "InputValue" } } } }

YAML

'Fn::Transform': Name: 'AWS::Include' Parameters: Location: !Ref InputValue

The following example calls the AWS::Include transform, specifying that the location to retrieve a template snippet from is located in the RegionMap mapping, under the key us-east-1 and nested key s3Location.

JSON

{ "Fn::Transform": { "Name": "AWS::Include", "Parameters": { "Location": { "Fn::FindInMap": [ "RegionMap", "us-east-1", "s3Location" ] } } } }

YAML

!Transform Name: AWS::Include Parameters: Location: !FindInMap - RegionMap - us-east-1 - s3Location

Supported functions

None.

CloudFormation passes any intrinsic function calls included in Fn::Transform to the specified macro as literal strings. For more information, see Amazon CloudFormation macro function interface.