-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
60 lines (52 loc) · 1.32 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
60
module "network_module" {
source = "./modules/network_module"
vpc_name = "NotDefault VPC"
}
module "ec2_server_module" {
source = "./modules/ec2_server_module"
subnet_id = module.network_module.aws_subnet
vpc_id = module.network_module.aws_vpc
my_public_ip = var.my_public_ip
instance_name = var.instance_name
}
module "alb_module" {
source = "./modules/alb_module"
vpc_id = module.network_module.aws_vpc
}
module "alb" {
source = "terraform-aws-modules/alb/aws"
version = "~> 8.0"
name = "my-alb-test"
load_balancer_type = "application"
vpc_id = module.network_module.aws_vpc
subnets = ["subnet-0f1d27873c4699ff3", "subnet-0813388e5a895137a"]
security_groups = [module.alb_module.aws_security_group]
target_groups = [
{
name_prefix = "pref-"
backend_protocol = "HTTP"
backend_port = 80
target_type = "instance"
targets = {
my_target = {
target_id = "i-01b726647c7628288"
port = 80
}
my_other_target = {
target_id = "i-08100658f58302a40"
port = 80
}
}
}
]
http_tcp_listeners = [
{
port = 80
protocol = "HTTP"
target_group_index = 0
}
]
tags = {
Environment = "Test"
}
}