cdklabs / cdklabs/cdk-stacksets
Race condition when using self managed deployment type
- Dominant language
- TypeScript
- Stars
- 118
- Forks
- 25
- Avg merge
- 33m
- Merged PRs (30d)
- 4
Description
I'm hitting a race condition when using a self managed deployment. It looks like the stack set resource starts deploying before the IAM role is ready, resulting in the following error message:
```
Resource handler returned message: "Resource of type 'Stack set operation [133a0012-7a7e-4ca6-a253-622c36c8d8d8] was unexpectedly stopped or failed. status reason(s): [Account should have 'AWSCloudFormationStackSetExecutionRole' role with trust relationship to Role '-AdminRole38563C57-xWR5IEOHv72o'.]' with identifier 'StackSet0EB2B840:bebe8bba-591e-4dd4-a637-1d631421d4d8' did not stabilize."
```
If I pre-create the admin role and specify it in the StackSet resource, it deploys successfully. Note that it does expose another minor issue, where [a duplicate policy](https://github.com/cdklabs/cdk-stacksets/blob/main/src/stackset.ts#L621C18-L621C38) is always added to the role.
Contributor guide
Research direction
Start in src/stackset.ts, especially the role and StackSet setup around the linked line, and reproduce the self-managed deployment path described in the report. Trace the resource dependency and creation order, then verify deployment waits for the IAM role and the duplicate policy noted at line 621 is no longer added.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100