I would like to condition the provisioning of a resource (gcp vm instance) on a variable, for example:
resource "${var.param > 0 ? "google_compute_instance" : "null_resource"}" "cluster" {
# ...
}
but the above is not valid syntax:
Error: Invalid resource type name
A name must start with a letter or underscore and may contain only letters, digits, underscores, and dashes.
Error: Invalid string literal
Template sequences are not allowed in this string. To include a literal "$", double it (as "$$") to escape it.
Is there a way to accomplish the same? Ideally using terraform alone.