{"action":"opened","issue":{"url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/513","repository_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt","labels_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/513/labels{/name}","comments_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/513/comments","events_url":"https://api.github.com/repos/dmacvicar/terraform-provider-libvirt/issues/513/events","html_url":"https://github.com/dmacvicar/terraform-provider-libvirt/issues/513","id":395202918,"node_id":"MDU6SXNzdWUzOTUyMDI5MTg=","number":513,"title":"Provisioner file fails when the provider is a remote machine","user":{"login":"arbulu89","id":36370954,"node_id":"MDQ6VXNlcjM2MzcwOTU0","avatar_url":"https://avatars1.githubusercontent.com/u/36370954?v=4","gravatar_id":"","url":"https://api.github.com/users/arbulu89","html_url":"https://github.com/arbulu89","followers_url":"https://api.github.com/users/arbulu89/followers","following_url":"https://api.github.com/users/arbulu89/following{/other_user}","gists_url":"https://api.github.com/users/arbulu89/gists{/gist_id}","starred_url":"https://api.github.com/users/arbulu89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arbulu89/subscriptions","organizations_url":"https://api.github.com/users/arbulu89/orgs","repos_url":"https://api.github.com/users/arbulu89/repos","events_url":"https://api.github.com/users/arbulu89/events{/privacy}","received_events_url":"https://api.github.com/users/arbulu89/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-02T10:22:35Z","updated_at":"2019-01-02T10:22:35Z","closed_at":null,"author_association":"NONE","body":"#  Version Reports:\r\n\r\n### Distro  version of host:\r\n\r\n``` openSUSE Leap 15.0```\r\n\r\n### Terraform Version Report\r\n\r\n```Terraform v0.11.10```\r\n\r\n### Provider and libvirt versions\r\nlibvirt version:\r\n```libvirtd (libvirt) 4.0.0```\r\n\r\nterraform-provider-libvirt plugin version (git-hash)\r\n\r\nCurrent master: afd5c1a78fab19313cbacc9b56dbc5cf6024cae9\r\n___\r\n# Description of Issue/Question\r\nThe provisioner \"file\" step fails when the provider uri is a remote machine. I would expect that the file/folder to be copied to the new VM would be taken from the machine that terraform command is executed (the same way when we use the local qemu uri).\r\n\r\nHere the error log:\r\n```\r\n\r\nError: Error applying plan:\r\n\r\n1 error(s) occurred:\r\n\r\n* libvirt_domain.domain-ubuntu: timeout - last error: ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain\r\n\r\nTerraform does not automatically rollback in the face of errors.\r\nInstead, your Terraform state file has been partially updated with\r\nany resources that successfully completed. Please address the error\r\nabove and apply again to incrementally change your infrastructure.\r\n```\r\n\r\nIn other similar setup I have seen this error too:\r\n```\r\nError: Error applying plan:\r\n\r\n2 error(s) occurred:\r\n\r\n* module.hana_node.module.hana_node.libvirt_domain.domain[0]: timeout - last error: dial tcp 192.168.121.214:22: i/o timeout\r\n* module.hana_node.module.hana_node.libvirt_domain.domain[1]: timeout - last error: dial tcp 192.168.121.97:22: connect: no route to host\r\n\r\nTerraform does not automatically rollback in the face of errors.\r\nInstead, your Terraform state file has been partially updated with\r\nany resources that successfully completed. Please address the error\r\nabove and apply again to incrementally change your infrastructure.\r\n\r\n```\r\n\r\nIs there any possibility that the file provisioner is executed from the terraform host machine and not in the provided provider uri?\r\n\r\n### Setup\r\n```\r\n# instance the provider\r\nprovider \"libvirt\" {\r\n  uri = \"qemu+ssh://<user>@<machine>/system\"\r\n}\r\n\r\n# We fetch the latest ubuntu release image from their mirrors\r\nresource \"libvirt_volume\" \"ubuntu-qcow2\" {\r\n  name   = \"ubuntu-qcow2\"\r\n  pool   = \"default\"\r\n  source = \"https://cloud-images.ubuntu.com/releases/xenial/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img\"\r\n  format = \"qcow2\"\r\n}\r\n\r\ndata \"template_file\" \"user_data\" {\r\n  template = \"${file(\"${path.module}/cloud_init.cfg\")}\"\r\n}\r\n\r\ndata \"template_file\" \"network_config\" {\r\n  template = \"${file(\"${path.module}/network_config.cfg\")}\"\r\n}\r\n\r\n# for more info about paramater check this out\r\n# https://github.com/dmacvicar/terraform-provider-libvirt/blob/master/website/docs/r/cloudinit.html.markdown\r\n# Use CloudInit to add our ssh-key to the instance\r\n# you can add also meta_data field\r\nresource \"libvirt_cloudinit_disk\" \"commoninit\" {\r\n  name           = \"commoninit.iso\"\r\n  user_data      = \"${data.template_file.user_data.rendered}\"\r\n  network_config = \"${data.template_file.network_config.rendered}\"\r\n}\r\n\r\n# Create the machine\r\nresource \"libvirt_domain\" \"domain-ubuntu\" {\r\n  name   = \"ubuntu-terraform\"\r\n  memory = \"512\"\r\n  vcpu   = 1\r\n\r\n  cloudinit = \"${libvirt_cloudinit_disk.commoninit.id}\"\r\n\r\n  network_interface {\r\n    network_name = \"vagrant-libvirt\"\r\n  }\r\n\r\n  # IMPORTANT: this is a known bug on cloud images, since they expect a console\r\n  # we need to pass it\r\n  # https://bugs.launchpad.net/cloud-images/+bug/1573095\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.ubuntu-qcow2.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  provisioner \"file\" {\r\n    source = \"salt\"\r\n    destination = \"/root\"\r\n  }\r\n}\r\n\r\n# IPs: use wait_for_lease true or after creation use terraform refresh and terraform show for the ips of domain\r\n\r\n```\r\n\r\n### Steps to Reproduce Issue\r\nExecute standard terraform command (init, plan, apply) and check how the provisioner \"file\" step fails due network problems:\r\n\r\n```\r\nterraform apply\r\n```\r\n\r\n___\r\n# Additional Infos:\r\n--\r\n"}}
{"actor":{"display_login":"arbulu89"}}