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

Add VMware Tools Upgrades boolean parameter in ToolsConfigInfo #1297

Closed
francoislamiedepain opened this issue Dec 29, 2020 · 8 comments · Fixed by #1506
Closed

Add VMware Tools Upgrades boolean parameter in ToolsConfigInfo #1297

francoislamiedepain opened this issue Dec 29, 2020 · 8 comments · Fixed by #1506
Assignees
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/vm Area: Virtual Machines enhancement Type: Enhancement
Milestone

Comments

@francoislamiedepain
Copy link

francoislamiedepain commented Dec 29, 2020

vSphere Provider Version

    • provider.vsphere: version = "~> 1.13"

Terraform Configuration Files

provider "vsphere" {
  allow_unverified_ssl = true
}

data "vsphere_datacenter" "dc" {
  name = var.vm_datacenter
}

data "vsphere_datastore_cluster" "datastore_cluster" {
  name          = var.vm_system_datastore_cluster
  datacenter_id = "${data.vsphere_datacenter.dc.id}"
}

data "vsphere_datastore" "datastoreTemplate" {
  name          = var.vm_template_datastore
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_compute_cluster" "cluster" {
  name          = var.vm_cluster
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_network" "prod_network" {
  name          = var.vm_prod_vlan
  datacenter_id = data.vsphere_datacenter.dc.id
}

// Configure the Backup network interface if requested
data "vsphere_network" "backup_network" {
  count = var.vm_backup_vlan != "" ? 1 : 0
  name          = var.vm_backup_vlan
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_virtual_machine" "template" {
  name          = var.vm_template
  datacenter_id = data.vsphere_datacenter.dc.id
}

data "vsphere_tag_category" "category1" {
  name = var.vm_backup_category_tag
}

data "vsphere_tag_category" "category2" {
  name = var.vm_backup_schedule_category_tag
}

data "vsphere_tag" "tag1" {
  name        = var.vm_backup_tag
  category_id = data.vsphere_tag_category.category1.id
}

data "vsphere_tag" "tag2" {
  name        = var.vm_backup_schedule_tag
  category_id = data.vsphere_tag_category.category2.id
}

data "vsphere_resource_pool" "pool" {
  name          = var.vm_resource_pool
  datacenter_id = data.vsphere_datacenter.dc.id
}

resource "vsphere_virtual_machine" "vm_1" {
  name                 = var.vm_name
  resource_pool_id     = data.vsphere_resource_pool.pool.id
  datastore_cluster_id = data.vsphere_datastore_cluster.datastore_cluster.id
  folder               = var.vm_folder
  num_cpus             = var.vm_vcpu
  num_cores_per_socket = var.vm_cpu // vm_cpu is in fact num_cores_per_socket (computed in BPM Camunda)
  memory               = var.vm_memory
  guest_id             = data.vsphere_virtual_machine.template.guest_id
  tags                 = [data.vsphere_tag.tag1.id, data.vsphere_tag.tag2.id]
  scsi_type            = data.vsphere_virtual_machine.template.scsi_type

  network_interface {
    network_id   = data.vsphere_network.prod_network.id
    adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
  }

  // Add the Backup network interface if requested
  dynamic "network_interface" {
    for_each = data.vsphere_network.backup_network
    content {
      network_id   = data.vsphere_network.backup_network[0].id
      adapter_type = data.vsphere_virtual_machine.template.network_interface_types[0]
    }
  }

  disk {
    label            = "disk0"
    size             = var.vm_disk
    eagerly_scrub    = data.vsphere_virtual_machine.template.disks[0].eagerly_scrub
    thin_provisioned = data.vsphere_virtual_machine.template.disks[0].thin_provisioned
  }

  dynamic "disk" {
    for_each = var.vm_additional_disks
    content {
      label                 = disk.value.label
      size                  = disk.value.size
      unit_number           = disk.value.unit_number
    }
  }

  clone {
    template_uuid = data.vsphere_virtual_machine.template.id

    customize {
      linux_options {
        host_name = var.vm_name
        domain    = var.vm_domain
        time_zone = "Europe/Paris"
      }

      network_interface {
        ipv4_address = var.vm_prod_ip_address
        ipv4_netmask = var.vlan_prod_cidr_suffix
      }

      // Add the Backup network interface if requested
      dynamic "network_interface" {
        for_each = data.vsphere_network.backup_network
        content {
          ipv4_address = var.vm_backup_ip_address
          ipv4_netmask = var.vlan_backup_cidr_suffix
        }
      }

      ipv4_gateway    = var.vm_prod_default_gw
      dns_server_list = var.network_dns
    }
  }
}

