简体   繁体   中英

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.

Do the explicit comparison:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM