Skip to content
Open
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
8 changes: 7 additions & 1 deletion terraform-v2/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ function update_status() {

function apply() {
set +e
terraform -chdir=${module_path} apply -input=false -no-color -auto-approve -lock-timeout=300s plan.out | $TFMASK

if [[ "<< parameters.timeout >>" -gt 0 ]]; then
timeout "<< parameters.timeout >>" terraform -chdir=${module_path} apply -input=false -no-color -auto-approve -lock-timeout=300s plan.out | $TFMASK
else
terraform -chdir=${module_path} apply -input=false -no-color -auto-approve -lock-timeout=300s plan.out | $TFMASK
fi

local TF_EXIT=${PIPESTATUS[0]}
set -e

Expand Down
6 changes: 6 additions & 0 deletions terraform-v2/orb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ aliases:
type: "string"
description: "Path to the json file to save the output variables to"
default: ""
timeout: &timeout
timeout:
type: "integer"
description: "Timeout in seconds applied to terraform apply. Default is 0 (no timeout)"
default: 0

init-parameter-passthrough: &init-parameter-passthrough
path: << parameters.path >>
Expand Down Expand Up @@ -152,6 +157,7 @@ commands:
<<: *target
<<: *output_path
<<: *reuse_plan
<<: *timeout
steps:
- run:
name: "terraform apply << parameters.path >> << parameters.label >>"
Expand Down