The reason this works is due to Terraform variable values (and providers) do not support interpolation. The TF engine is not yet running when the values are assigned.
outputs on the other hand are evaluated near the end of a TF life cycle. Thus the engine is running and interpolation is supported.
Another way to to this is use a null object and apply the value = "${var.nickname != "" ? var.nickname : var.fullname}" logic to it.
Side note; might want to check out upgrading the TF 0.12.x when you get a chance. The resource/var/output sytax changes a bit.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The reason this works is due to Terraform
variable
values (and providers) do not support interpolation. The TFengine
is not yet running when the values are assigned.outputs
on the other hand are evaluated near the end of a TF life cycle. Thus theengine
is running and interpolation is supported.Another way to to this is use a null object and apply the
value = "${var.nickname != "" ? var.nickname : var.fullname}"
logic to it.Side note; might want to check out upgrading the TF 0.12.x when you get a chance. The resource/var/output sytax changes a bit.