Conversation
The `import` command's `--record-resource-mapping` option defined `-r` as an alias, which conflicts with the global `--role-arn` option that also uses `-r`. When yargs sees both options with the same alias, it assigns the value to both, causing the role ARN to be incorrectly treated as a file path for recording resource mappings. This fix removes the `-r` alias from `--record-resource-mapping`, allowing the global `--role-arn` option to retain exclusive use of `-r`. Fixes aws#1175 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
cdk import the option--role-arn is also parsed as --record-resource-mapping, creating a mapping file path from ARN
|
@abhu85 we require you to include the contributor statement, see PR template: https://github.com/aws/aws-cdk-cli/blob/main/.github/pull_request_template.md Tip: I instruct my AI Agents to always look the PR template for the current repo. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1177 +/- ##
==========================================
- Coverage 87.76% 87.76% -0.01%
==========================================
Files 72 72
Lines 10137 10136 -1
Branches 1339 1338 -1
==========================================
- Hits 8897 8896 -1
Misses 1215 1215
Partials 25 25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks @mrgrain! I've updated the PR description to include the contributor statement and checklist from the template. Good tip about checking the PR template - I'll make sure to do that going forward. 👍 |
Fixes #1175
Summary
The
cdk importcommand's--record-resource-mappingoption defined-ras an alias, which conflicts with the global--role-arnoption that also uses-r. When yargs sees both options with the same alias, it assigns the value to both, causing the role ARN to be incorrectly treated as a file path for recording resource mappings.Root Cause
Fix
This PR removes the
-ralias from--record-resource-mappingin the import command definition, allowing the global--role-arnoption to retain exclusive use of-r.Files Changed
packages/aws-cdk/lib/cli/cli-config.ts- Source of truth (removedalias: 'r')packages/aws-cdk/lib/cli/parse-command-line-arguments.ts- Generated parserpackages/aws-cdk/lib/cli/cli-type-registry.json- Type registryTest Plan
--role-arnoption retains its-ralias--record-resource-mappingstill works with its full nameThe fix was validated against the reproduction provided in issue comment by @pahud, which confirmed that removing the alias resolves the collision.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Generated with Claude Code