-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnull-resource.tf
27 lines (26 loc) · 894 Bytes
/
null-resource.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
resource "null_resource" "cluster" {
count = 1
provisioner "file" {
source = "index.html"
destination = "/tmp/index.html"
connection {
type = "ssh"
user = "ubuntu"
private_key = file("development.pem")
host = aws_instance.web-1.*.public_ip[count.index] # we need to use like this when we have the multiple instances.
}
}
provisioner "remote-exec" {
inline = [
"echo 'my public ip address is ${aws_instance.web-1.0.public_ip}' >> /tmp/index.html",
"sudo rm /var/www/html/*.html",
"sudo cp /tmp/index.html /var/www/html/index.html"
]
connection {
type = "ssh"
user = "ubuntu"
private_key = file("development.pem")
host = aws_instance.web-1.*.public_ip[count.index] # we need to use like this when we have the multiple instances.
}
}
}