cdklabs / cdklabs/cdk-stacksets
StackSetTarget - Improvement - Prevent empty account ID arrays from being passed down to the CfnStackSet
- Dominant language
- TypeScript
- Stars
- 118
- Forks
- 25
- Avg merge
- 33m
- Merged PRs (30d)
- 4
Description
When using `StackSetTarget.fromOrganizationalUnits(...)` and passing `additionalAccounts` it is possible to pass an empty array which makes sense because of the types that are necessary for that parameter (i.e. `string[] | undefined`).
However, the underlying `CfnStackSet` will cause a validation error when trying to deploy it, because it does not allow the `Accounts` array in the deployment target section to be empty:
The validation error: `[#/StackInstancesGroup/0/DeploymentTargets/Accounts: expected minimum item count: 1, found: 0]`
I'd suggest to add a check for an empty account ID array ([maybe here](https://github.com/cdklabs/cdk-stacksets/blob/9c9fb653cde87378b82afc876e9784f6b9cf142b/src/stackset.ts#L260)) which will transform every empty account ID array into `undefined`.
Contributor guide
Research direction
Start in src/stackset.ts around line 260 and trace StackSetTarget.fromOrganizationalUnits(...) into the CfnStackSet deployment targets. Verify how additionalAccounts is passed through, then confirm that an empty account ID array is omitted while non-empty arrays remain unchanged and deployment validation no longer rejects the target.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100