-
Notifications
You must be signed in to change notification settings - Fork 57
Labels
Description
Description
Problem: Disk size not changed after creating VMs from first template
Goal:
terraform can not work with VM templates, that have disk info as IMAGE (i.e. name), not as IMAGE_ID (identifier)
First template
DISK = [
IMAGE = "ubuntu-22.04-amd64.base_image.test_system.stable.b20230812-7.ceph-ssd",
IMAGE_SIZE = "4096" ]
Output terraform plan:
+ disk = [
+ {
+ cache = null
+ computed_cache = (known after apply)
+ computed_dev_prefix = (known after apply)
+ computed_discard = (known after apply)
+ computed_driver = (known after apply)
+ computed_io = (known after apply)
+ computed_size = (known after apply)
+ computed_target = (known after apply)
+ computed_volatile_format = (known after apply)
+ dev_prefix = null
+ discard = null
+ disk_id = (known after apply)
+ driver = null
+ image_id = -1
+ io = null
+ size = 15360
+ target = null
+ volatile_format = null
+ volatile_type = null
},
]
Second template:
DISK = [
IMAGE_ID = "81726",
IMAGE_SIZE = "4096" ]
Output terraform plan:
+ disk = [
+ {
+ cache = null
+ computed_cache = (known after apply)
+ computed_dev_prefix = (known after apply)
+ computed_discard = (known after apply)
+ computed_driver = (known after apply)
+ computed_io = (known after apply)
+ computed_size = (known after apply)
+ computed_target = (known after apply)
+ computed_volatile_format = (known after apply)
+ dev_prefix = null
+ discard = null
+ disk_id = (known after apply)
+ driver = null
+ image_id = 81726
+ io = null
+ size = 15360
+ target = null
+ volatile_format = null
+ volatile_type = null
},
]
As result, disk size changed in VM from second template
Terraform and Provider version
# terraform -v
Terraform v1.5.5
on linux_amd64
...
- Installed opennebula/opennebula v1.3.0 (self-signed, key ID A0224DDC2BF90FA7)
...
OpenNebula 5.10.1
Affected resources and data sources
opennebula_virtual_machine
Terraform configuration
terraform {
required_providers {
opennebula = {
source = "OpenNebula/opennebula"
version = "~> 1.3"
}
}
}
locals {
config = yamldecode(file("configfile.yaml"))
}
provider "opennebula" {
endpoint = local.config.one_endpoint
username = local.config.one_username
password = local.config.one_password
}
data "opennebula_templates" "one_templates" {
name_regex = local.config.template_regex
has_cpu = true
sort_on = "register_date"
order = "ASC"
}
resource "opennebula_virtual_machine" "one_vm" {
name = local.config.vm_name
description = "terraform"
template_id = data.opennebula_templates.one_templates.templates[0].id
disk {
size = 15360 # 15GB
}
}
output "one_vm_ip" {
description = "IP address of the opennebula VM"
value = resource.opennebula_virtual_machine.one_vm.ip
}Expected behavior
Both VMs has 15Gb disk size
Actual behavior
Only VM from second template has 15Gb disk size
Steps to Reproduce
Just try to create VMs from two templates
Debug output
No response
Panic output
No response
Important factoids
No response
References
No response
Reactions are currently unavailable