Can I use a custom version of Terraform in Octopus Cloud?

This blog post describes how to use a custom version of Terraform.exe by setting the special variable Octopus.Action.Terraform.CustomTerraformExecutable. Is it possible to do this in Octopus Cloud and if so where do I upload the custom version of Terraform.exe I want to use?

Hey Paul,

To use a custom Terraform version with Octopus Cloud, you will need to register a machine as a worker, rather than using the Octopus-hosted dynamic workers. The following are the steps you need to take:

  1. Create a new machine (or use an existing one)
  2. Install the desired version of Terraform on the machine
  3. Register the machine as a worker in Octopus, and assign it to a worker pool
  4. Configure your Terraform steps to use the worker pool containing the new worker
  5. Set the Octopus.Action.Terraform.CustomTerraformExecutable variable to the path you installed Terraform at on the worker

Am I correct in assuming you wish to use Terraform 0.12? I ask because this a common situation. The breaking changes in Terraform 0.12 left us with a problem: we can’t update the bundled version of Terraform without breaking existing steps. And we don’t particularly wish to bundle multiple versions.
We currently have a preview feature that allows executing steps in containers. This doesn’t help you today, as it cannot be used on the Octopus-hosted workers (they don’t have docker installed), but we are working on enabling it for Octopus cloud right now. The images published by Octopus will contain Terraform (amongst many other tools) and will be regularly updated. Alternatively, you will be able to use any docker image you like.

I’d welcome your thoughts on whether you would use the container approach in the future, and if you see any reason it wouldn’t make life easier in situations like this?

And if the steps I listed above don’t help in getting this working for you right now, please shout.

Hi Michael,

Thanks for the detailed answer, using a machine as a worker has solved my problem and I can now run the version of Terraform I need to.

I am indeed running Terraform 0.12 and using containers sounds like it would be a much cleaner option for me in the future, so I would definitely migrate to that when it becomes available.

Thanks again.

1 Like