How do I resolve change set errors in CloudFormation?

5 minute read
0

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

Resolution

Based on your error type, complete the steps in the related section to troubleshoot the error.

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

Change set error

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 you import 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. Follow these steps to troubleshoot the error:

  • 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.
  • After the import operation completes, update the stack with the desired changes in the Outputs configuration.

Validation error with stack attributes

Error: "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.

  • 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.
  • After you imported the resources, update your attributes in a separate update operation.

Modified resource error

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. Follow these steps to troubleshoot the error:

  • Create an UPDATE type change set instead of an IMPORT type change set. This shows you the source of the change in the resource.
  • Use the same Resources specification for the existing resources, and add only the appropriate resources to import to the template.

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.

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

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.

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

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: In order to import, you must pass a physical ID to all new resources.

Error due to IAM capabilities

"Error: Failed to create changeset for the stack: <StackName>, ex: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state: For expression "Status" we matched expected path: "FAILED" Status: FAILED. Reason: Requires capabilities: [CAPABILITY_NAMED_IAM]"

Follow these steps to troubleshoot the error:

  1. Open the AWS CloudFormation console.
  2. On the Review page of the Create Stack or Update Stack wizards, choose I acknowledge that this template may create IAM resources.
  3. In the AWS CLI, when you use the create-stack and update-stack commands, specify the CAPABILITY_IAM or CAPABILITY_NAMED_IAM value for the --capabilities parameter.
    Note: If your template includes AWS Identity and Access Management (IAM) resources, you can specify either capability. If your template includes custom names for IAM resources, you must specify CAPABILITY_NAMED_IAM.

Error due to "no changes submitted" during update stack operation

Error: "The submitted information didn't contain changes. Submit different information to create a change set" or "An error occurred (ValidationError) when calling the UpdateStack operation: No updates are to be performed."

This error occurs when you use the same stack template during the Update Stack operation. Or, it occurs when you don't modify the Resources properties and only attempt to modify the Parameter values or Stack Description. CloudFormation doesn't consider it as a change and the change set creation fails. 

ExecuteChangeSet API call error

Error: "Either DisableRollback or OnStackFailure can be specified, but not both. Validation error as OnStackFailure parameter was specified during CreateChangeSet."

You can specify either OnFailure or DisableRollback, but not both. To resolve this, create a new change set by removing the onStackFailure property in the command and then run it. Or, turn on the rollback option and then run the current change set to update the stack. 

Error due to mismatch between input and format on console for change set

Error: "Given input did not match expected format"

This error usually occurs due to syntax issues in the CloudFormation template. Check the template syntax for any join function format, extra characters, or extra double quotes. Also, review resources such as the AWS System Manager Agent (SSM Agent) parameters. For more information on resolving syntax errors, see How do I resolve template validation or template format errors in CloudFormation?

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

Acknowledging IAM resources in AWS CloudFormation templates

AWS OFFICIAL
AWS OFFICIALUpdated 21 days ago