vatesfr / terraform-provider-xenorchestra

Xen Orchestra provider for Terraform
MIT License
151 stars 32 forks source link

Order of tags causes unnecessary updates #139

Closed d1rtym0nk3y closed 3 years ago

d1rtym0nk3y commented 3 years ago

if i create a vm with a set of tag like

tags = [
    "backup:nightly",
    "ansible_group:k8s",
    "ansible_managed",
    "k8s:master",
    "env:qa"
]

And then do a tf plan again, tf reports that it want to update the tags as follows

  ~ tags                 = [
      - "env:qa",
        "backup:nightly",
        # (2 unchanged elements hidden)
        "k8s:master",
      + "env:qa",
    ]

Workaround is to reorder the tag in the tf template, moving env:qa to head of the list. I can understand that XO may return the vm's tags in a different order than they were specified in TF, so it would be nice if the order could be ignored, as it doesn't seem like the ordering of tags is important

ddelnano commented 3 years ago

Hey @d1rtym0nk3y, thanks for raising this issue. The terraform provider is using a TypeList to store the tags, which enforces an order to the tags. I agree that they shouldn't need to be ordered and I'll take a look at this soon.

ddelnano commented 3 years ago

I have a PR open for this. It still needs some work but the fix is coming soon.

ddelnano commented 3 years ago

This will be available in v0.19.1 of the provider which will be released later tonight