Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Cloudformation reprocess a template using a macro when parameters change?

I have a Cloudformation template that uses a custom Macro to generate part of the template. The lambda for the Macro uses template parameters (via the templateParameterValues field in the incoming event) to generate the template fragment.

When I change the Cloudformation Stack's parameters, I get an error:

The submitted information didn't contain changes. Submit different information to create a change set.

If I use the CLI I get a similar error:

An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed.

The parameters I am changing are only used by the Macro, not the rest of the template.

How can I make Cloudformation reprocess the template with the macro when I update these parameters?

like image 912
McFadden Avatar asked Jan 20 '20 18:01

McFadden


People also ask

Which AWS CloudFormation section specifies one or more macros that AWS CloudFormation uses to process your templates and is required for AWS Sam template files?

To use an AWS CloudFormation macro in your template To process a template snippet, reference the macro in a Fn::Transform function located relative to the template content you want to process. To process the entire template, reference the macro in the Transform section of the template.

What is dynamic reference in CloudFormation?

When you use a dynamic reference, CloudFormation retrieves the value of the specified reference when necessary during stack and change set operations. CloudFormation currently supports the following dynamic reference patterns: ssm, for plaintext values stored in AWS Systems Manager Parameter Store.

Which AWS service provides you with the ability to create a template and use it multiple times to deploy the AWS resources?

About AWS CloudFormation AWS CloudFormation streamlines the deployment of key workloads on the AWS Cloud. With AWS CloudFormation, you model and provision all the resources needed for your applications across multiple Regions and accounts in an automated and secure manner.


1 Answers

After working with AWS Support I learned that you must supply the template again in order for the macro to be re-processed.

Even if it is the same exact template it will cause the macros to be reprocessed.

You can do this via the Console UI (by uploading the template file again) or the CLI (by passing the template / template URL again).

like image 193
McFadden Avatar answered Oct 03 '22 05:10

McFadden