A basic terraform module for setting up Application load balancers and target groups.
By default, http listener are created to forward to target group but https can be supported via enable_https
(see below for more options).
#### VPC
module "networking" {
source = "github.com/Jareechang/tf-modules//networking?ref=v1.0.0"
env = var.env
project_id = var.project_id
subnet_public_cidrblock = [
"10.0.1.0/24",
"10.0.2.0/24"
]
subnet_private_cidrblock = [
"10.0.11.0/24",
"10.0.22.0/24"
]
azs = ["us-east-1a", "us-east-1b"]
}
#### Target group
module "ecs_tg" {
source = "github.com/Jareechang/tf-modules//alb?ref=v1.0.2"
create_target_group = true
port = 80
protocol = "HTTP"
target_type = "ip"
vpc_id = module.networking.vpc_id
}
#### ALB
module "alb" {
source = "github.com/Jareechang/tf-modules//alb?ref=v1.0.2"
create_alb = true
enable_https = false
internal = false
load_balancer_type = "application"
security_groups = [aws_security_group.alb_ecs_sg.id]
subnets = module.networking.public_subnets[*].id
target_group = module.ecs_tg.tg.arn
}
No requirements.
Name | Version |
---|---|
aws | n/a |
Name | Description | Type | Default | Required |
---|---|---|---|---|
create_alb | Whether or not to create an ALB | bool |
false |
no |
create_target_group | Whether or not to create an LB target group | bool |
false |
no |
enable_https | n/a | bool |
false |
no |
env | Environment for the project | string |
"dev" |
no |
internal | n/a | bool |
false |
no |
load_balancer_type | n/a | string |
"application" |
no |
port | Port for the target group | number |
80 |
no |
project_id | Unique project ID | string |
"web" |
no |
protocol | n/a | string |
"HTTP" |
no |
security_groups | n/a | list(string) |
[ |
no |
subnets | n/a | list(string) |
[ |
no |
target_group | n/a | string |
"ip" |
no |
target_type | n/a | string |
"ip" |
no |
vpc_id | n/a | string |
"" |
no |
Name | Description |
---|---|
http_listener | The http listener info |
https_listener | The https listner info |
lb | The load balancer info |
tg | The target group info |