forked from NickMRamirez/Proxy-Benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nginx.tf
40 lines (34 loc) · 976 Bytes
/
nginx.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
28
29
30
31
32
33
34
35
36
37
38
39
40
resource "aws_instance" "nginx" {
ami = "${data.aws_ami.ubuntu.id}"
instance_type = "${var.aws_instance_type}"
subnet_id = "${aws_subnet.benchmarks.id}"
vpc_security_group_ids = ["${aws_security_group.benchmarks.id}"]
key_name = "${var.ssh_keypair_name}"
depends_on = ["aws_instance.webserver"]
tags = {
Name = "nginx"
}
connection {
type = "ssh"
user = "ubuntu"
private_key = "${file("./${var.ssh_keypair_name}.pem")}"
host = "${self.public_ip}"
}
provisioner "file" {
source = "./nginx/nginx.conf"
destination = "/tmp/nginx.conf"
}
provisioner "file" {
source = "./nginx/nginx_setup.sh"
destination = "/tmp/setup.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /tmp/setup.sh",
"sudo /tmp/setup.sh",
]
}
}
output "nginx_public_ip" {
value = "${aws_instance.nginx.public_ip}"
}