Skip to content

Commit

Permalink
Merge pull request #22 from echoboomer/v1.2.23
Browse files Browse the repository at this point in the history
Add additional volumes enhancement.
  • Loading branch information
echoboomer committed Oct 8, 2020
2 parents bcb8a8d + 1ff1898 commit e007971
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
20 changes: 14 additions & 6 deletions README.md
Expand Up @@ -47,7 +47,7 @@ Add the following to your `pipeline.yml`:
steps:
- label: "terraform"
plugins:
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
init_args:
- "-input=false"
- "-backend-config=bucket=my_gcp_bucket"
Expand All @@ -61,7 +61,7 @@ While no commands are required, out of the box behavior may be undesirable witho
steps:
- label: "terraform"
plugins:
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
init_args:
- "-input=false"
- "-backend-config=bucket=my_gcp_bucket"
Expand All @@ -79,7 +79,7 @@ To pass in extra environment variables to the Docker container:
steps:
- label: "terraform"
plugins:
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
env:
- "FOO=foo"
- "BAR=baz"
Expand All @@ -100,7 +100,7 @@ If you want an out of the box solution that simply executes a `plan` on non-mast
steps:
- label: "terraform"
plugins:
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
apply_master: true
init_args:
- "-input=false"
Expand All @@ -119,7 +119,7 @@ steps:
- label: "terraform plan"
branches: "!master"
plugins:
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
init_args:
- "-input=false"
- "-backend-config=bucket=my_gcp_bucket"
Expand All @@ -133,7 +133,7 @@ steps:
plugins:
- artifacts#v1.2.0:
download: "tfplan"
- echoboomer/terraform#v1.2.21:
- echoboomer/terraform#v1.2.23:
apply_only: true
init_args:
- "-input=false"
Expand Down Expand Up @@ -179,6 +179,10 @@ Arguments to pass to `terraform init`. Can be a `string` or `array` depending on

If provided and set to `true`, the `terraform validate` step will be skipped.

### `precommand` (Not Required, string)

Adds a `pre-command` script that will run before the main Terraform plugin runs. This could be useful for downloading credentials or other setup steps before running Terraform.

### `skip_apply_no_diff` (Not Required, boolean)

If this is provided and set to `true`, the `apply` step will be skipped if `TF_DIFF` is also `false`. The latter variable is automatically exported during every `plan` step.
Expand All @@ -191,6 +195,10 @@ If you need to use Terraform workspaces in your repository, set this to `true`.

Which version of Terraform to use. Defaults to `0.13.0`. This is the tag applied to the Docker image, whether using the default of `hashicorp/terraform` or your own custom image.

### `volumes` (Not Required, string, array)

Additional volume mount statements to provide to the Docker container in the form `foo:bar`. Uses `-v` on the backend.

### `workspace` (Not Required, string)

If setting `use_workspaces` to `true`, pass in the Terraform workspace name here.
Expand Down
9 changes: 9 additions & 0 deletions hooks/command
Expand Up @@ -74,6 +74,15 @@ function terraform-bin() {
docker_args+=("--env" "$e")
done

extra_volumes=()
while read -r line; do
[[ -n "$line" ]] && extra_volumes+=("$line")
done <<< "$(plugin_read_list VOLUMES)"

for v in ${extra_volumes[@]-}; do
docker_args+=("-v" "$v")
done

docker_args+=(
"-w" "/svc"
"$DOCKER_IMAGE"
Expand Down
6 changes: 4 additions & 2 deletions plugin.yml
Expand Up @@ -21,13 +21,15 @@ configuration:
type: [string, array]
no_validate:
type: boolean
precommand:
type: string
skip_apply_no_diff:
type: boolean
use_workspaces:
type: boolean
version:
type: string
volumes:
type: [string, array]
workspace:
type: string
precommand:
type: string

0 comments on commit e007971

Please sign in to comment.