Exception when using Terraform apply step with remote backend

I’m getting the following exception in my deployment when trying to use a remote backend for Terraform. The deployment works fine when configured without the backend so I know it’s not the Terraform code. I’ve also validated that the workspace exists in the remote backend and there is a state file so it’s not clear to me what this exception is referring to.

Initializing the backend...
January 12th 2020 08:27:26
Info
Successfully configured the backend "remote"! Terraform will automatically
January 12th 2020 08:27:26
Info
use this backend unless the backend configuration changes.
January 12th 2020 08:27:26
Error
Error loading state: Error creating workspace paige-aws-viewer: resource not found
January 12th 2020 08:27:26
Error
Calamari.Integration.Processes.CommandLineException: The following command: "terraform" init -no-color -get-plugins=true
January 12th 2020 08:27:26
Error
With the working directory of: /etc/octopus/Linux-Worker-2/Work/20200112132723-10636-56/staging
January 12th 2020 08:27:26
Error
Failed with exit code: 1
January 12th 2020 08:27:26
Error
Error loading state: Error creating workspace paige-aws-viewer: resource not found
January 12th 2020 08:27:26
Error
at Calamari.Integration.Processes.CommandResult.VerifySuccess() in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Shared\Integration\Processes\CommandResult.cs:line 38
January 12th 2020 08:27:26
Error
at Calamari.Terraform.TerraformCLIExecutor.InitializePlugins() in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Terraform\TerraformCliExecutor.cs:line 138
January 12th 2020 08:27:26
Error
at Calamari.Terraform.TerraformCLIExecutor..ctor(ICalamariFileSystem fileSystem, RunningDeployment deployment, Dictionary`2 environmentVariables) in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Terraform\TerraformCliExecutor.cs:line 63
January 12th 2020 08:27:26
Error
at Calamari.Terraform.ApplyTerraformConvention.Execute(RunningDeployment deployment, Dictionary`2 environmentVariables) in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Terraform\ApplyTerraformConvention.cs:line 18
January 12th 2020 08:27:26
Error
at Calamari.Terraform.TerraformConvention.InstallAsync(RunningDeployment deployment) in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Terraform\TerraformConvention.cs:line 47
January 12th 2020 08:27:26
Error
at Calamari.Terraform.TerraformConvention.Install(RunningDeployment deployment) in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Terraform\TerraformConvention.cs:line 27
January 12th 2020 08:27:26
Error
at Calamari.Deployment.ConventionProcessor.RunInstallConventions() in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 72
January 12th 2020 08:27:26
Error
at Calamari.Deployment.ConventionProcessor.RunConventions() in C:\buildAgent\work\e0cefbed4ad11812\source\Calamari.Shared\Deployment\ConventionProcessor.cs:line 30
January 12th 2020 08:27:26
Error
Running rollback conventions...
January 12th 2020 08:27:26
Error
The following command: "terraform" init -no-color -get-plugins=true
January 12th 2020 08:27:26
Error
With the working directory of: /etc/octopus/Linux-Worker-2/Work/20200112132723-10636-56/staging
January 12th 2020 08:27:26
Error
Failed with exit code: 1

Hi @dan.greene,

Thanks for reaching out. I’ve replied to your question via email a couple of seconds ago. Let’s continue our conversation over that channel, shall we?

Thanks,
Dalmiro