Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added lock option to providers target. #199

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/terraform/src/executors/providers/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
3 changes: 2 additions & 1 deletion packages/terraform/src/generators/init/init.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default async function (
providers: {
executor: '@nx-extend/terraform:providers',
options: {
ciMode: true
ciMode: true,
lock: true
}
},
fmt: {
Expand Down
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 @@ -11,6 +11,7 @@ export interface ExecutorOptions {
formatWrite: boolean
upgrade: boolean
migrateState: boolean
lock: boolean

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