Setting environment variables

Set up a variable.

variable "FOO" {}

Set up your code.

{
  foo = var.FOO
}

Set the variable using TF_VAR_ prefix.

export TF_VAR_FOO=bar

Run.

$ terraform plan