Skip to content

Commit

Permalink
feat(terraform): add varfile option in terraform plan executor (#239)
Browse files Browse the repository at this point in the history
This PR adds new varfile option in terraform plan executor and it fixes
issue #236
  • Loading branch information
TriPSs authored Mar 6, 2024
2 parents 53e80c7 + 78b9859 commit 9873db3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/terraform/src/utils/create-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ExecutorOptions {
upgrade: boolean
migrateState: boolean
lock: boolean
varFile: string

[key: string]: string | unknown
}
Expand All @@ -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) {
Expand All @@ -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,
Expand Down

0 comments on commit 9873db3

Please sign in to comment.