Terraform remote modules

Hi Octopus!
We are using Octopus Cloud + Terraform with great success. However the limitation of what is installed on either the octopus server or tentacle is a bit of a blocker. We are using Terraform and a common approach is to use ‘modules’. these modules are often git repos and are reference like so:

module "elastic_beanstalk_environment" {
     source = "git::https://github.com/......"
     ref=" master"
     namespace = "eg"
}

Howevfer when I run this I get an error stating that git needs to be installed and on the PATH, see attached log file

ServerTasks-51716.log.txt (11.2 KB)

I gather this would require git to be installed on either the tentacle or the octopus server. From what I understand that i can use a worker for this instead, but if we have first class terraform support I would have assumed that this might be supported.

Am i missing something?

Hi Paul,

Glad to hear you’ve been having great success with your Octopus Cloud server :slight_smile:. Git is not installed on your Octopus Cloud server however, you can run a step prior to the step that runs Terraform to install it. The one thing to keep in mind is that should something happen to your server, and it’s replaced, the new server won’t have git installed so the step you write will need to check for its existence and install it if necessary.

Hope that helps!

Hi Chris, thanks for your help.

I’ve tried creating a step to install git on our Octopus Cloud server. I am using a chocolately step

I get permissions errors when trying to install, it seems as though its a requirement to run the chocolately step as an administrator.

Do you have any other suggestions on how to run an install step ?

Hey Paul,

Yeah that’s correct re: Chocolately requiring administrative rights by default which customers do not have when running commands on their Octopus Cloud server.

I found this blog post which may work for you, there’s a section where they install and configure Chocolatey in such a way that non-administrators can still use Chocolately to install software. This may well be just what you need :slight_smile: https://blog.ipswitch.com/implementing-chocolatey-self-service-for-non-admin-users-1

Otherwise, you could also try the old school approach by using Invoke-WebRequest to download the Git installer and then using Start-Process to run the installer. For example:

Invoke-WebRequest -Uri "https://github.com/git-for-windows/git/releases/download/v2.19.1.windows.1/Git-2.19.1-64-bit.exe" -OutFile "C:\tmp\Git-2.19.1-64-bit.exe"
Start-Process -FilePath "C:\tmp\Git-2.19.1-64-bit.exe" -ArgumentList "/VERYSILENT" -NoNewWindow -Passthru -Wait

This code snippet is just an example, the syntax may be incorrect.