Hi There,
Does anyone know , how to run ansible playbook inside terraform after creating inventory during the terraform apply, below is my command and need some help on local-exec provisioner section
the error keeps saying unsupported argument for ansible, which is a valid one but i dont get an idea on how to resolve it
resource "local_file" "inventory" {
filename = "./inventory"
content = <<EOF
[ec2]
${aws_instance.ec2[0].private_ip}
${aws_instance.ec2[1].private_ip}
EOF
}
resource "null_resource" "null_1" {
provisioner "local-exec" {
command = "sleep 60 ; ansible-playbook -i inventory , --private-key ${local.private_key_path} httpd.yaml"
}
}