From 5c839fdeef0fed92b46654a14755ea6f12842be7 Mon Sep 17 00:00:00 2001 From: Willi Kisser Date: Fri, 15 Dec 2023 22:12:44 +0100 Subject: [PATCH] feat: Added lock option to providers target. --- packages/terraform/src/executors/providers/schema.json | 9 ++++++++- packages/terraform/src/generators/init/init.impl.ts | 3 ++- packages/terraform/src/utils/create-executor.ts | 4 +++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/terraform/src/executors/providers/schema.json b/packages/terraform/src/executors/providers/schema.json index d7db0f35..4a4e72e4 100644 --- a/packages/terraform/src/executors/providers/schema.json +++ b/packages/terraform/src/executors/providers/schema.json @@ -5,5 +5,12 @@ "type": "object", "title": "Providers executor", "description": "Providers", - "properties": {} + "properties": { + "lock": { + "type": "boolean", + "title": "Write out dependency locks for the configured providers.", + "description": "Write out dependency locks for the configured providers.", + "default": false + } + } } diff --git a/packages/terraform/src/generators/init/init.impl.ts b/packages/terraform/src/generators/init/init.impl.ts index 6218dd3c..9f5e34b4 100644 --- a/packages/terraform/src/generators/init/init.impl.ts +++ b/packages/terraform/src/generators/init/init.impl.ts @@ -57,7 +57,8 @@ export default async function ( providers: { executor: '@nx-extend/terraform:providers', options: { - ciMode: true + ciMode: true, + lock: true } }, fmt: { diff --git a/packages/terraform/src/utils/create-executor.ts b/packages/terraform/src/utils/create-executor.ts index 70028b86..139c4a1b 100644 --- a/packages/terraform/src/utils/create-executor.ts +++ b/packages/terraform/src/utils/create-executor.ts @@ -11,6 +11,7 @@ export interface ExecutorOptions { formatWrite: boolean upgrade: boolean migrateState: boolean + lock: boolean [key: string]: string | unknown } @@ -25,7 +26,7 @@ export function createExecutor(command: string) { } const { sourceRoot } = context.workspace.projects[context.projectName] - const { backendConfig = [], planFile, ciMode, autoApproval, formatWrite, upgrade, migrateState } = options + const { backendConfig = [], planFile, ciMode, autoApproval, formatWrite, upgrade, migrateState, lock } = options let env = {} if (ciMode) { @@ -50,6 +51,7 @@ export function createExecutor(command: string) { command === 'fmt' && !formatWrite && '--check --list', command === 'init' && upgrade && '-upgrade', command === 'init' && migrateState && '-migrate-state', + command === 'providers' && lock && 'lock', ]), { cwd: sourceRoot,