Closed grossibr closed 5 months ago
Removing a disk from VM Template in terraform doesn't generate one.template.update in ONe, only a one.template.info request for the diff as there's no if d.HasChange("disk") condition in https://github.com/OpenNebula/terraform-provider-opennebula/blob/master/opennebula/resource_opennebula_template.go#L541C67-L541C67
one.template.update
one.template.info
if d.HasChange("disk")
Terraform v1.5.1 on darwin_arm64
opennebula_template
resource "opennebula_template" "instance-template" { name = var.instance_template_name cpu = var.cpu vcpu = var.vcpu memory = var.memory_gb * 1024 permissions = "660" sched_requirements = var.cluster_id context = { AXC_VMTYPE = "cf" DNS = var.dns DNS_HOSTNAME = "YES" NETWORK = "YES" REPORT_READY = "YES" SEARCH_DOMAIN = var.search_domain START_SCRIPT_BASE64 = var.start_script_base64 TOKEN = "YES" } cpumodel { model = "IvyBridge-IBRS" } disk { dev_prefix = "sd" discard = "unmap" image_id = 11 size = 20480 } features { guest_agent = "YES" virtio_scsi_queues = "3" } os { arch = "x86_64" boot = "" } raw { data = "<console/>" type = "kvm" } graphics { listen = "0.0.0.0" type = "VNC" } nic { network_id = var.network_id security_groups = [ 0, ] } }
only 20G disk should exist, any other disks in this template should be deleted:
# module.instance-template["cf"].opennebula_template.instance-template will be updated in-place ~ resource "opennebula_template" "instance-template" { id = "70" name = "cf" # (13 unchanged attributes hidden) - disk { - cache = "writeback" -> null - dev_prefix = "sd" -> null - discard = "unmap" -> null - image_id = -1 -> null - size = 358400 -> null - volatile_format = "raw" -> null - volatile_type = "fs" -> null } # (7 unchanged blocks hidden) }
Apply completes successfully, reporting template change:
and Disk deletion does not take effect in ONe interface:
create Template with 2 disks or more, then delete one disk from terraform code and see if it takes effect in ONe console
No response
Same for nic section
nic
I confirm, same problem. Provider version 1.3, 1.2.2. Terraform version 1.6.4, 1.5.7
Description
Removing a disk from VM Template in terraform doesn't generate
one.template.update
in ONe, only aone.template.info
request for the diff as there's noif d.HasChange("disk")
condition in https://github.com/OpenNebula/terraform-provider-opennebula/blob/master/opennebula/resource_opennebula_template.go#L541C67-L541C67Terraform and Provider version
Terraform v1.5.1 on darwin_arm64
Affected resources and data sources
opennebula_template
Terraform configuration
Expected behavior
only 20G disk should exist, any other disks in this template should be deleted:
Actual behavior
Apply completes successfully, reporting template change:
and Disk deletion does not take effect in ONe interface:
Steps to Reproduce
create Template with 2 disks or more, then delete one disk from terraform code and see if it takes effect in ONe console
Debug output
No response
Panic output
No response
Important factoids
No response
References
No response