(auth) Disable fallback to user's role when a `cdk-*` role cannot be assumed
- Dominant language
- TypeScript
- Stars
- 105
- Forks
- 122
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 71
Description
### Describe the feature
When running `deploy` or `destroy` commands, it would be amazing if the CDK would fail when a `cdk-*` role cannot be assumed (e.g. `cdk-lookup` or `cdk-deploy`).
### Use Case
It's very easy to use/paste an incorrect Account ID in the `CDK_DEPLOY_ACCOUNT` when running CDK locally. When that happens, users can accidentally deploy local changes to the production environments.
I know that it would have to be a coincidence of selecting the wrong account ID along with the wrong profile. However, if CDK would not fall back to the user's profile by default, it would be possible to define a `Trust policy` at the `cdk-*` role level allowing only pipelines (e.g. OIDC roles) to perform production deployments.
### Proposed Solution
1. Prevent a fallback to the user's role when the `cdk-*` role cannot be assumed.
2. Introduce a `--force` parameter that would fall back to the user's role even if the CDK roles can't be assumed.
### Other Information
_No response_
### Acknowledgements
- [ ] I may be able to implement this feature request
- [ ] This feature might incur a breaking change
### CDK version used
2.140.0
### Environment details (OS name and version, etc.)
macOS 14.5
Contributor guide
Assessment
This issue has not been assessed yet.