Variables are not recognized when passed in the command line

It worked before but now it doesn’t:

In variables.tf I have:

variable "deploy-to-region" {
  description = "AWS region"
  type        = string
}

And in main.tf

provider "aws" {
  region  = var.deploy-to-region
}

When I run it like this: terraform apply -var “deploy-to-region=eu-west-1”
I am getting a prompt to enter var.deploy-to-region and when I enter it again I am getting an error:
Error: Value for undeclared variable

A variable named ““deploy-to-region” was assigned on the command line, but the root module does not declare a variable of that name. To use this value, add a “variable” block to the configuration.

What am I missing?

Hi @agenobarb,

I think the key is hidden in the error message (and again hidden further by not formatting the raw text when posting here)

A variable named "“deploy-to-region" ...

The extra quote in there is a U+201C Left Double Quotation Mark, so It looks like you copy&pasted “fancy” open and close quotes around your argument, rather than using plain quotes or no quotes at all.

Thank you @jbardin, you have an eye for detail! Indeed, it was somehow a copy/paste issue