Closed cathode911 closed 5 years ago
Hey @cathode911! You're very close on the correct syntax for what you're going for. The issue you're running into is that you're running Terraform 0.11.x and your config syntax is a combination of HCL (Terraform <0.12) and HCL2 (Terraform >=0.12).
If you'd like to stick with 0.11.x, try changing the virtual_machine_ids
to:
virtual_machine_ids = ["${module.consul-cluster-testing.vsphere_virtual_machine.vm.*.id}"]
Or you can upgrade to 0.12 and use:
virtual_machine_ids = module.consul-cluster-testing.vsphere_virtual_machine.vm[*].id
Hello colleagues, i am struggling with finding a way to use modular approach ( module "givenname" {} ) along with resource "vsphere_compute_cluster_vm_anti_affinity_rule".
Anti-affinity resource requires a list of virtual_machine_ids to be able to create a DRS rule, although i am unable to find a way how to form that list if using terraform modules, as VM resource made from module looks like module.givenname.vsphere_virtual_machine.vm[0] (1,2, etc)
Something like virtual_machine_ids = ["${module.consul-cluster-testing.vsphere_virtual_machine.vm[*].id}"] makes no sense to terraform parser.
Any advice here?
Terraform Version
terraform -v Terraform v0.11.13
vSphere Provider Version
. ├── provider.vsphere ├── module.consul-cluster-testing │ └── provider.vsphere (inherited) └── module.saltmaster-tst └── provider.vsphere (inherited)
Affected Resource(s)
vsphere_compute_cluster_vm_anti_affinity_rule
Terraform Configuration Files
Expected Behavior
Rule creation
Actual Behavior
Various errors due to inability to find dependent VM ids from module and / or parse errors
Steps to Reproduce