Closed cryptiklemur closed 5 years ago
fwiw, doing a normal remote-exec
works fine
provisioner "remote-exec" {
connection {
agent = false
port = 22
user = "ubuntu"
private_key = "${base64decode("${var.private_key}")}"
bastion_host = "${var.bastion_host_ip}"
bastion_user = "${var.bastion_user}"
bastion_private_key = "${base64decode("${var.bastion_private_key}")}"
}
inline = ["uname -a"]
}
I have this right above the ansible provisioner and it runs, then i get the panic when it trys to run ansible.
A full file, for testing:
resource "aws_instance" "main" {
ami = "${data.aws_ami.ami.id}"
instance_type = "t3.nano"
key_name = "${var.ssh_key_pair}"
associate_public_ip_address = false
subnet_id = "${var.subnet_id}"
vpc_security_group_ids = ["${var.ssh_security_group_id}"]
connection {
agent = false
port = 22
user = "ubuntu"
private_key = "${base64decode("${var.private_key}")}"
bastion_host = "${var.bastion_host_ip}"
bastion_user = "${var.bastion_user}"
bastion_private_key = "${base64decode("${var.bastion_private_key}")}"
}
provisioner "remote-exec" {
inline = ["uname -a"]
}
provisioner "ansible" {
plays {
playbook = {
file_path = "${path.module}/provision.yml"
}
extra_vars = {
bucket = "${aws_s3_bucket.bucket.bucket}"
}
become = true
become_method = "sudo"
become_user = "root"
}
}
}
Hi @aequasi, thank you for the report. I will take a look at this.
Steps to reproduce
My example:
Expected behavior
Ansible correctly Provisions
...
Actual behavior
Get an error: unexpected EOF
...
Configuration
Terraform version: Terraform v0.11.8
terraform-provisioner-ansible version/SHA: v2.0.1
Terraform file / provisioner configuration: Shown above
Terraform run log: