Terraform tuple - Command Line

Hi Team,
I am getting the error Variables not allowed

cat tuple_example.tf
variable "tuple_type" {
 description = "This is a variable of type tuple"
 type        = tuple([string, number, bool])
 default     = ["item1", 42, true]
}
cat tuple_output.tf
output "tuple_output" {
 value = var.tuple_type
}

When i am running

 terraform plan -var "tuple_type=(["Aniket",28,true])"
╷
│ Error: Variables not allowed
│
│   on <value for var.tuple_type> line 1:
│   (source code not available)
│
│ Variables may not be used here.
╵
``

I am starting from scratch so i am struggling .

You need to escape the quotes. Change your command to

terraform plan -var "tuple_type=([\"Aniket\",28,true])"

1 Like