I am learning terraform. I want to print values of variables in "plan" stage. So I found how to do it. seems I am doing something wrong here....
in variables.tf:....
variable "VMCount" {
description = "How many VMs do you want to start with (number)? default=1 max=5"
type = number
}
in main.tf
output "VMCount" {
value = "${var.VMCount > 2 && var.VMCount < 6 ? var.VMCount : 2}"
}
after that i run terraform plan and the condition seem to be working fine (it creates right num of VMs)
but the variable output is not coming. why?
$ terraform output
VMC = 56
that VMC is might be from some previous attempts ( I tried several things).
How to print the value of user entry (variable)?
Thank you.
VMCount
to 56 it will currently return 2. Can you please edit your question to show your actual code (ideally as a minimal reproducible example) with the actual output you get when you runterraform apply
andterraform output
? – Scaremongerterraform init
and followed byterraform console
. Then use console expressions to run & evaluate them. – Bounder