Parent
Sub-issue 6 of #120 (RFC: Least-privilege CDK bootstrap policies as code)
Branch strategy
feat/bootstrap-preflight → targets feat/bootstrap-aspect
Estimated review time: ~30 min
Summary
Implement a validator that checks the deployed CDKToolkit stack's CloudFormation outputs against the required bootstrap version/hash before deploying. This prevents the "pull latest, deploy, fail 15 minutes later" failure mode.
Deliverables
Key design decisions
- Requires only
cloudformation:DescribeStacks permission (read-only, safe for CI with minimal credentials)
- WARN does not block deploy — hash drift from console edits is advisory, not fatal
- FAIL prints the exact
mise //cdk:bootstrap command needed (copy-paste friendly)
- Validator is importable as a library (for integration tests) and runnable as a CLI entry point (for mise task)
- Uses
@aws-sdk/client-cloudformation (already a transitive dep via CDK)
Acceptance criteria
- All test scenarios pass with mocked AWS responses
mise //cdk:preflight exits cleanly when CDKToolkit outputs match
mise //cdk:preflight exits 1 with actionable message when versions mismatch
- Error messages include the exact command to run (no guessing for operators)
Parent
Sub-issue 6 of #120 (RFC: Least-privilege CDK bootstrap policies as code)
Branch strategy
feat/bootstrap-preflight→ targetsfeat/bootstrap-aspectEstimated review time: ~30 min
Summary
Implement a validator that checks the deployed CDKToolkit stack's CloudFormation outputs against the required bootstrap version/hash before deploying. This prevents the "pull latest, deploy, fail 15 minutes later" failure mode.
Deliverables
cdk/src/bootstrap/preflight/validator.ts:BootstrapPolicyVersion,BootstrapPolicyHash) viaCloudFormation.describeStackscdk/test/bootstrap/validator.test.ts:CloudFormation.describeStacksresponses for each scenariomise //cdk:preflighttask incdk/mise.toml:mise //cdk:bootstrapcommand to fixKey design decisions
cloudformation:DescribeStackspermission (read-only, safe for CI with minimal credentials)mise //cdk:bootstrapcommand needed (copy-paste friendly)@aws-sdk/client-cloudformation(already a transitive dep via CDK)Acceptance criteria
mise //cdk:preflightexits cleanly when CDKToolkit outputs matchmise //cdk:preflightexits 1 with actionable message when versions mismatch