remove workspace env var and not set it to an empty string. (#388) Setting the environment variable to an empty string confuses the terraform binary as seen below: ``` TF_WORKSPACE= terraform init -no-color -input=false -get=false -upgrade=false -backend=false Error: Terraform Cloud returned an unexpected error invalid value for workspace ``` With this patch the `TF_WORKSPACE` will not exist and avoids the above problem.
diff --git a/tfexec/cmd.go b/tfexec/cmd.go index 083dc4d..5e16032 100644 --- a/tfexec/cmd.go +++ b/tfexec/cmd.go
@@ -169,7 +169,7 @@ env[automationEnvVar] = "1" // force usage of workspace methods for switching - env[workspaceEnvVar] = "" + delete(env, workspaceEnvVar) if tf.disablePluginTLS { env[disablePluginTLSEnvVar] = "1"
diff --git a/tfexec/cmd_test.go b/tfexec/cmd_test.go index 5aa6fae..c86dae3 100644 --- a/tfexec/cmd_test.go +++ b/tfexec/cmd_test.go
@@ -46,7 +46,6 @@ "TF_LOG_CORE=", "TF_LOG_PATH=", "TF_LOG_PROVIDER=", - "TF_WORKSPACE=", } }