-
Notifications
You must be signed in to change notification settings - Fork 476
Open
Labels
Milestone
Description
Code of Conduct
- I have read and agree to the Code of Conduct.
- Vote on this issue by adding a 👍 reaction to the original issue initial description to help the maintainers prioritize.
- Do not leave "+1" or other comments that do not add relevant information or questions.
- If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Terraform
v1.13.5
Terraform Provider
v2.15.0
VMware vSphere
9.0.1
Description
Creating vSphere VM with extra-config that contains options that are prefixed with vmx. does not work. The resource is created without errors but the options disapear.
Running terraform in debug mode confirms the options are somehow lost
- .extra_config: element "vmx.vmOpNotificationToApp.enabled" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.timeout" has vanished
Affected Resources or Data Sources
resource/vsphere_virtual_machine
Terraform Configuration
resource "vsphere_virtual_machine" "crdb_vm" {
count = var.crdb_vm_count
name = format("%s-%02d", var.crdb_vm_name_prefix, (count.index + 1))
hardware_version = var.crdb_vm_hw_version
resource_pool_id = vsphere_resource_pool.pool.id
# Storage
datastore_id = data.vsphere_datastore.datastore.id
storage_policy_id = data.vsphere_storage_policy.storage_policy.id
# Compute Configuration
num_cpus = var.crdb_vm_cpu_count
memory = var.crdb_vm_memory_gb * 1024
# SCSI Controller
# scsi0:0-14 are unit numbers 0-14
# scsi1:0-14 are unit numbers 15-29
# scsi2:0-14 are unit numbers 30-44
# scsi3:0-14 are unit numbers 45-59
scsi_controller_count = max(1, min(4, var.crdb_vm_data_disk_count + 1))
# OS Disk
disk {
label = format("%s-%02d-%s", var.crdb_vm_name_prefix, count.index + 1, "os")
size = var.crdb_vm_os_disk_gb
io_reservation = 1
unit_number = 0
}
# Data disks
# evenly distribute the data disk across controllers
dynamic "disk" {
for_each = range(1, var.crdb_vm_data_disk_count + 1)
content {
label = format("%s-%02d-%s-disk%d", var.crdb_vm_name_prefix, count.index + 1, "data", disk.value)
size = var.crdb_vm_data_disk_size_gb
io_reservation = 1
unit_number = 14 + (((disk.value - 1) % 3) * 14) + disk.value
}
}
cdrom {
client_device = true
}
# Network interface configuration - connecting to VPC subnet
network_interface {
network_id = data.vsphere_network.vpc_subnet.id
adapter_type = "vmxnet3"
}
clone {
template_uuid = vsphere_content_library_item.my_content_library_item.id
customize {
linux_options {
host_name = format("%s-%02d", var.crdb_vm_name_prefix, (count.index + 1))
domain = var.vpc_subnet_domain
}
network_interface {
ipv4_address = var.vpc_subnet_ips[count.index]
ipv4_netmask = var.vpc_subnet_netmask
}
ipv4_gateway = var.vpc_subnet_gateway
dns_server_list = var.vpc_subnet_dns_servers
dns_suffix_list = var.vpc_subnet_dns_suffix
}
}
# https://github.com/tenthirtyam/terrafom-examples-vmware/tree/main/vsphere/vsphere-virtual-machine/clone-template-linux-cloud-init
extra_config = {
"guestinfo.userdata" = data.template_cloudinit_config.userdata.rendered
"guestinfo.userdata.encoding" = "gzip+base64"
"vmx.vmOpNotificationToApp.enabled" = "TRUE"
"vmx.vmOpNotificationToApp.timeout" = "600"
}
lifecycle {
ignore_changes = [
num_cores_per_socket
]
}
}
Debug Output
+ "vmx.vmOpNotificationToApp.enabled" = "TRUE"
+ "vmx.vmOpNotificationToApp.timeout" = "600"
+ vmx_path = (known after apply)
+ adapter_type = "vmxnet3"
+ "vmx.vmOpNotificationToApp.enabled" = "TRUE"
+ "vmx.vmOpNotificationToApp.timeout" = "600"
+ vmx_path = (known after apply)
+ adapter_type = "vmxnet3"
+ "vmx.vmOpNotificationToApp.enabled" = "TRUE"
+ "vmx.vmOpNotificationToApp.timeout" = "600"
+ vmx_path = (known after apply)
+ adapter_type = "vmxnet3"
- .extra_config: element "vmx.vmOpNotificationToApp.enabled" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.timeout" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.enabled" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.timeout" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.enabled" has vanished
- .extra_config: element "vmx.vmOpNotificationToApp.timeout" has vanished
Panic Output
No response
Expected Behavior
The extra-config options should be added to the VM.
Actual Behavior
The options are silently discarded.
Steps to Reproduce
Create a vsphere virtual machine with extra-config that contains options that start with vmx.
e.g. "vmx.vmOpNotificationToApp.enabled" = "TRUE"
"vmx.vmOpNotificationToApp.timeout" = "600"
Environment Details
Screenshots
No response
References
No response