-
Notifications
You must be signed in to change notification settings - Fork 3
/
08-ec2 instances.tf
41 lines (36 loc) · 1.35 KB
/
08-ec2 instances.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
41
resource "aws_instance" "app1-instances" {
count = "${length(var.azs)}"
ami = "ami-0aeeebd8d2ab47354"
instance_type = "t2.micro"
availability_zone = element(var.azs, count.index)
subnet_id = aws_subnet.priv-subnets[count.index].id
vpc_security_group_ids = [aws_security_group.allow_tls.id]
user_data = file("bash-scripts/http1.sh")
tags = {
Name = "app1-${element(var.azs, count.index)}"
}
}
resource "aws_instance" "init-instances" {
count = "${length(var.azs)}"
ami = "ami-0aeeebd8d2ab47354"
instance_type = "t2.micro"
availability_zone = element(var.azs, count.index)
subnet_id = aws_subnet.priv-subnets[count.index].id
vpc_security_group_ids = [aws_security_group.allow_tls.id]
user_data = file("bash-scripts/http2.sh")
tags = {
Name = "init-${element(var.azs, count.index)}"
}
}
resource "aws_instance" "app2-instances" {
count = "${length(var.azs)}"
ami = "ami-0aeeebd8d2ab47354"
instance_type = "t2.micro"
availability_zone = element(var.azs, count.index)
subnet_id = aws_subnet.priv-subnets[count.index].id
vpc_security_group_ids = [aws_security_group.allow_tls.id]
user_data = file("bash-scripts/http3.sh")
tags = {
Name = "app2-${element(var.azs, count.index)}"
}
}