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(plan,apply): add argument for lock timeout #92

Merged
merged 1 commit into from
Oct 24, 2022
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
5 changes: 5 additions & 0 deletions src/commands/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ parameters:
description: Configure a custom timeout limit
type: string
default: 10m
lock-timeout:
description: Configure a custom state lock timeout
type: string
default: 30s

steps:
- run:
Expand All @@ -53,4 +57,5 @@ steps:
TF_PARAM_BACKEND_CONFIG_FILE: <<parameters.backend_config_file>>
TF_PARAM_CLI_CONFIG_FILE: <<parameters.cli_config_file>>
TF_PARAM_PLAN: <<parameters.plan>>
TF_PARAM_LOCK_TIMEOUT: << parameters.lock-timeout >>
command: <<include(scripts/apply.sh)>>
5 changes: 5 additions & 0 deletions src/commands/plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ parameters:
description: Configure a custom timeout limit
type: string
default: 10m
lock-timeout:
description: Configure a custom state lock timeout
type: string
default: 30s

steps:
- run:
Expand All @@ -53,4 +57,5 @@ steps:
TF_PARAM_BACKEND_CONFIG_FILE: <<parameters.backend_config_file>>
TF_PARAM_CLI_CONFIG_FILE: <<parameters.cli_config_file>>
TF_PARAM_OUT: << parameters.out >>
TF_PARAM_LOCK_TIMEOUT: << parameters.lock-timeout >>
command: <<include(scripts/plan.sh)>>
5 changes: 5 additions & 0 deletions src/jobs/apply.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ parameters:
description: "Configure a custom timeout limit"
type: "string"
default: "10m"
lock-timeout:
description: Configure a custom state lock timeout
type: string
default: 30s
resource_class:
description: "Specify the resource class for Docker Executor"
type: "string"
Expand Down Expand Up @@ -98,6 +102,7 @@ steps:
cli_config_file: << parameters.cli_config_file >>
plan: <<parameters.plan>>
timeout: <<parameters.timeout>>
lock-timeout: <<parameters.lock-timeout>>
- when:
condition: << parameters.persist-workspace >>
steps:
Expand Down
5 changes: 5 additions & 0 deletions src/jobs/plan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ parameters:
description: "Configure a custom timeout limit"
type: "string"
default: "10m"
lock-timeout:
description: Configure a custom state lock timeout
type: string
default: 30s
resource_class:
description: "Specify the resource class for Docker Executor"
type: "string"
Expand Down Expand Up @@ -99,6 +103,7 @@ steps:
cli_config_file: << parameters.cli_config_file >>
out: << parameters.out >>
timeout: <<parameters.timeout>>
lock-timeout: <<parameters.lock-timeout>>
- when:
condition: << parameters.persist-workspace >>
steps:
Expand Down
4 changes: 4 additions & 0 deletions src/scripts/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ if [[ -n "${TF_PARAM_VAR_FILE}" ]]; then
fi
done
fi

if [[ -n "${TF_PARAM_LOCK_TIMEOUT}" ]]; then
PLAN_ARGS="$PLAN_ARGS -lock-timeout=${TF_PARAM_LOCK_TIMEOUT}"
fi
export PLAN_ARGS
# shellcheck disable=SC2086
terraform -chdir="$module_path" init -input=false $INIT_ARGS
Expand Down
4 changes: 4 additions & 0 deletions src/scripts/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ if [[ -n "${TF_PARAM_VAR_FILE}" ]]; then
fi
done
fi

if [[ -n "${TF_PARAM_LOCK_TIMEOUT}" ]]; then
PLAN_ARGS="$PLAN_ARGS -lock-timeout=${TF_PARAM_LOCK_TIMEOUT}"
fi
export PLAN_ARGS
# shellcheck disable=SC2086
terraform -chdir="$module_path" plan -input=false -out=${TF_PARAM_OUT} $PLAN_ARGS