-
Notifications
You must be signed in to change notification settings - Fork 0
/
web.tf
52 lines (42 loc) · 1.16 KB
/
web.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
42
43
44
45
46
47
48
49
50
51
52
module "security_group_web" {
source = "app.terraform.io/animal-squad/security-group/aws"
version = "1.0.1"
name_prefix = "${local.name}-web-sg"
vpc_id = module.network.vpc_id
ingress_rules = {
ssh = {
from_port = 22
to_port = 22
ip_protocol = "TCP"
cidr_ipv4 = "0.0.0.0/0"
}
nextjs = {
from_port = 3000
to_port = 3000
ip_protocol = "TCP"
cidr_ipv4 = "10.0.0.0/20"
}
}
}
module "instance_web" {
for_each = {
service_0 = {
az = "ap-northeast-2a"
}
service_1 = {
az = "ap-northeast-2b"
}
}
source = "app.terraform.io/animal-squad/ec2/aws"
version = "1.0.2"
name_prefix = "${local.name}-instance-web-${each.key}"
ami = "ami-0d81776ee23e75c00" # Amazon Linux 2023 x86_64 with docker
az = each.value.az
instance_type = "t3.small"
security_group_ids = [module.security_group_web.id]
subnet_id = module.network.public_subnets[each.key].id
vpc_id = module.network.vpc_id
associate_public_ip_address = true
root_volume_size = 50
key_name = module.key_pair.name
}