Setting environment variables

Setup a variable.

variable "FOO" {}

Setup your code.

{
  foo = var.FOO
}

Set the variable using TF_VAR_ prefix.

export TF_VAR_FOO=bar

Run.

$ terraform plan