Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tags are not always assigned to ressource when using vsphere provider #763

Closed
wegerhoff opened this issue May 13, 2019 · 1 comment
Closed

Comments

@wegerhoff
Copy link

wegerhoff commented May 13, 2019

Terraform Version

Terraform v0.11.13

  • provider.vsphere v1.8.1

vSphere Provider Version

provider.vsphere v1.8.1

vSphere Version

vSphere Version 6.7.0.20000

Affected Resource(s)

  • vsphere_tags

Terraform Configuration Files

data "vsphere_tag_category" "virtual_machine" {
  name = "Virtual Machine"
}

resource "vsphere_tag" "foo" {
  name        = "foo"
  category_id = "${data.vsphere_tag_category.virtual_machine.id}"
}

resource "vsphere_tag" "bar" {
  name        = "bar"
  category_id = "${data.vsphere_tag_category.virtual_machine.id}"
}

resource "vsphere_tag" "baz" {
  name        = "baz"
  category_id = "${data.vsphere_tag_category.virtual_machine.id}"
}

resource "vsphere_tag" "hurz" {
  name        = "hurz"
  category_id = "${data.vsphere_tag_category.virtual_machine.id}"
}

resource "vsphere_virtual_machine" "vm" {
  count            = "1"
  name             = "foobar"
  resource_pool_id = "${vsphere_resource_pool.resource_pool.id}"
  datastore_id     = "${data.vsphere_datastore.datastore.id}"

  tags     = [ "${vsphere_tag.foo.id}", "${vsphere_tag.bar.id}", "${vsphere_tag.baz.id}" ]  # edit this line and reapply

  num_cpus = "2"
  memory   = "2048"

  guest_id = "${data.vsphere_virtual_machine.source_vm.guest_id}"
  scsi_type = "${data.vsphere_virtual_machine.source_vm.scsi_type}"

  network_interface {
    network_id   = "${data.vsphere_network.network.id}"
    adapter_type = "${data.vsphere_virtual_machine.source_vm.network_interface_types[0]}"
  }

  disk {
    label = "disk0"

    size             = "20"
    eagerly_scrub    = "false"
    thin_provisioned = "false"
  }

  clone {
    template_uuid = "${data.vsphere_virtual_machine.source_vm.id}"

    linked_clone = false

    customize {
      linux_options {
        host_name    = "foobar"
        domain       = "yourdomain.com"
      }

      network_interface {}
    }
  }
}

Expected Behavior

Run terraform apply to create the above vm resource as well as the tags in vsphere. With the configuration above 3 Tags are already assigned.

Edit the Configuration and add a fourth tag like:

  tags     = [ "${vsphere_tag.foo.id}", "${vsphere_tag.bar.id}", "${vsphere_tag.baz.id}", "${vsphere_tag.hurz.id}" ] 

Run terraform apply again

The additional tag should be applied to the vm resource.

This is just on example where tags are not assigned correctly.
I watched similar behaviour when deleting and adding tags randomly.

Actual Behavior

The new tag is not assigned to the ressource.

Steps to Reproduce

  1. terraform apply
  2. Add some tag to the list of tags
  3. terraform apply
@bill-rich
Copy link
Contributor

Hi @wegerhoff! Please upgrade to a newer version of the vSphere provider. You can do this by running terraform init -upgrade This issue should be resolved in v1.9.0 (specifically #632).

@ghost ghost locked and limited conversation to collaborators Apr 18, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants