How do I resolve change set errors in CloudFormation?

Lesedauer: 4 Minute
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 one of the following sections

  • Troubleshoot the outputs error
  • Troubleshoot the validation error with stack attributes
  • Troubleshoot the modified resource error
  • Troubleshoot the resources to import list error

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

If you receive the following error:

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

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 should be the same.

If the values aren't the same, update the latest template to match the exact same values and outputs in the Outputs section of the template that your stack is currently using.

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 again with the desired changes in the Outputs configuration.

Troubleshoot the validation error with stack attributes

If you receive the following error:

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

Try these troubleshooting steps:

1.    Confirm that the stack attributes (like Tags or NotificationARNs) included for the change set creation operation are in sync with the current attribute values of the stack.

Important: Be sure not to update or add any new attribute values.

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

Note: This error occurs when a change set of type IMPORT is created using the AWS CLI or AWS SDK and contains modified or added stack attributes.

Troubleshoot the modified resource error

This error is thrown when an existing resource is modified during a resource import operation. During an import operation, create, update, and delete operations are not permitted.

If you receive this 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.

Try the following:

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 exact same Resources specification for the existing resources, and only add the resources that should be imported to the template.

Troubleshoot the resources to import list error

If you receive the following error:

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

Try the following:

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

If you receive the following error:

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

Try the following:

1.    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 be imported.

Note: These errors commonly occur when a change set of type IMPORT is created using the AWS CLI or AWS SDK.

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 OFFICIALAktualisiert vor 2 Jahren