forked from moeid404/aws-terraform-vpc-alb-asg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
60 lines (51 loc) · 1.97 KB
/
main.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
53
54
55
56
57
58
59
module "vpc" {
source = "./modules/01-vpc-igw"
}
module "subnets" {
source = "./modules/02-subnets"
vpc_id = module.vpc.vpc_id
}
module "natgw" {
source = "./modules/03-natgw-eip"
public_subnet_a_id = module.subnets.public_subnet_a_id
public_subnet_b_id = module.subnets.public_subnet_b_id
}
module "route_tables" {
source = "./modules/04-route_tables"
vpc_id = module.vpc.vpc_id
internet_gateway_id = module.vpc.internet_gateway_id
nat_gateway_a_id = module.natgw.nat_gateway_a_id
nat_gateway_b_id = module.natgw.nat_gateway_b_id
public_subnet_a_id = module.subnets.public_subnet_a_id
public_subnet_b_id = module.subnets.public_subnet_b_id
private_subnet_a_id = module.subnets.private_subnet_a_id
private_subnet_b_id = module.subnets.private_subnet_b_id
}
module "security_groups" {
source = "./modules/05-security_groups"
vpc_id = module.vpc.vpc_id
}
module "instances-bastion" {
source = "./modules/06-instances-Bastion"
public_subnet_a_id = module.subnets.public_subnet_a_id
public_subnet_b_id = module.subnets.public_subnet_b_id
private_subnet_a_id = module.subnets.private_subnet_a_id
private_subnet_b_id = module.subnets.private_subnet_b_id
public_sg_id = module.security_groups.public_sg_id
private_sg_id = module.security_groups.private_sg_id
}
module "alb" {
source = "./modules/07-ALB"
public_sg_id = module.security_groups.public_sg_id
public_subnet_a_id = module.subnets.public_subnet_a_id
public_subnet_b_id = module.subnets.public_subnet_b_id
vpc_id = module.vpc.vpc_id
}
module "autoscaling" {
source = "./modules/08-auto_scaling_group"
key_pair_name = module.instances-bastion.key_pair_name
public_sg_id = module.security_groups.public_sg_id
private_subnet_a_id = module.subnets.private_subnet_a_id
private_subnet_b_id = module.subnets.private_subnet_b_id
target_group_arn = module.alb.target_group_arn
}