diff --git a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts index 59ca81f75f..853aab95a1 100644 --- a/packages/@cdktf/cli-core/src/lib/cdktf-project.ts +++ b/packages/@cdktf/cli-core/src/lib/cdktf-project.ts @@ -70,20 +70,29 @@ export type MultipleStackOptions = { stackNames?: string[]; }; +export type SkipSynthOptions = { + skipSynth?: boolean; +}; + +export type FetchOutputOptions = SkipSynthOptions & MultipleStackOptions; + export type AutoApproveOptions = { autoApprove?: boolean; }; -export type DiffOptions = SingleStackOptions & { - refreshOnly?: boolean; - terraformParallelism?: number; - vars?: string[]; - varFiles?: string[]; - noColor?: boolean; - migrateState?: boolean; -}; +export type DiffOptions = SingleStackOptions & + SkipSynthOptions & { + refreshOnly?: boolean; + terraformParallelism?: number; + vars?: string[]; + varFiles?: string[]; + noColor?: boolean; + migrateState?: boolean; + skipSynth?: boolean; + }; export type MutationOptions = MultipleStackOptions & + SkipSynthOptions & AutoApproveOptions & { refreshOnly?: boolean; ignoreMissingStackDependencies?: boolean; @@ -362,8 +371,22 @@ export class CdktfProject { return stacks; } + public async readSynthesizedStacks() { + const stacks = await SynthStack.readSynthesizedStacks(this.outDir); + + printAnnotations(stacks); + + this.onUpdate({ + type: "synthesized", + stacks, + }); + return stacks; + } + public async diff(opts: DiffOptions = {}) { - const stacks = await this.synth(); + const stacks = opts.skipSynth + ? await this.readSynthesizedStacks() + : await this.synth(); const stack = this.getStackExecutor( getSingleStack(stacks, opts?.stackName, "diff") ); @@ -459,7 +482,9 @@ export class CdktfProject { } public async deploy(opts: MutationOptions = {}) { - const stacks = await this.synth(); + const stacks = opts.skipSynth + ? await this.readSynthesizedStacks() + : await this.synth(); const stacksToRun = getMultipleStacks(stacks, opts.stackNames, "deploy"); if (!opts.ignoreMissingStackDependencies) { checkIfAllDependenciesAreIncluded(stacksToRun); @@ -515,7 +540,9 @@ export class CdktfProject { } public async destroy(opts: MutationOptions = {}) { - const stacks = await this.synth(); + const stacks = opts.skipSynth + ? await this.readSynthesizedStacks() + : await this.synth(); const stacksToRun = getMultipleStacks(stacks, opts.stackNames, "destroy"); if (!opts.ignoreMissingStackDependencies) { @@ -597,8 +624,10 @@ export class CdktfProject { }); } - public async fetchOutputs(opts: MultipleStackOptions) { - const stacks = await this.synth(); + public async fetchOutputs(opts: FetchOutputOptions) { + const stacks = opts.skipSynth + ? await this.readSynthesizedStacks() + : await this.synth(); const stacksToRun = getMultipleStacks( stacks, diff --git a/packages/@cdktf/cli-core/src/lib/synth-stack.ts b/packages/@cdktf/cli-core/src/lib/synth-stack.ts index bc2236bb8e..8b940a0e64 100644 --- a/packages/@cdktf/cli-core/src/lib/synth-stack.ts +++ b/packages/@cdktf/cli-core/src/lib/synth-stack.ts @@ -153,8 +153,14 @@ Command output on stdout: process.exit(1); } - if (!(await fs.pathExists(path.join(outdir, Manifest.fileName)))) { - const errorMessage = `ERROR: synthesis failed, because app was expected to call 'synth()', but didn't. Thus "${outdir}/${Manifest.fileName}" was not created.`; + // end performance timer + const endTime = performance.now(); + + let stacks: SynthesizedStack[] = []; + try { + stacks = await SynthStack.readSynthesizedStacks(outdir); + } catch (e: any) { + const errorMessage = `ERROR: synthesis failed, because app was expected to call 'synth()', but didn't. Thus "${outdir}/${Manifest.fileName}" was not created: ${e}`; if (graceful) { throw new Error(errorMessage); } @@ -162,12 +168,37 @@ Command output on stdout: process.exit(1); } - // end performance timer - const endTime = performance.now(); + await this.synthTelemetry(endTime - startTime, stacks, synthOrigin); + + if (stacks.length === 0) { + logger.error("ERROR: No Terraform code synthesized."); + } + + const stackNames = stacks.map((s) => s.name); + const orphanedDirectories = existingDirectories.filter( + (e) => !stackNames.includes(path.basename(e)) + ); + + for (const orphanedDirectory of orphanedDirectories) { + fs.rmSync(orphanedDirectory, { recursive: true }); + } + + return stacks; + } + + public static async readSynthesizedStacks( + outdir: string + ): Promise { + const manifestPath = path.join(outdir, Manifest.fileName); + if (!(await fs.pathExists(manifestPath))) { + throw new Error( + `Could not find manifest file at ${manifestPath}. In case --skip-synth was passed, please try again without the flag.` + ); + } const stacks: SynthesizedStack[] = []; const manifest = JSON.parse( - fs.readFileSync(path.join(outdir, Manifest.fileName)).toString() + fs.readFileSync(manifestPath).toString() ) as ManifestJson; for (const stackName in manifest.stacks) { @@ -183,21 +214,6 @@ Command output on stdout: }); } - await this.synthTelemetry(endTime - startTime, stacks, synthOrigin); - - if (stacks.length === 0) { - logger.error("ERROR: No Terraform code synthesized."); - } - - const stackNames = stacks.map((s) => s.name); - const orphanedDirectories = existingDirectories.filter( - (e) => !stackNames.includes(path.basename(e)) - ); - - for (const orphanedDirectory of orphanedDirectories) { - fs.rmSync(orphanedDirectory, { recursive: true }); - } - return stacks; } diff --git a/packages/cdktf-cli/src/bin/cmds/deploy.ts b/packages/cdktf-cli/src/bin/cmds/deploy.ts index 40516295f4..d2cb2f8f34 100644 --- a/packages/cdktf-cli/src/bin/cmds/deploy.ts +++ b/packages/cdktf-cli/src/bin/cmds/deploy.ts @@ -102,6 +102,12 @@ class Command extends BaseCommand { required: false, desc: "Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file.", }) + .option("skip-synth", { + type: "boolean", + default: false, + required: false, + desc: "Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date", + }) .showHelpOnFail(true); public async handleCommand(argv: any) { diff --git a/packages/cdktf-cli/src/bin/cmds/destroy.ts b/packages/cdktf-cli/src/bin/cmds/destroy.ts index 92a456c51e..9a41c91524 100644 --- a/packages/cdktf-cli/src/bin/cmds/destroy.ts +++ b/packages/cdktf-cli/src/bin/cmds/destroy.ts @@ -79,6 +79,12 @@ class Command extends BaseCommand { required: false, desc: "Pass this flag after switching state backends to approve a state migration for all targeted stacks", }) + .option("skip-synth", { + type: "boolean", + default: false, + required: false, + desc: "Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date", + }) .showHelpOnFail(true); public async handleCommand(argv: any) { diff --git a/packages/cdktf-cli/src/bin/cmds/diff.ts b/packages/cdktf-cli/src/bin/cmds/diff.ts index 183c64b185..fe2f8f9dd8 100644 --- a/packages/cdktf-cli/src/bin/cmds/diff.ts +++ b/packages/cdktf-cli/src/bin/cmds/diff.ts @@ -71,6 +71,12 @@ class Command extends BaseCommand { required: false, desc: "Pass this flag after switching state backends to approve a state migration for the targeted stack", }) + .option("skip-synth", { + type: "boolean", + default: false, + required: false, + desc: "Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date", + }) .showHelpOnFail(true); public async handleCommand(argv: any) { diff --git a/packages/cdktf-cli/src/bin/cmds/handlers.ts b/packages/cdktf-cli/src/bin/cmds/handlers.ts index 1b95413e7e..4ede100bc9 100644 --- a/packages/cdktf-cli/src/bin/cmds/handlers.ts +++ b/packages/cdktf-cli/src/bin/cmds/handlers.ts @@ -137,6 +137,7 @@ export async function deploy(argv: any) { const varFiles = sanitizeVarFiles(argv.varFile); const noColor = argv.noColor; const migrateState = argv.migrateState; + const skipSynth = argv.skipSynth; let outputsPath: string | undefined = undefined; // eslint-disable-next-line @typescript-eslint/no-empty-function @@ -163,6 +164,7 @@ export async function deploy(argv: any) { varFiles, noColor, migrateState, + skipSynth, }) ); } @@ -184,6 +186,7 @@ export async function destroy(argv: any) { const varFiles = sanitizeVarFiles(argv.varFile); const noColor = argv.noColor; const migrateState = argv.migrateState; + const skipSynth = argv.skipSynth; await renderInk( React.createElement(Destroy, { @@ -198,6 +201,7 @@ export async function destroy(argv: any) { varFiles, noColor, migrateState, + skipSynth, }) ); } @@ -216,6 +220,7 @@ export async function diff(argv: any) { const varFiles = sanitizeVarFiles(argv.varFile); const noColor = argv.noColor; const migrateState = argv.migrateState; + const skipSynth = argv.skipSynth; await renderInk( React.createElement(Diff, { @@ -228,6 +233,7 @@ export async function diff(argv: any) { varFiles, noColor, migrateState, + skipSynth, }) ); } @@ -437,6 +443,7 @@ export async function output(argv: any) { const outDir = argv.output; const stacks = argv.stacks; const includeSensitiveOutputs = argv.outputsFileIncludeSensitiveOutputs; + const skipSynth = argv.skipSynth; let outputsPath: string | undefined = undefined; // eslint-disable-next-line @typescript-eslint/no-empty-function let onOutputsRetrieved: (outputs: NestedTerraformOutputs) => void = () => {}; @@ -454,6 +461,7 @@ export async function output(argv: any) { synthCommand: command, onOutputsRetrieved, outputsPath, + skipSynth, }) ); } diff --git a/packages/cdktf-cli/src/bin/cmds/output.ts b/packages/cdktf-cli/src/bin/cmds/output.ts index 4d502ba4ec..b4c1af253a 100644 --- a/packages/cdktf-cli/src/bin/cmds/output.ts +++ b/packages/cdktf-cli/src/bin/cmds/output.ts @@ -42,6 +42,12 @@ class Command extends BaseCommand { desc: "Whether to include sensitive outputs in the output file", default: false, }) + .option("skip-synth", { + type: "boolean", + default: false, + required: false, + desc: "Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date", + }) .showHelpOnFail(true); public async handleCommand(argv: any) { diff --git a/packages/cdktf-cli/src/bin/cmds/ui/deploy.tsx b/packages/cdktf-cli/src/bin/cmds/ui/deploy.tsx index b85d0a9ec2..a35a312c82 100644 --- a/packages/cdktf-cli/src/bin/cmds/ui/deploy.tsx +++ b/packages/cdktf-cli/src/bin/cmds/ui/deploy.tsx @@ -66,6 +66,7 @@ interface DeployConfig { varFiles?: string[]; noColor?: boolean; migrateState?: boolean; + skipSynth?: boolean; } export const Deploy = ({ @@ -83,6 +84,7 @@ export const Deploy = ({ varFiles, noColor, migrateState, + skipSynth, }: DeployConfig): React.ReactElement => { const [outputs, setOutputs] = useState(); const { status, logEntries } = useCdktfProject( @@ -99,6 +101,7 @@ export const Deploy = ({ varFiles, noColor, migrateState, + skipSynth, }); if (onOutputsRetrieved) { diff --git a/packages/cdktf-cli/src/bin/cmds/ui/destroy.tsx b/packages/cdktf-cli/src/bin/cmds/ui/destroy.tsx index 073a86d113..5f7e857108 100644 --- a/packages/cdktf-cli/src/bin/cmds/ui/destroy.tsx +++ b/packages/cdktf-cli/src/bin/cmds/ui/destroy.tsx @@ -26,6 +26,7 @@ interface DestroyConfig { migrateState?: boolean; vars?: string[]; varFiles?: string[]; + skipSynth?: boolean; } export const Destroy = ({ @@ -40,6 +41,7 @@ export const Destroy = ({ migrateState, vars, varFiles, + skipSynth, }: DestroyConfig): React.ReactElement => { const { status, logEntries } = useCdktfProject( { outDir, synthCommand }, @@ -54,6 +56,7 @@ export const Destroy = ({ migrateState, vars, varFiles, + skipSynth, }) ); diff --git a/packages/cdktf-cli/src/bin/cmds/ui/diff.tsx b/packages/cdktf-cli/src/bin/cmds/ui/diff.tsx index 0f3a9ed29a..16d689b447 100644 --- a/packages/cdktf-cli/src/bin/cmds/ui/diff.tsx +++ b/packages/cdktf-cli/src/bin/cmds/ui/diff.tsx @@ -18,6 +18,7 @@ interface DiffConfig { varFiles?: string[]; noColor?: boolean; migrateState?: boolean; + skipSynth?: boolean; } export const Diff = ({ @@ -30,6 +31,7 @@ export const Diff = ({ varFiles, noColor, migrateState, + skipSynth, }: DiffConfig): React.ReactElement => { const { status, logEntries } = useCdktfProject( { outDir, synthCommand }, @@ -42,6 +44,7 @@ export const Diff = ({ varFiles, noColor, migrateState, + skipSynth, }) ); diff --git a/packages/cdktf-cli/src/bin/cmds/ui/output.tsx b/packages/cdktf-cli/src/bin/cmds/ui/output.tsx index ea0fa9047a..f32a3a2f9c 100644 --- a/packages/cdktf-cli/src/bin/cmds/ui/output.tsx +++ b/packages/cdktf-cli/src/bin/cmds/ui/output.tsx @@ -15,6 +15,7 @@ type OutputConfig = { synthCommand: string; onOutputsRetrieved: (outputs: NestedTerraformOutputs) => void; outputsPath?: string; + skipSynth?: boolean; }; export const Output = ({ @@ -23,11 +24,15 @@ export const Output = ({ synthCommand, onOutputsRetrieved, outputsPath, + skipSynth, }: OutputConfig): React.ReactElement => { const { status, logEntries, returnValue } = useCdktfProject( { outDir, synthCommand }, async (project) => { - const outputs = await project.fetchOutputs({ stackNames: targetStacks }); + const outputs = await project.fetchOutputs({ + stackNames: targetStacks, + skipSynth, + }); onOutputsRetrieved(outputs); return outputs; } diff --git a/website/docs/cdktf/cli-reference/commands.mdx b/website/docs/cdktf/cli-reference/commands.mdx index 307ea9711b..f5d2ef2b0b 100644 --- a/website/docs/cdktf/cli-reference/commands.mdx +++ b/website/docs/cdktf/cli-reference/commands.mdx @@ -147,26 +147,31 @@ cdktf deploy [stacks...] Deploy the given stacks Positionals: - stacks Deploy stacks matching the given ids. Required when more than one stack is present in the app [array] [default: []] + stacks Deploy stacks matching the given ids. Required when more than one stack is present in the app [array] [default: []] Options: - --version Show version number [boolean] - --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. [boolean] [default: false] - --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] - -a, --app Command to use in order to execute cdktf app [required] [default: "npx ts-node main.ts"] - -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] - --auto-approve Auto approve [boolean] [default: false] - --outputs-file Path to file where stack outputs will be written as JSON [string] - --outputs-file-include-sensitive-outputs Whether to include sensitive outputs in the output file [boolean] [default: false] - --ignore-missing-stack-dependencies Don't check if all stacks specified in the command have their dependencies included as well [boolean] [default: false] - --parallelism Number of concurrent CDKTF stacks to run. Defaults to infinity, denoted by -1 [number] [default: -1] - --refresh-only Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to undo any changes made outside of Terraform. [boolean] [default: false] - --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend [number] [default: -1] - --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] - --migrate-state Pass this flag after switching state backends to approve a state migration for all targeted stacks [boolean] [default: false] - --var Set a value for one of the input variables in the stack or stacks to apply. Use this option more than once to set more than one variable. [array] [default: []] - --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file. [array] [default: []] - -h, --help Show help [boolean] + --version Show version number [boolean] + --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. + [boolean] [default: false] + --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] + -a, --app Command to use in order to execute cdktf app [required] + -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] + --auto-approve Auto approve [boolean] [default: false] + --outputs-file Path to file where stack outputs will be written as JSON [string] + --outputs-file-include-sensitive-outputs Whether to include sensitive outputs in the output file [boolean] [default: false] + --ignore-missing-stack-dependencies Don't check if all stacks specified in the command have their dependencies included as well [boolean] [default: false] + --parallelism Number of concurrent CDKTF stacks to run. Defaults to infinity, denoted by -1 [number] [default: -1] + --refresh-only Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to + undo any changes made outside of Terraform. [boolean] [default: false] + --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend + [number] [default: -1] + --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] + --migrate-state Pass this flag after switching state backends to approve a state migration for all targeted stacks [boolean] [default: false] + --var Set a value for one of the input variables in the stack or stacks to apply. Use this option more than once to set more than one variable. [array] [default: []] + --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one + variables file. [array] [default: []] + --skip-synth Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date [boolean] [default: false] + -h, --help Show help [boolean] ``` ~> **Note:** The `parallelism` flag has a different behavior than the [terraform parallelism flag](/terraform/cli/commands/apply#parallelism-n). To set the custom terraform parallelism flag, please use the `--terraform-parallelism` flag instead. @@ -223,23 +228,27 @@ cdktf destroy [stacks..] Destroy the given stacks Positionals: - stacks Destroy stacks matching the given ids. Required when more than one stack is present in the app [array] [default: []] + stacks Destroy stacks matching the given ids. Required when more than one stack is present in the app [array] [default: []] Options: - --version Show version number [boolean] - --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. [boolean] [default: false] - --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] - -a, --app Command to use in order to execute cdktf app [required] [default: "npx ts-node main.ts"] - -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] - --auto-approve Auto approve [boolean] [default: false] - --ignore-missing-stack-dependencies Don't check if all stacks specified in the command have their dependencies included as well [boolean] [default: false] - --parallelism Number of concurrent CDKTF stacks to run. Defaults to infinity, denoted by -1 [number] [default: -1] - --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend [number] [default: -1] - --var Set a value for one of the input variables in the stack or stacks to apply. Use this option more than once to set more than one variable. [array] [default: []] - --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file. [array] [default: []] - --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] - --migrate-state Pass this flag after switching state backends to approve a state migration for all targeted stacks [boolean] [default: false] - -h, --help Show help [boolean] + --version Show version number [boolean] + --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. + [boolean] [default: false] + --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] + -a, --app Command to use in order to execute cdktf app [required] + -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] + --auto-approve Auto approve [boolean] [default: false] + --ignore-missing-stack-dependencies Don't check if all stacks specified in the command have their dependencies included as well [boolean] [default: false] + --parallelism Number of concurrent CDKTF stacks to run. Defaults to infinity, denoted by -1 [number] [default: -1] + --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend + [number] [default: -1] + --var Set a value for one of the input variables in the stack or stacks to apply. Use this option more than once to set more than one variable. [array] [default: []] + --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables + file. [array] [default: []] + --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] + --migrate-state Pass this flag after switching state backends to approve a state migration for all targeted stacks [boolean] [default: false] + --skip-synth Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date [boolean] [default: false] + -h, --help Show help [boolean] ``` ~> **Note:** The `parallelism` flag has a different behavior than the [terraform parallelism flag](/terraform/cli/commands/apply#parallelism-n). To set the custom terraform parallelism flag, please use the `--terraform-parallelism` flag instead. @@ -294,21 +303,26 @@ cdktf diff [stack] Perform a diff (terraform plan) for the given stack Positionals: - stack Diff stack which matches the given id only. Required when more than one stack is present in the app [string] + stack Diff stack which matches the given id only. Required when more than one stack is present in the app [string] Options: - --version Show version number [boolean] - --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. [boolean] [default: false] - --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] - -a, --app Command to use in order to execute cdktf app [required] [default: "npx ts-node main.ts"] - -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] - --refresh-only Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to undo any changes made outside of Terraform. [boolean] [default: false] - --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend [number] [default: -1] - --var Set a value for one of the input variables in the stack. Use this option more than once to set more than one variable. [array] [default: []] - --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file. [array] [default: []] - --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] - --migrate-state Pass this flag after switching state backends to approve a state migration for the targeted stack [boolean] [default: false] - -h, --help Show help [boolean] + --version Show version number [boolean] + --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. + [boolean] [default: false] + --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] + -a, --app Command to use in order to execute cdktf app [required] + -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] + --refresh-only Select the "refresh only" planning mode, which checks whether remote objects still match the outcome of the most recent Terraform apply but does not propose any actions to undo any changes + made outside of Terraform. [boolean] [default: false] + --terraform-parallelism Forwards value as the `-parallelism` flag to Terraform. By default, the this flag is not forwarded to Terraform. Note: This flag is not supported by remote / cloud backend + [number] [default: -1] + --var Set a value for one of the input variables in the stack. Use this option more than once to set more than one variable. [array] [default: []] + --var-file Load variable values from the given file, in addition to the default files terraform.tfvars and *.auto.tfvars. Use this option more than once to include more than one variables file. + [array] [default: []] + --no-color Disables terminal formatting sequences in the output. [boolean] [default: false] + --migrate-state Pass this flag after switching state backends to approve a state migration for the targeted stack [boolean] [default: false] + --skip-synth Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date [boolean] [default: false] + -h, --help Show help [boolean] ``` ~> **Note:** The `parallelism` flag has a different behavior than the [terraform parallelism flag](/terraform/cli/commands/plan#parallelism-n). To set the custom terraform parallelism flag, please use the `--terraform-parallelism` flag instead. @@ -584,17 +598,18 @@ cdktf output [stack] [OPTIONS] Prints the output of stacks Positionals: - stacks Get outputs of the stacks matching the given ids. Required when more than one stack is present in the app [string] + stacks Get outputs of the stacks matching the given ids. Required when more than one stack is present in the app [array] [default: []] Options: --version Show version number [boolean] --disable-plugin-cache-env Dont set TF_PLUGIN_CACHE_DIR automatically. This is useful when the plugin cache is configured differently. Supported using the env CDKTF_DISABLE_PLUGIN_CACHE_ENV. [boolean] [default: false] --log-level Which log level should be written. Only supported via setting the env CDKTF_LOG_LEVEL [string] - -a, --app Command to use in order to execute cdktf app [required] [default: "npx ts-node main.ts"] - -o, --output Output directory [required] [default: "cdktf.out"] + -a, --app Command to use in order to execute cdktf app [required] + -o, --output Output directory for the synthesized Terraform config [required] [default: "cdktf.out"] --outputs-file Path to file where stack outputs will be written as JSON [string] --outputs-file-include-sensitive-outputs Whether to include sensitive outputs in the output file [boolean] [default: false] + --skip-synth Skip synthesis of the application, assume the synthesized Terraform code is already present and up to date [boolean] [default: false] -h, --help Show help [boolean] ```