Expected Behavior

Be able to set Tools Upgrades boolean parameter into vsphere virtual machine resource

vmwaretools

Actual Behavior

Only able to set following parameters:

  sync_time_with_host = false
  run_tools_scripts_after_power_on = false
  run_tools_scripts_after_resume = false
  run_tools_scripts_before_guest_reboot = false
  run_tools_scripts_before_guest_shutdown = false
  run_tools_scripts_before_guest_standby = false

References

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@tenthirtyam
Copy link
Collaborator

See #1506.

  • tools_upgrade_policy - (Optional) Enable automatic upgrade of the VMware Tools
    version when the virtual machine is rebooted. If necessary, VMware Tools is upgraded
    to the latest version supported by the host on which the virtual machine is running.
    Requires VMware tools to be installed. One of manual or upgradeAtPowerCycle. Default: manual.

Note that the setting is not a bool and must be a string with a value of manual or 'upgradeAtPowerCycle'

From vmware/govmomi: https://github.com/vmware/govmomi/blob/ffd45c83211eacbe546299c1595eccd9322b9e21/vim25/types/enum.go#L3685-L3694.

Ryan
@tenthirtyam

@abhinaviec1
Copy link

Do we know when the next release will come and if this enhancement will be part of the upcoming release?

@tenthirtyam
Copy link
Collaborator

I'm happy to ask the PM this week.

Ryan

@abhinaviec1
Copy link

I'm happy to ask the PM this week.

Ryan

Hello Ryan,

By any chance did you receive any update on the release date.

@durfman
Copy link

durfman commented Dec 9, 2021

Would really like to see this feature added. Anyone have a working solution?

@tenthirtyam
Copy link
Collaborator

@durfman, #1506 is pending review and prioritization by the maintainers.

@tenthirtyam tenthirtyam self-assigned this Jan 29, 2022
@tenthirtyam tenthirtyam changed the title Add VMware Tools Upgrades boolean parameter in ToolsConfigInfo Add VMware Tools Upgrades boolean parameter in ToolsConfigInfo Feb 4, 2022
@tenthirtyam tenthirtyam added the acknowledged Status: Issue or Pull Request Acknowledged label Feb 4, 2022
@tenthirtyam tenthirtyam added this to the v2.1.0 milestone Feb 14, 2022
@tenthirtyam tenthirtyam added the area/vm Area: Virtual Machines label Feb 22, 2022
appilon pushed a commit that referenced this issue Feb 25, 2022
…resource (#1506)

* Add `tools_upgrade_policy` argument

Addresses #1297
- Add `tools_upgrade_policy` argument to the `vsphere_virtual_machine` resource to set the upgrade policy for VMware Tools. One of `manual` or `upgradeAtPowerCycle`. Default: `manual`
- Updates the `vsphere_virtual_machine` resource docs to include the tools_upgrade_policy` argument.

Signed-off-by: Ryan Johnson <[email protected]>
@github-actions
Copy link

github-actions bot commented Mar 2, 2022

This functionality has been released in v2.1.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Apr 2, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
acknowledged Status: Issue or Pull Request Acknowledged area/vm Area: Virtual Machines enhancement Type: Enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants