vatesfr / terraform-provider-xenorchestra

Xen Orchestra provider for Terraform
MIT License
150 stars 33 forks source link

xenorchestra_cloud_config error #210

Closed ranjith-hash closed 1 year ago

ranjith-hash commented 1 year ago

when using xenorchestra_cloud_config getting this error Error: json: cannot unmarshal object into Go value of type bool

Screenshot 2022-08-01 at 5 07 02 PM
4censord commented 1 year ago

What's your provider version? This should have been fixed in v0.23.3 already.

If you are on v0.23.3, then we need more logs

ranjith-hash commented 1 year ago

I have update to v.23.3 now, i don't see see any issues on terraform apply but xenorchestra_cloud_config not updating my cloud init i cloud able to update using cloudinit_config, can i able to assign static ip using any of this resources

ddelnano commented 1 year ago

@ranjith-hash please provide your terraform code and logs so we can better understand what you mean by "not updating my cloud init i cloud able to update using cloudinit_config".

When running terraform, please ensure the TF_LOG=debug environment variable is set.

ranjith-hash commented 1 year ago

please find my terraform code,

data "xenorchestra_pool" "pool" { name_label = "xcp-ng02" }

data "xenorchestra_template" "template" { name_label = "Ubuntu20" }

data "xenorchestra_network" "net" { pool_id = "xxx" name_label = "X2_DEV_VL41" }

data "template_file" "elk_netdata"{ template = templatefile("cloud_network_config.tftpl", { ip = "172.16.41.45" gwip = "172.16.41.1" }) } data "template_file" "elk_data"{ template = templatefile("cloud_config.tftpl", { hostname = "elk01" domain = "domain.com" }) } resource "xenorchestra_cloud_config" "elk_config" { name = "cloud config name" template = data.template_file.elk_data.rendered }

resource "xenorchestra_cloud_config" "elk_netdata" { name = "network config" template = data.template_file.elk_netdata.rendered }

resource "xenorchestra_vm" "elk_vm" { memory_max = 1073733632 cpus = 1 cloud_config = xenorchestra_cloud_config.elk_netdata.template cloud_network_config = xenorchestra_cloud_config.elk_netdata.template name_label = "ELK01" name_description = "ELK01" template = data.xenorchestra_template.template.id wait_for_ip = true

# Prefer to run the VM on the primary pool instance
affinity_host = data.xenorchestra_pool.pool.master
network {
  network_id = data.xenorchestra_network.net.id
}

disk {
  sr_id = "XX"
  name_label = "Ubuntu Bionic Beaver 18.04_imavo"
  size = 32212254720 
}

tags = [
  "Ubuntu",
  "Bionic",
]

// Override the default create timeout from 5 mins to 20.
timeouts {
  create = "20m"
}

}

log file

output.log

cloud config file hostname: ${hostname} fqdn: ${hostname}.${domain} users:

network config file

cloud-config

version: 1 config:

when i use above terrform code to change hostname it is not changing, if i use data "cloudinit_config" "elk01_config" { gzip = false base64_encode = false part { content_type = "text/cloud-config" content = templatefile("./cloud_conf.tftpl",{ hostname = "elk01" domain = "domain.com" }) } }

i can able to change hostname, i need to assign static ip for the vm how can i do that

Dr4s1l commented 1 year ago

same here just updated XOA, then try a new deploy and cloud_config throw same error. Also, looks like same root cause on destroy by indicating interface error : Error: json: cannot unmarshal bool into Go value of type []interface {} ressources are still destroyed

ddelnano commented 1 year ago

@ranjith-hash I believe the "not updating my cloudinit" is caused by https://github.com/terra-farm/terraform-provider-xenorchestra/issues/205. Once a VM is created, the cloudinit is fixed until the VM is recreated.

I'll likely be giving #205 another look soon, but for now this is expected behavior now that the unmarshal error is resolved.

@Dr4s1l please upgrade the your terraform provider version as that issue is addressed already.

I'm closing this for now, but happy to help in Discord or here if there are still issues.