Skip to content

Commit

Permalink
chore: rename local to template-only
Browse files Browse the repository at this point in the history
  • Loading branch information
msessa committed Jan 14, 2025
1 parent 7a8dc32 commit 01ac49e
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion packages/aws-cdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk/lib/cdk-toolkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk/lib/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,14 +313,14 @@ export async function makeConfig(): Promise<CliConfig> {
'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',
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-cdk/lib/parse-command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,10 @@ export function parseCommandLineArguments(args: Array<string>): 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')
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/user-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/aws-cdk/test/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand All @@ -594,7 +594,7 @@ describe('stack exists checks', () => {
stream: buffer,
fail: false,
quiet: true,
mode: 'local',
mode: 'template-only',
});

// THEN
Expand Down Expand Up @@ -920,7 +920,7 @@ describe('nested stacks', () => {
const exitCode = await toolkit.diff({
stackNames: ['Parent'],
stream: buffer,
mode: 'local',
mode: 'template-only',
});

// THEN
Expand Down

0 comments on commit 01ac49e

Please sign in to comment.