From 78b9859ed928c5163ace32c86070fa15f23aa304 Mon Sep 17 00:00:00 2001 From: nitintecg Date: Wed, 6 Mar 2024 02:08:54 +0530 Subject: [PATCH] feat(terraform): add varfile option in terraform plan executor --- packages/terraform/src/utils/create-executor.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/terraform/src/utils/create-executor.ts b/packages/terraform/src/utils/create-executor.ts index 139c4a1b..1319af1c 100644 --- a/packages/terraform/src/utils/create-executor.ts +++ b/packages/terraform/src/utils/create-executor.ts @@ -12,6 +12,7 @@ export interface ExecutorOptions { upgrade: boolean migrateState: boolean lock: boolean + varFile: string [key: string]: string | unknown } @@ -26,7 +27,7 @@ export function createExecutor(command: string) { } const { sourceRoot } = context.workspace.projects[context.projectName] - const { backendConfig = [], planFile, ciMode, autoApproval, formatWrite, upgrade, migrateState, lock } = options + const { backendConfig = [], planFile, ciMode, autoApproval, formatWrite, upgrade, migrateState, lock, varFile } = options let env = {} if (ciMode) { @@ -44,6 +45,7 @@ export function createExecutor(command: string) { (config) => `-backend-config="${config.key}=${config.name}"` ), command === 'plan' && planFile && `-out ${planFile}`, + command === 'plan' && varFile && `--var-file ${varFile}`, command === 'destroy' && autoApproval && '-auto-approve', command === 'apply' && autoApproval && '-auto-approve', command === 'apply' && planFile,