radekg / terraform-provisioner-ansible

Ansible with Terraform 0.14.x
Apache License 2.0
572 stars 100 forks source link

Error: rpc error: code = Internal desc = grpc: error while marshaling: proto: field "tfplugin5.ProvisionResource.Response.Output" contains invalid UTF-8 #139

Closed donovanmuller closed 4 years ago

donovanmuller commented 4 years ago

Steps to reproduce

On two occasion now, once while installing Ansible and the other when a play was finished on one provisioned instance I have received the following error:

Error: rpc error: code = Internal desc = grpc: error while marshaling: proto: field "tfplugin5.ProvisionResource.Response.Output" contains invalid UTF-8

See https://github.com/hashicorp/terraform/issues/22856

Expected behavior

Terraform successfully creates and provisions, with Ansible, compute instances

Actual behavior

Receive:

Error: rpc error: code = Internal desc = grpc: error while marshaling: proto: field "tfplugin5.ProvisionResource.Response.Output" contains invalid UTF-8

at seemingly random points during an apply every now and then (I.e. not consistent, does work most times...).

Configuration

Terraform version: Terraform v0.12.9

terraform-provisioner-ansible version/SHA: 2.3.1/1ea0e20

Terraform file / provisioner configuration:

resource "google_compute_instance" "x" {
    count = 3

    name = "x-${count.index + 1}"
    machine_type = "n1-standard-2"

    scheduling {
        automatic_restart = false
        preemptible = true
    }

    boot_disk {
        initialize_params {
            image = "centos-7"
            size = 100
        }
    }

...

    connection {
        host = self.network_interface[0].network_ip
        user = var.bastion_user
        private_key = file(var.bastion_private_key_path)
        bastion_host = google_compute_instance.x-bastion.network_interface[0].access_config[0].nat_ip
    }

    provisioner "ansible" {
        plays {
            playbook {
                file_path = "${path.module}/ansible/playbooks/x.yml"
                roles_path = [
                    "${path.module}/ansible/roles"
                ]
            }
        }

        remote {}
    }
}

Terraform run log:

google_compute_instance.x[0] (ansible):      |██████████████████████████▍     | 11.8MB 3.4MB/s eta 0:00:01
google_compute_instance.x[0] (ansible):      |██████████████████████████▍     | 11.8MB 3.4MB/s eta 0:00:01

Error: rpc error: code = Internal desc = grpc: error while marshaling: proto: field "tfplugin5.ProvisionResource.Response.Output" contains invalid UTF-8
google_compute_instance.x[0] (ansible): PLAY RECAP *********************************************************************
google_compute_instance.x[0] (ansible): localhost                  : ok=7    changed=5    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

google_compute_instance.x[0] (ansible): Cleaning up after bootstrap...
google_compute_instance.x[0] (ansible): Cleanup complete.
google_compute_instance.x[0]: Creation complete after 6m34s [id=x-1]

Error: rpc error: code = Internal desc = grpc: error while marshaling: proto: field "tfplugin5.ProvisionResource.Response.Output" contains invalid UTF-8