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

xenorchestra_cloud_config error #210

Closed
ranjith-hash opened this issue Aug 1, 2022 · 6 comments
Closed

xenorchestra_cloud_config error #210

ranjith-hash opened this issue Aug 1, 2022 · 6 comments

Comments

@ranjith-hash
Copy link

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
Copy link
Contributor

4censord commented Aug 1, 2022

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
Copy link
Author

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
Copy link
Collaborator

ddelnano commented Aug 1, 2022

@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
Copy link
Author

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:

  • name: ubuntu
    sudo: ALL=(ALL) NOPASSWD:ALL
    home: /home/ubuntu
    shell: /bin/bash
    ssh_authorized_keys:
    • ssh-rsa XXX
  • htop
    output: {all: '| tee -a /var/log/cloud-init-output.log'}

network config file
#cloud-config
version: 1
config:
- type: physical
name: eth0
subnets:
- type: static
address: '${ip}'
netmask: '255.255.255.0'
gateway: '${gwip}'

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
Copy link

Dr4s1l commented Aug 11, 2022

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
Copy link
Collaborator

@ranjith-hash I believe the "not updating my cloudinit" is caused by #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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants