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?