How do I resolve change set errors in CloudFormation?

4 minute read
0

I receive an error when I try to import resources into an AWS CloudFormation stack.

Short description

Based on the type of error that you receive, complete the steps in the related section of this article.

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you're using the most recent AWS CLI version.

Resolution

Troubleshoot the outputs error

"There was an error creating this change set. As part of the import operation, you cannot modify or add [Outputs]"

This error occurs when importing a resource into a stack. It also occurs when creating a new stack with a resource import template that has outputs through the CloudFormation console. Try these troubleshooting steps:

1.    Compare the Outputs section of the latest CloudFormation template with the template that your stack is currently using. The Outputs sections in both templates must be the same. If the values aren't the same, then update the latest template to match the values and outputs in the Outputs section of the current template.

Important: The import operation can't contain additions and modifications to Logical ID, Description, Value, Export, and other properties in Outputs.

2.    After the import operation completes, update the stack with the desired changes in the Outputs configuration.

Troubleshoot the validation error with stack attributes

"An error occurred (ValidationError) when calling the CreateChangeSet operation: As part of the import operation, you cannot modify or add [Tags]"

This error occurs when you use the AWS CLI or AWS SDK to create an IMPORT type change set that contains modified or added stack attributes.

Try these troubleshooting steps:

1.    Confirm that the stack attributes that are included for the change set creation operation are in sync with the current attribute values of the stack.

Important: Don't update or add any new attribute values.

2.    After the resources are imported, update your attributes in a separate update operation.

Troubleshoot the modified resource error

"There was an error creating this change set. You have modified resources [ResourceName] in your template that are not being imported. Update, create or delete operations cannot be executed during import operations."

This error occurs when you modify an existing resource during a resource import operation. During an import operation, you can't create, update, and delete a resource.

Try these troubleshooting steps: 

1.    Create an UPDATE type change set instead of an IMPORT type change set. This shows you the source of the change in the resource.

2.    Use the same Resources specification for the existing resources, and add only the appropriate resources to import to the template.

Troubleshoot the resources to import list error

The following errors commonly occur when you use the AWS CLI or AWS SDK to create an IMPORT type change set.

"An error occurred (ValidationError) when calling the CreateChangeSet operation: Resources [<ResourceName>] is missing from ResourceToImport list"

If you receive the preceding error, then try the following troubleshooting step:

In your CloudFormation template, verify that you're passing a physical ID into the ResourceToImport property for all resources that you want to import to the stack.

"An error occurred (ValidationError) when calling the CreateChangeSet operation: Must Provide at least one resource to import"

If you receive the preceding error, then try the following troubleshooting step:

Verify that you're including --resources-to-import in your AWS CLI command or ResourceToImport in your API call. Also, be sure to list all the resources to import.

Important: You must pass a Physical ID to all new resources for importing.

Related information

Creating a stack from existing resources

Importing existing resources into a stack

Resources that support import and drift detection operations

Bringing existing resources into CloudFormation management

AWS OFFICIAL
AWS OFFICIALUpdated a month ago