Terraform-VMWare-Modules / terraform-vsphere-vm

Terraform vSphere module for provisioning Virtual Machines
https://registry.terraform.io/modules/Terraform-VMWare-Modules/vm/vsphere/
MIT License
169 stars 175 forks source link

multiple values for same tag category #138

Closed lotusnoir closed 1 year ago

lotusnoir commented 2 years ago

hello, there is a couple of time im trying to make this work but i dont succeed my self and need your precious help. i’m using the plugin GitHub - Terraform-VMWare-Modules/terraform-vsphere-vm: Terraform vSphere module for provisioning Virtual Machines and i try to get multiple elements for the same tag category. It works manually but impossible to make it work with this module.

in the module i define tags like this

  tags = {
    "site"   = "xxx"
    "apps"  = "docker"
  }

and it works but if i want multiple elements in apps category it doesnt works So far i understand that i have to change the structure to put map of list like this:

  tags = {
    "site"   = ["xxx"]
    "apps"  = ["nginx", "docker"]
  }

but i dont succeed to configure the data to get this informations

data "vsphere_tag_category" "category" {                                                                                                                                                                            
  count      = var.tags != null ? length(var.tags) : 0
  name       = keys(var.tags)[count.index]
  depends_on = [var.tag_depends_on]
}
data "vsphere_tag" "tag" {
  count       = var.tags != null ? length(var.tags) : 0
  name        = var.tags[keys(var.tags)[count.index]]
  category_id = data.vsphere_tag_category.category[count.index].id
  #depends_on  = [var.tag_depends_on]

I tried to make a flattern in a local variable but i dont make it work Help will be more than welcome

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 1 year ago

enable

zmanhogmail commented 1 year ago

Hello Team, I have the same issue/requirement. Anyone can help and provide some idea? Thanks