Интерполяция в provisioner-е на Google Cloud Platform
resource "aws_route53_record" "www" {
count = 2
zone_id = data.aws_route53_zone.selected.zone_id
name = "xeonmp22-${count.index}.${data.aws_route53_zone.selected.name}"
type = "A"
ttl = "300"
records = ["${element(google_compute_instance.ubuntu.*.network_interface.0.access_config.0.nat_ip, count.index)}"]
provisioner "local-exec" {
command = "ansible-playbook -u root -i '${element(google_compute_instance.ubuntu.*.network_interface.0.access_config.0.nat_ip, count.index)},' --private-key ~/.ssh/key3 nginx.yml"
}
provisioner "remote-exec" {
connection {
type = "ssh"
host = element(google_compute_instance.ubuntu.*.network_interface.0.access_config.0.nat_ip, count.index)
user = "root"
private_key = file("~/.ssh/key3")
}
inline = [
"echo '<html><head><title>node-${count.index}</title></head><body><h1>node-${count.index}</h1></body></html>' > l/var/www/html/index.nginx-debian.html"
]
}
}