aws-amplify / aws-amplify/amplify-cli

[gen2-migration] Generated postRefactor() tags the root stack, forcing an app-wide changeset that can exceed the single-operation resource limit

Open Beginner friendly
#14,977 0 comments 0 reactions 0 assignees View on GitHub
gen2-migration
Dominant language
TypeScript
Stars
2.9k
Forks
825
Avg merge
11d 23h
Merged PRs (30d)
2

Description

## Summary
The generated `postRefactor()` always appends `Tags.of(backend.stack).add('gen2-migration/post-refactor','true')` to the ROOT stack. CloudFormation propagates a root-stack tag aspect to every taggable resource across all nested stacks, so a single deploy produces a changeset that touches essentially the entire resource graph at once. On large apps this over-wide single stack operation can fail.

## Error
`Limit on the number of resources in a single stack operation exceeded.`

## Details
- `packages/amplify-cli/src/commands/gen2-migration/generate/amplify/backend.renderer.ts` (~L131-149) appends the tag unconditionally ("Always add ...") to every generated `postRefactor()`, targeting `backend.stack` (root).
- Note: CloudFormation tags are not themselves counted as resources — the failure is caused by the tag cascade forcing an app-wide changeset, not by the tag consuming resource slots.

## Expected
Do not apply this informational marker tag at the root-stack scope. Scope it narrowly or drop it, so it cannot force a graph-wide changeset. (The tag is not read back by the tooling.)

## Type
Bug

Contributor guide

Open the contributing guide

Research direction

Start at packages/amplify-cli/src/commands/gen2-migration/generate/amplify/backend.renderer.ts around lines 131-149 and inspect how generated postRefactor() applies the marker to backend.stack. Verify that the generated output no longer applies the informational tag at root-stack scope and cannot force a graph-wide changeset.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
cli, cloud, infrastructure
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.