I’m reviving an old terraform script where a variable caused the plan step to fail. How to debug print such terraform variable values during it run?
$ terraform console
> var.name
"demo"
$ make apply
terraform apply
│ Error: "name" may only contain alphanumeric characters, dots, dashes and underscores
│
│ with module.linux.azurerm_linux_virtual_machine.mytfvm,
│ on linux/main.tf line 80, in resource "azurerm_linux_virtual_machine" "mytfvm":
│ 80: name = "${var.name}"
│
╵
╷
│ Error: "name" must begin with an alphanumeric character
│
│ with module.linux.azurerm_linux_virtual_machine.mytfvm,
│ on linux/main.tf line 80, in resource "azurerm_linux_virtual_machine" "mytfvm":
│ 80: name = "${var.name}"
│
╵
╷
│ Error: "name" must end with an alphanumeric character or underscore
│
│ with module.linux.azurerm_linux_virtual_machine.mytfvm,
│ on linux/main.tf line 80, in resource "azurerm_linux_virtual_machine" "mytfvm":
│ 80: name = "${var.name}"
│
╵
╷
│ Error: "computer_name" cannot contain the special characters: `\/"[]:|<>+=;,?*@&~!#$%^()_{}'`
│
│ with module.linux.azurerm_linux_virtual_machine.mytfvm,
│ on linux/main.tf line 88, in resource "azurerm_linux_virtual_machine" "mytfvm":
│ 88: computer_name = "${var.name}"
You can see that the var.name
prints fine during terraform console
, but somehow get changed strangely during the terraform execution from the complicated old terraform script. So,
How to debug print terraform variable values during terraform execution?