{"action":"closed","issue":{"url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/473","repository_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt","labels_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/473/labels{/name}","comments_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/473/comments","events_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/473/events","html_url":"https://github.com/dmacvicar/terraform-provider-libvirt/issues/473","id":378340122,"node_id":"MDU6SXNzdWUzNzgzNDAxMjI=","number":473,"title":"Cannot use cloud-init on RancherOS","user":{"login":"tommyknows","id":16387735,"node_id":"MDQ6VXNlcjE2Mzg3NzM1","avatar_url":"https://avatars2.githubusercontent.com/u/16387735?v=4","gravatar_id":"","url":"https://api.github.com/users/tommyknows","html_url":"https://github.com/tommyknows","followers_url":"https://api.github.com/users/tommyknows/followers","following_url":"https://api.github.com/users/tommyknows/following{/other_user}","gists_url":"https://api.github.com/users/tommyknows/gists{/gist_id}","starred_url":"https://api.github.com/users/tommyknows/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommyknows/subscriptions","organizations_url":"https://api.github.com/users/tommyknows/orgs","repos_url":"https://api.github.com/users/tommyknows/repos","events_url":"https://api.github.com/users/tommyknows/events{/privacy}","received_events_url":"https://api.github.com/users/tommyknows/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-11-07T15:33:10Z","updated_at":"2018-11-13T16:49:02Z","closed_at":"2018-11-13T16:49:02Z","author_association":"NONE","body":"#  Version Reports:\r\n\r\n### Distro  version of host:\r\n\r\n``` Ubuntu 18.04```\r\n\r\n### Terraform Version Report\r\n\r\n```sh\r\nterraform -v\r\nTerraform v0.11.10\r\n+ provider.libvirt (unversioned)\r\n+ provider.template v1.0.0\r\n```\r\n(libvirt built from source a few days ago)\r\n\r\n### Provider and libvirt versions\r\n\r\n```sh\r\nterraform-provider-libvirt -version\r\nThis binary is a plugin. These are not meant to be executed directly.\r\nPlease execute the program that consumes these plugins, which will\r\nload any plugins automatically\r\n```\r\n(? 😄)\r\n\r\n___\r\n# Description of Issue/Question\r\nI cannot use cloud-init for configuring a RancherOS Instance.\r\nAccording to [this](https://github.com/rancher/os/issues/1501), the drive should be called \"config-2\", although I'm neither an expert on cloud-init nor RancherOS. \r\nThe instance boots, but does not apply the cloud-init provided through the terraform module. From the RancherOS Host's cloud-init log:\r\n```\r\ntime=\"2018-11-07T15:11:41Z\" level=info msg=\"datasources that will be consided: []string{\"configdrive:/media/config-2\"}\"\r\ntime=\"2018-11-07T15:11:41Z\" level=info msg=\"cloud-init: Checking availability of \"cloud-drive\"\"\r\ntime=\"2018-11-07T15:11:41Z\" level=error msg=\"no such file or directory\"\r\ntime=\"2018-11-07T15:11:41Z\" level=info msg=\"cloud-init: Datasource unavailable, skipping: cloud-drive: /media/config-2 (lastError: no such file or directory)\"\r\ntime=\"2018-11-07T15:11:41Z\" level=info msg=\"Cloud-init datasource that was used: %!s(<nil>)\"\r\n```\r\n\r\nIt should be the same as with CoreOS, so I guess cloud-init wouldn't work with CoreOS too. However, with CoreOS, you'd use ignition, so maybe no one noticed.\r\n\r\n### Setup\r\n```\r\nprovider \"libvirt\" {\r\n    uri = \"qemu:///system\"\r\n}\r\n\r\ndata \"template_file\" \"user_data\" {\r\n  template = \"${file(\"cloud_init.cfg\")}\"\r\n}\r\n\r\nresource \"libvirt_cloudinit_disk\" \"commoninit\" {\r\n  name           = \"commoninit.iso\"\r\n  user_data      = \"${data.template_file.user_data.rendered}\"\r\n}\r\n\r\nresource \"libvirt_domain\" \"kubernetes\" {\r\n  name   = \"kubernetes-terraform\"\r\n  memory = \"2048\"\r\n  vcpu   = 2\r\n\r\n  cloudinit = \"${libvirt_cloudinit_disk.commoninit.id}\"\r\n\r\n  network_interface {\r\n    network_name = \"default\"\r\n  }\r\n\r\n  boot_device {\r\n    dev = [ \"hd\", \"network\"]\r\n  }\r\n\r\n  console {\r\n    type        = \"pty\"\r\n    target_port = \"0\"\r\n    target_type = \"serial\"\r\n  }\r\n\r\n  console {\r\n    type        = \"pty\"\r\n    target_type = \"virtio\"\r\n    target_port = \"1\"\r\n  }\r\n\r\n  disk {\r\n    volume_id = \"${libvirt_volume.rancheros.id}\"\r\n  }\r\n\r\n  graphics {\r\n    type        = \"spice\"\r\n    listen_type = \"address\"\r\n    autoport    = true\r\n  }\r\n\r\n}\r\n\r\nresource \"libvirt_volume\" \"rancheros\" {\r\n  name = \"rancheros\"\r\n  pool = \"default\"\r\n  source = \"rancheros.img\"\r\n  format = \"qcow2\"\r\n}\r\n```\r\n\r\nAnd a virsh dumpxml:\r\n```\r\n<domain type='kvm' id='1'>\r\n  <name>kubernetes-terraform</name>\r\n  <uuid>a8b1f3ef-2a55-475e-814b-aeb65606b8f7</uuid>\r\n  <memory unit='KiB'>2097152</memory>\r\n  <currentMemory unit='KiB'>2097152</currentMemory>\r\n  <vcpu placement='static'>2</vcpu>\r\n  <resource>\r\n    <partition>/machine</partition>\r\n  </resource>\r\n  <os>\r\n    <type arch='x86_64' machine='pc-i440fx-bionic'>hvm</type>\r\n    <boot dev='hd'/>\r\n    <boot dev='network'/>\r\n  </os>\r\n  <features>\r\n    <acpi/>\r\n    <apic/>\r\n    <pae/>\r\n  </features>\r\n  <clock offset='utc'/>\r\n  <on_poweroff>destroy</on_poweroff>\r\n  <on_reboot>restart</on_reboot>\r\n  <on_crash>destroy</on_crash>\r\n  <devices>\r\n    <emulator>/usr/bin/kvm-spice</emulator>\r\n    <disk type='volume' device='disk'>\r\n      <driver name='qemu' type='qcow2'/>\r\n      <source pool='default' volume='rancheros'/>\r\n      <backingStore/>\r\n      <target dev='vda' bus='virtio'/>\r\n      <alias name='virtio-disk0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>\r\n    </disk>\r\n    <disk type='file' device='cdrom'>\r\n      <driver name='qemu' type='raw'/>\r\n      <source file='/var/lib/libvirt/images/commoninit.iso'/>\r\n      <backingStore/>\r\n      <target dev='hda' bus='ide'/>\r\n      <readonly/>\r\n      <alias name='ide0-0-0'/>\r\n      <address type='drive' controller='0' bus='0' target='0' unit='0'/>\r\n    </disk>\r\n    <controller type='usb' index='0' model='piix3-uhci'>\r\n      <alias name='usb'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>\r\n    </controller>\r\n    <controller type='pci' index='0' model='pci-root'>\r\n      <alias name='pci.0'/>\r\n    </controller>\r\n    <controller type='ide' index='0'>\r\n      <alias name='ide'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>\r\n    </controller>\r\n    <controller type='virtio-serial' index='0'>\r\n      <alias name='virtio-serial0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>\r\n    </controller>\r\n    <interface type='network'>\r\n      <mac address='ba:9f:c0:50:7c:07'/>\r\n      <source network='k8s-hostnet' bridge='virbr0'/>\r\n      <target dev='vnet0'/>\r\n      <model type='virtio'/>\r\n      <alias name='net0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>\r\n    </interface>\r\n    <serial type='pty'>\r\n      <source path='/dev/pts/1'/>\r\n      <target type='isa-serial' port='0'>\r\n        <model name='isa-serial'/>\r\n      </target>\r\n      <alias name='serial0'/>\r\n    </serial>\r\n    <console type='pty' tty='/dev/pts/1'>\r\n      <source path='/dev/pts/1'/>\r\n      <target type='serial' port='0'/>\r\n      <alias name='serial0'/>\r\n    </console>\r\n    <console type='pty'>\r\n      <source path='/dev/pts/3'/>\r\n      <target type='virtio' port='1'/>\r\n      <alias name='console1'/>\r\n    </console>\r\n    <channel type='pty'>\r\n      <source path='/dev/pts/2'/>\r\n      <target type='virtio' name='org.qemu.guest_agent.0' state='disconnected'/>\r\n      <alias name='channel0'/>\r\n      <address type='virtio-serial' controller='0' bus='0' port='1'/>\r\n    </channel>\r\n    <input type='mouse' bus='ps2'>\r\n      <alias name='input0'/>\r\n    </input>\r\n    <input type='keyboard' bus='ps2'>\r\n      <alias name='input1'/>\r\n    </input>\r\n    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>\r\n      <listen type='address' address='127.0.0.1'/>\r\n    </graphics>\r\n    <video>\r\n      <model type='cirrus' vram='16384' heads='1' primary='yes'/>\r\n      <alias name='video0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>\r\n    </video>\r\n    <memballoon model='virtio'>\r\n      <alias name='balloon0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>\r\n    </memballoon>\r\n    <rng model='virtio'>\r\n      <backend model='random'>/dev/random</backend>\r\n      <alias name='rng0'/>\r\n      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>\r\n    </rng>\r\n  </devices>\r\n  <seclabel type='dynamic' model='dac' relabel='yes'>\r\n    <label>+64055:+113</label>\r\n    <imagelabel>+64055:+113</imagelabel>\r\n  </seclabel>\r\n</domain>\r\n```\r\n\r\nI think the cloud-init file is not relevant, as it gets ignored.\r\n\r\n### Steps to Reproduce Issue\r\nApply the above terraform file.\r\n"}}
{"actor":{"display_login":"dmacvicar"}}