Could you add the "backend-config" and "var-file" parameters to the "Apply a terraform template" template


We were inspired the news that terraform support was added to 2018.3
We use the octopus as our main deployment tools and we hope to deploy an aws infrastructure for our projects with octopus.

But i found 2 things that do the “Apply a terraform template” template useless for us


Octopus provides Variable Replacement ( described in And one possible way is: keep variables in octopus and replace it as described in Variable Replacement.
But we have around 60 variables in our terraform configuration. And we have => 3 environments (1 dev, 1 stage, 1+ prod). So i must fill values for variables 180 times. And when i want add a new environment, i must add values to 60 variables.
Keeping values for variables in terraform.tfvars and use dedicated terraform.tfvars file for each environment looks much easer, but the template doesn’t support “var-file” flag for apply command.

Is it possible to add var-file flag to the “Apply a terraform template” in future releases?

Environment isolation

You provide workspace option. ( described in But workspace isn’t good for environment isolation.

From terrafrom documentation (

Workspaces can be used to manage small differences between development, staging, and production, but they should not be treated as the only isolation mechanism
For each smaller configuration, you can use workspaces to model the differences between development, staging, and production. However, if you have one large Terraform configuration, it is riskier and not recommended to use workspaces to handle those differences.

We prefer to use a dedicated state file for each environment and re-initialize backend with code like follow:

terraform init -backend-config="region=$terraform_bucket_region" \
  -backend-config="bucket=$terraform_bucket_name" \
  -backend-config="key=$(basename $module_path)/$environment.tfstate"

And use backend configuration like:

terraform {
  required_version = "~> 0.10"

  backend "s3" {
    encrypt = true

So, is it possible to add backend-config flag to the “Apply a terraform template” in future releases?

We think that we found a workaround.

The current structure of our repo:

  • *.tf files with terraform configuration in root of the repo
  • envs - folder containing sub-folders for each environment: dev, stage, prod1, prod2 etc…
    • envs\dev - sub-folder for certain environent. Contains files:
      • terraform.tfvars - file containing values of variables for certain environment
      • - file containing path to remote backend for certain environment

We make separate releases for environments in next way: we pack all files from root of repo + the terraform.tfvars and files from the environment subfolder in nuget package. So we have separate package for every environment. And we may use the “Apply a terraform template”.

Hope it will helpful for the community.

Hi Semyon,

Thanks for getting in touch and thanks for the feedback on our Terraform feature.

We agree with you and have created a GitHub issue here that you can track to be notified when these updates are available.

Also thanks for posting your workaround, hopefully that helps for the time being :slight_smile:


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.