Unable to use -var-file flag with Terraform Cloud Workspace

I am unable to use -var-file flag with Terraform Cloud Workspace. It works as expected when I rename the var file to terraform.tfvars and run terraform plan without the -var-file flag.

Terraform throwing errors like:
Operation failed: failed validating Terraform variables: 1 error occurred:

  • Invalid HCL in variable “prefix”: At 1:10: Unknown token: 1:10 IDENT Hello-World

This use case is documented in multiple places in Terraform documentation:

Appreciate the help!!
Jigar

Hi! Welcome to the forum!

What version of Terraform CLI are you using? Can you provide the [anonymized] cloud settings block you have configured?

Hi @chrisarcand,

The issue was resolved by upgrading Terraform CLI to 1.1.3. I believe it was a bug with Terraform 1.1.2 and previous.

Thanks,
Jigar

1 Like