Bootstrap FreeKB - Terraform - Resolve "input variable is not set"
Terraform - Resolve "input variable is not set"

Updated:   |  Terraform articles

Let's say you define an input variable that does not have a default value.

variable "foo" {
  type = string
}

 

Since the "foo" variable does not have a default value, the terraform refresh, terraform output, terrafrom plan, and terraform apply commands should prompt you to enter a value for the foo variable.

var.foo
  Enter a value:

 

However, let's say you use the -input=false option. 

terraform refresh -input=false

 

This should cause the following error to be returned.

~]$ terraform refresh -input=false
╷
│ Error: No value for required variable
│
│   on variables.tf line 13:
│   13: variable "foo" {
│
│ The root module input variable "foo" is not set, and has no default value. Use a -var or -var-file command line argument to provide a value for this variable.

 

This can be resolved by not using the -input=false option, or using the -var or -var-file options.




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 06322f in the box below so that we can be sure you are a human.