Terraform module to create application load balancer
terrafrom module config example:
module "starmine_api_ecs_task_service_alb_primary" {
count = local.lb_count
source = "../.."
load_balancer_name = local.lb_name
target_group_name = local.lb_name
vpc_id = var.vpc_id
subnet_ids = var.subnet_ids
internal = true
http_port = "80"
target_group_port = "8080"
health_check_path = "/research-analytics/starmine/beta1/actuator/health"
health_check_matcher = "200"
labels = merge(local.labels, { component = "alb-enterprise" }, ) //use alb as component name for better naming
}
more info see examples/test
terraform run example
cd examples/test
export TF_VAR_ENV="exampletest"
terraform init
terraform plan
No requirements.
Name | Version |
---|---|
aws | n/a |
No modules.
Name | Type |
---|---|
aws_lb.default | resource |
aws_lb_listener.http_forward | resource |
aws_lb_target_group.default | resource |
aws_security_group.default | resource |
aws_security_group_rule.egress | resource |
aws_security_group_rule.http_ingress | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
deletion_protection_enabled | A boolean flag to enable/disable deletion protection for ALB | bool |
false |
no |
health_check_healthy_threshold | The number of consecutive health checks successes required before considering an unhealthy target healthy | number |
2 |
no |
health_check_interval | The duration in seconds in between health checks | number |
15 |
no |
health_check_matcher | The HTTP response codes to indicate a healthy check | string |
"200-399" |
no |
health_check_path | The destination for the health check request | string |
"/" |
no |
health_check_port | The port to use for the healthcheck | string |
"traffic-port" |
no |
health_check_protocol | The protocol to use for the healthcheck. If not specified, same as the traffic protocol | string |
null |
no |
health_check_timeout | The amount of time to wait in seconds before failing a health check request | number |
10 |
no |
health_check_unhealthy_threshold | The number of consecutive health check failures required before considering the target unhealthy | number |
2 |
no |
http_enabled | A boolean flag to enable/disable HTTP listener | bool |
true |
no |
http_ingress_cidr_blocks | List of CIDR blocks to allow in HTTP security group | list(string) |
[ |
no |
http_port | The port for the HTTP listener | number |
80 |
no |
idle_timeout | The time in seconds that the connection is allowed to be idle | number |
60 |
no |
internal | A boolean flag to determine whether the ALB should be internal | bool |
true |
no |
labels | Minimum required map of labels(tags) for creating aws resources | object({ |
n/a | yes |
load_balancer_name | The name for the default load balancer, uses a module label name if left default | string |
"" |
no |
security_group_enabled | Enables the security group | bool |
true |
no |
security_group_ids | A list of additional security group IDs to allow access to ALB | list(string) |
[] |
no |
subnet_ids | A list of subnet IDs to associate with ALB | list(string) |
n/a | yes |
tags | Additional tags | map(string) |
{} |
no |
target_group_name | The name for the default target group, uses a module label name if left default | string |
"" |
no |
target_group_port | The port for the default target group | number |
80 |
no |
target_group_protocol | The protocol for the default target group HTTP or HTTPS | string |
"HTTP" |
no |
target_group_protocol_version | The protocol version for the default target group HTTP1 or HTTP2 or GRPC | string |
"HTTP1" |
no |
target_group_target_type | The type (instance , ip or lambda ) of targets that can be registered with the target group |
string |
"ip" |
no |
vpc_id | The ID of the VPC where the Security Group will be created. | string |
n/a | yes |
Name | Description |
---|---|
alb_arn | The ARN of the ALB |
alb_dns_name | DNS name of ALB |
alb_name | The ARN suffix of the ALB |
alb_zone_id | The ID of the zone which ALB is provisioned |
default_target_group_arn | The default target group ARN |
http_listener_arn | The ARN of the HTTP forwarding listener |
security_group_id | The security group ID of the ALB |