Teraform deployment fails with mkdir ${env:TentacleHome}: The directory name is invalid

When applying a terraform process we are getting the following error: Error installing provider “aws”: mkdir ${env:TentacleHome}: The directory name is invalid…

We are using Octopus Version 2018.4.4 with an external worker. The version of the external worker tentacle is 3.20.0. The Tentacle manager on that machine shows that it knows what directory is TentacleHome. Is this a permissions issue? The tentacle is running as a domain account, but not running as an admin on that machine.

Here is a larger snippet of the log:
17:41:59 Verbose | Name Value
17:41:59 Verbose | ---- -----
17:41:59 Verbose | PSVersion 4.0
17:41:59 Verbose | WSManStackVersion 3.0
17:41:59 Verbose | SerializationVersion
17:41:59 Verbose | CLRVersion 4.0.30319.42000
17:41:59 Verbose | BuildVersion 6.3.9600.18773
17:41:59 Verbose | PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
17:41:59 Verbose | PSRemotingProtocolVersion 2.2
17:42:00 Verbose | PowerShell Environment Information:
17:42:00 Verbose | OperatingSystem: Microsoft Windows NT 6.3.9600.0
17:42:00 Verbose | OsBitVersion: x64
17:42:00 Verbose | Is64BitProcess: True
17:42:00 Verbose | CurrentUser: IMO\svc_octopusworker
17:42:00 Verbose | MachineName: PRD-OCTFPV05
17:42:00 Verbose | ProcessorCount: 2
17:42:00 Verbose | CurrentDirectory: C:\Octopus\Work\20180425224155-150665-23
17:42:00 Verbose | CurrentLocation: C:\Octopus\Work\20180425224155-150665-23
17:42:00 Verbose | TempDirectory: C:\Users\svc_octopusworker\AppData\Local\Temp
17:42:00 Verbose | HostProcessName: powershell
17:42:00 Verbose | TotalPhysicalMemory: 4193844 KB
17:42:00 Verbose | AvailablePhysicalMemory: 3285880 KB
17:42:00 Info | terraform.exe init -no-color -input=false -get-plugins=true
17:42:00 Info | Initializing provider plugins…
17:42:00 Info | - Checking for available provider plugins on https://releases.hashicorp.com
17:42:00 Info | - Downloading plugin for provider “aws” (1.16.0)…
17:42:02 Error | Error installing provider “aws”: mkdir ${env:TentacleHome}: The directory name is invalid…
17:42:02 Error | Terraform analyses the configuration and state and automatically downloads
17:42:02 Error | plugins for the providers used. However, when attempting to download this
17:42:02 Error | plugin an unexpected error occured.
17:42:02 Error | This may be caused if for some reason Terraform is unable to reach the
17:42:02 Error | plugin repository. The repository may be unreachable if access is blocked
17:42:02 Error | by a firewall.
17:42:02 Error | If automatic installation is not possible or desirable in your environment,
17:42:02 Error | you may alternatively manually install plugins by downloading a suitable
17:42:02 Error | distribution package and placing the plugin’s executable file in the
17:42:02 Error | following directory:
17:42:02 Error | terraform.d/plugins/windows_386

Hi Leslie,

Thanks for reaching and out sorry you’ve run into this issue with the Terraform template. I’ve been working with the team and it looks related to the way the Terraform step bootstraps the script it executes to do the work. The path it uses is valid for an internal worker but not an external worker. We’ve create an issue that you can follow on GitHub.

If you are able to switch back to using the internal worker for now that should get you going until we can get a fix out.

Apologies for the inconvenience.