From 01ac49eb69a973b305e096b115c8a686d7517500 Mon Sep 17 00:00:00 2001 From: Matteo Sessa Date: Tue, 14 Jan 2025 17:04:44 +1100 Subject: [PATCH] chore: rename local to template-only --- packages/aws-cdk/README.md | 2 +- packages/aws-cdk/lib/cdk-toolkit.ts | 6 +++--- packages/aws-cdk/lib/config.ts | 6 +++--- packages/aws-cdk/lib/parse-command-line-arguments.ts | 4 ++-- packages/aws-cdk/lib/user-input.ts | 2 +- packages/aws-cdk/test/diff.test.ts | 6 +++--- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/aws-cdk/README.md b/packages/aws-cdk/README.md index 804c89fcd1ffd..77cdfe9594c66 100644 --- a/packages/aws-cdk/README.md +++ b/packages/aws-cdk/README.md @@ -173,7 +173,7 @@ The `mode` option selects the approach that will be used to analyze the differen - When set to `auto`: CDK will first attempt to create a ChangeSet, should that not be possible due to the stack not yet being created, or any error encountered during the creation of the StackSet, it will automatically fallback to `local` mode. - When set to `change-set`: CDK will create a change set and extract resource replacement data from it. This is a bit slower, but will provide no false positives for resource replacement. Errors in creating a change-set will result in a non-zero exit code. Note that when using this mode against a stack that has not been created will still result in a fallback to `local` mode. Also note that this mode will always return an error when used against stacks that contain nested stacks. -- When set to `local`: CDK will compare the local template with the template currently applied to the stack. Note that this mode will consider any change to a property that requires replacement to be a resource replacement, even if the change is purely cosmetic (like replacing a resource reference with a hardcoded arn) +- When set to `template-only`: CDK will compare the local template with the template currently applied to the stack. Note that this mode will consider any change to a property that requires replacement to be a resource replacement, even if the change is purely cosmetic (like replacing a resource reference with a hardcoded arn) ### `cdk deploy` diff --git a/packages/aws-cdk/lib/cdk-toolkit.ts b/packages/aws-cdk/lib/cdk-toolkit.ts index 8c9a2a88cc4a5..ca7aab1fae89c 100644 --- a/packages/aws-cdk/lib/cdk-toolkit.ts +++ b/packages/aws-cdk/lib/cdk-toolkit.ts @@ -1433,13 +1433,13 @@ export interface DiffOptions { changeSet?: boolean; /** - * Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to local mode. + * Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to template-only mode. * Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. - * Local mode compares the current local template with template applied on the stack + * Template-only mode compares the current local template with template applied on the stack * * @default 'auto' */ - mode?: 'auto' | 'change-set' | 'local'; + mode?: 'auto' | 'change-set' | 'template-only'; } interface CfnDeployOptions { diff --git a/packages/aws-cdk/lib/config.ts b/packages/aws-cdk/lib/config.ts index ff59bc11b8912..a8ed17c69a804 100644 --- a/packages/aws-cdk/lib/config.ts +++ b/packages/aws-cdk/lib/config.ts @@ -313,14 +313,14 @@ export async function makeConfig(): Promise { 'change-set': { type: 'boolean', alias: 'changeset', desc: 'Whether to create a changeset to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role', conflicts: 'mode', deprecated: 'Use mode=auto or mode=local instead' }, 'mode': { type: 'string', - choices: ['auto', 'change-set', 'local'], + choices: ['auto', 'change-set', 'template-only'], default: 'auto', conflicts: 'change-set', requiresArg: true, desc: 'How to perform the the diff operation. ' + - 'Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to local mode. ' + + 'Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to template-only mode. ' + 'Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. Unhandled errors in change-set creation will return a non-zero exit code ' + - 'Local mode compares the current local template with template applied on the stack', + 'Template-only mode compares the current local template with template applied on the stack', }, }, }, diff --git a/packages/aws-cdk/lib/parse-command-line-arguments.ts b/packages/aws-cdk/lib/parse-command-line-arguments.ts index fdc08ebfe6f00..d4876ef03f39a 100644 --- a/packages/aws-cdk/lib/parse-command-line-arguments.ts +++ b/packages/aws-cdk/lib/parse-command-line-arguments.ts @@ -716,10 +716,10 @@ export function parseCommandLineArguments(args: Array): any { .option('mode', { default: 'auto', type: 'string', - choices: ['auto', 'change-set', 'local'], + choices: ['auto', 'change-set', 'template-only'], conflicts: 'change-set', requiresArg: true, - desc: 'How to perform the the diff operation. Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to local mode. Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. Unhandled errors in change-set creation will return a non-zero exit code Local mode compares the current local template with template applied on the stack', + desc: 'How to perform the the diff operation. Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to template-only mode. Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. Unhandled errors in change-set creation will return a non-zero exit code Template-only mode compares the current local template with template applied on the stack', }), ) .command('metadata [STACK]', 'Returns all metadata associated with this stack') diff --git a/packages/aws-cdk/lib/user-input.ts b/packages/aws-cdk/lib/user-input.ts index dbd693d4c0735..e4b7ac3de3225 100644 --- a/packages/aws-cdk/lib/user-input.ts +++ b/packages/aws-cdk/lib/user-input.ts @@ -1100,7 +1100,7 @@ export interface DiffOptions { readonly changeSet?: boolean; /** - * How to perform the the diff operation. Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to local mode. Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. Unhandled errors in change-set creation will return a non-zero exit code Local mode compares the current local template with template applied on the stack + * How to perform the the diff operation. Auto mode will first attempt to use change-set mode, and if any error should occur it will fallback to template-only mode. Change-set mode will use a change-set to analyze resource replacements. In this mode, diff will use the deploy role instead of the lookup role. Unhandled errors in change-set creation will return a non-zero exit code Template-only mode compares the current local template with template applied on the stack * * @default - "auto" */ diff --git a/packages/aws-cdk/test/diff.test.ts b/packages/aws-cdk/test/diff.test.ts index 45293b40e382d..0391a2735d241 100644 --- a/packages/aws-cdk/test/diff.test.ts +++ b/packages/aws-cdk/test/diff.test.ts @@ -584,7 +584,7 @@ describe('stack exists checks', () => { expect(cloudFormation.stackExists).not.toHaveBeenCalled(); }); - test('diff does not check for stack existence when --mode=local is passed', async () => { + test('diff does not check for stack existence when --mode=template-only is passed', async () => { // GIVEN const buffer = new StringWritable(); @@ -594,7 +594,7 @@ describe('stack exists checks', () => { stream: buffer, fail: false, quiet: true, - mode: 'local', + mode: 'template-only', }); // THEN @@ -920,7 +920,7 @@ describe('nested stacks', () => { const exitCode = await toolkit.diff({ stackNames: ['Parent'], stream: buffer, - mode: 'local', + mode: 'template-only', }); // THEN