This is a terraform mixin for Porter.
This will get the terraform mixin and install it from source.
go get -u get.porter.sh/mixin/terraform
cd $(go env GOPATH)/src/get.porter.sh/mixin/terraform
make build install
install:
- terraform:
description: "Install Azure Key Vault"
input: false
backendConfig:
key: "mybundle.tfstate"
storage_account_name: "mystorageacct"
container_name: "mycontainer"
access_key: "myaccesskey"
outputs:
- name: vault_uri
upgrade:
- terraform:
description: "Upgrade Azure Key Vault"
input: false
backendConfig:
key: "mybundle.tfstate"
storage_account_name: "mystorageacct"
container_name: "mycontainer"
access_key: "myaccesskey"
outputs:
- name: vault_uri
An invoke step is used for any custom action (not one of install
, upgrade
or uninstall
).
By default, the command given to terraform
will be the step name. Here it is show
,
resulting in terraform show
with the provided configuration.
show:
- terraform:
description: "Invoke 'terraform show'"
backendConfig:
key: "mybundle.tfstate"
storage_account_name: "mystorageacct"
container_name: "mycontainer"
access_key: "myaccesskey"
Or, if the step name does not match the intended terraform command, the command
can be supplied via the arguments:
section, like so:
printVersion:
- terraform:
description: "Invoke 'terraform version'"
arguments:
- version
uninstall:
- terraform:
description: "Uninstall Azure Key Vault"
backendConfig:
key: "mybundle.tfstate"
storage_account_name: "mystorageacct"
container_name: "mycontainer"
access_key: "myaccesskey"
See further examples in the Examples directory
As seen above, outputs can be declared for a step. All that is needed is the name of the output.
For each output listed, terraform output <output name>
is invoked to fetch the output value
from the state file for use by Porter.
See the Porter Outputs documentation on how to wire up outputs for use in a bundle.