Gopalakrishnan
Gopalakrishnan

Reputation: 27

Terraform code is not recognised environment variable (TF_VAR variable)

I want to use environment variable in Terraform but my TF code is not recognised TF_VAR. I set as environment variable export TF_VAR_test="some value" and tried to use in my TF code tempval = var.test.

Using terraform v1.0.2

What I missed here? please advise me. thanks.

Upvotes: 2

Views: 1488

Answers (1)

SpaceKatt
SpaceKatt

Reputation: 1411

Before using a variable, one must declare the variable in a variable block.

For example...

variable "test" {
  type = string
}

Upvotes: 4

Related Questions