aws-cloudformation / aws-cloudformation/cloudformation-coverage-roadmap
[Resource Type] - [BUG] - aws cloudformation create-stack-refactor does not allow logicalID rename in the same stack
- Dominant language
- No language data
- Stars
- 1.1k
- Forks
- 62
- PR merge metrics
- No merged PRs in 30d
Description
### Name of the resource
AWS::CloudFormation::Stack
### Resource Name
_No response_
### Issue Description
Hello,
I'm not 100% sure this is the right place to open a bug report, but I haven't found any better ones.
I'm using CDK to define my AWS infrastructure and as many other devs struggle with refactorings when my construct IDs change. I'm trying to follow [the new cloudformation-stack-refactoring tutorial and docs](https://aws.amazon.com/blogs/devops/introducing-aws-cloudformation-stack-refactoring/) to just change a resourceId in my stack name. But apparently it doesn't work or lacks documentation.
1. The guide and the doc provided does not really address a simple and common case where I just want to change the resource ID without moving resources
2. It seems there's a bug in the process of renaming.
I do the following
1. ```env AWS_PROFILE=beta aws cloudformation get-template --stack-name BETA-Stack > stack.json``` (the stack was deployed by CDK)
2. I replace resourceIds in the template and uppload it to s3
3. Create `refactor.json`. (!) I tried with this file and without it. The failure is the same
```JSON
[
{
"Source": {
"StackName": "BETA-Stack",
"LogicalResourceId": "DbBETAB7A059FA"
},
"Destination": {
"StackName": "BETA-Stack",
"LogicalResourceId": "DbBETATableA5856A01"
}
}
]
```
4. ```bash
env AWS_PROFILE=beta aws cloudformation create-stack-refactor \
--stack-definitions 'StackName=BETA-Stack,TemplateURL=https://my-bucket-beta.s3.eu-west-1.amazonaws.com/stack.json' \
--no-enable-stack-creation \
--resource-mappings [file://refactor.json](file:///refactor.json) ### Tried with and without this line
```
5. ```env AWS_PROFILE=beta aws cloudformation describe-stack-refactor --stack-refactor-id 634564be-7c49-416a-9f59-96f2232c4b0d```
>
"StackRefactorId": "9124e18c-7de0-4b54-98c7-e601ad7eeb3b",
"StackIds": [
"arn:aws:cloudformation:eu-west-1:741448951753:stack/BETA-Stack/724e1900-d267-11ef-9091-02bf3a1c4d63"
],
"ExecutionStatus": "UNAVAILABLE",
"Status": "CREATE_FAILED",
"StatusReason": "arn:aws:cloudformation:eu-west-1:741448951753:stack/BETA-Stack/724e1900-d267-11ef-9091-02bf3a1c4d63: Parameter values specified for a template which does not require them."
}
### Expected Behavior
1. Refactor should suceed
2. It's the basic (possible the most simple and common) case. It should be documented
### Observed Behavior
"StackRefactorId": "9124e18c-7de0-4b54-98c7-e601ad7eeb3b",
"StackIds": [
"arn:aws:cloudformation:eu-west-1:741448951753:stack/BETA-Stack/724e1900-d267-11ef-9091-02bf3a1c4d63"
],
"ExecutionStatus": "UNAVAILABLE",
"Status": "CREATE_FAILED",
"StatusReason": "arn:aws:cloudformation:eu-west-1:741448951753:stack/BETA-Stack/724e1900-d267-11ef-9091-02bf3a1c4d63: Parameter values specified for a template which does not require them."
### Test Cases
N/A
### Other Details
_No response_
Contributor guide
Research direction
Start by reproducing the reported create-stack-refactor flow with stack.json and refactor.json, using the AWS CLI commands and the same-stack logical ID rename described here. Compare the resulting status and error with the expected successful refactor, then determine whether the outcome requires a service fix or clearer documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 18/100