'Unable to update CloudFormation stack after SSM parameter is recreated

In AWS SAM, I have a stack A, with creates an AWS Systems Manager (SSM) Parameters. Stack B references that stack with: {{resolve:ssm:<param name>}}. After a deployed stack A and B (with sam deploy, I dropped stack A (fact: nothing prevented this) and recreated it. The value of the SSM param was not changed. A few days later, I tried to deploy a new version of stack B. The operation failed with this message:

Status reason: Parameters: [ssm:/<my parameter name here>:1:1649319972738] last modified date does not match with the last modified date of the retrieved parameters.

I understand what happened: my stack B refers to a param version 1 with a last modified date older than the last modified date of the newly deployed version 1 of the parameter in stack A. The problem is, I am no longer able to update stack B.

I had no other option than to drop stack B and redeploy it completely (which is unacceptable). Any ideas how to prevent this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source