terraformterraform-provider-vsphere

Terraform count condition ignoring second parameter vsphere provider


I am trying to create a vm using count. So that, both conditions should be false for the resource to be created.

Main.tf

resource "vsphere_virtual_machine" "ubuntu" {
  count             = !var.is_ubuntu && var.extra_disk_create ? 0 : 1
  name              = var.vm_name

#additional configuration

...
}

Doesn't matter if var.is_ubuntu is either false or true the resource will be create all the same.

am i missing anything here?

any help would be very much appreciated.


Solution

  • Do the explicit comparison:

     count             = var.is_ubuntu != false && var.extra_disk_create == true ? 0 : 1