From 255e63938a265dfae6daae286d780faaca5feca4 Mon Sep 17 00:00:00 2001 From: abhu85 <60182103+abhu85@users.noreply.github.com> Date: Tue, 24 Feb 2026 10:49:53 +0000 Subject: [PATCH] fix(import): remove conflicting -r alias from --record-resource-mapping 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 #1175 Co-Authored-By: Claude Opus 4.6 --- packages/aws-cdk/lib/cli/cli-config.ts | 1 - packages/aws-cdk/lib/cli/cli-type-registry.json | 1 - packages/aws-cdk/lib/cli/parse-command-line-arguments.ts | 1 - 3 files changed, 3 deletions(-) diff --git a/packages/aws-cdk/lib/cli/cli-config.ts b/packages/aws-cdk/lib/cli/cli-config.ts index 51eb6c987..2d212898b 100644 --- a/packages/aws-cdk/lib/cli/cli-config.ts +++ b/packages/aws-cdk/lib/cli/cli-config.ts @@ -266,7 +266,6 @@ export async function makeConfig(): Promise { }, 'record-resource-mapping': { type: 'string', - alias: 'r', requiresArg: true, desc: 'If specified, CDK will generate a mapping of existing physical resources to CDK resources to be imported as. The mapping ' + 'will be written in the given file path. No actual import operation will be performed', diff --git a/packages/aws-cdk/lib/cli/cli-type-registry.json b/packages/aws-cdk/lib/cli/cli-type-registry.json index d854d5460..d4f32d873 100644 --- a/packages/aws-cdk/lib/cli/cli-type-registry.json +++ b/packages/aws-cdk/lib/cli/cli-type-registry.json @@ -633,7 +633,6 @@ }, "record-resource-mapping": { "type": "string", - "alias": "r", "requiresArg": true, "desc": "If specified, CDK will generate a mapping of existing physical resources to CDK resources to be imported as. The mapping will be written in the given file path. No actual import operation will be performed" }, diff --git a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts index bf6ebccca..2a5f9500a 100644 --- a/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/cli/parse-command-line-arguments.ts @@ -664,7 +664,6 @@ export function parseCommandLineArguments(args: Array): any { .option('record-resource-mapping', { default: undefined, type: 'string', - alias: 'r', requiresArg: true, desc: 'If specified, CDK will generate a mapping of existing physical resources to CDK resources to be imported as. The mapping will be written in the given file path. No actual import operation will be performed', })