terraform-aws-module-template¶
terraform-aws-arc-load-balancer¶
Overview¶
This Terraform module provisions and configures an AWS Load Balancer (ALB/NLB) along with related resources such as target groups, listeners, listener rules, security groups, and logging configurations. It is designed for high availability, security, and scalability while allowing flexibility for integration with existing AWS infrastructure.
Features¶
- Load Balancer
- Supports Application Load Balancer (ALB) and Network Load Balancer (NLB)
- Option for internal or external load balancer
- Supports IPv4 and IPv6 addressing
- Cross-zone load balancing for improved traffic distribution
- Deletion protection to prevent accidental removal
Security and Access Control¶
- Ability to attach security groups dynamically
- Trust store support for managing client authentication securely
Target Groups & Attachments¶
- Dynamic target group creation for EC2 instances, Lambda functions, or IP addresses
- Supports stickiness policies for session persistence
- Configurable health checks to monitor target availability
- DNS failover & unhealthy state routing for improved reliability
- Target failover handling for high availability
Logging and Monitoring¶
- Access logging to Amazon S3 for audit and compliance
- Connection logs to track network-level traffic
Listener & Listener Rules¶
- Supports HTTP, HTTPS, TCP, and UDP listeners
- Configurable SSL/TLS certificates for secure traffic
- OIDC and Cognito authentication for secure access control
- Supports redirect, fixed response, and forward actions
Custom Configurations¶
- Subnet mappings to control network placement
- Fine-grained control over timeouts, session stickiness, and routing policies
- Weighted target group routing for intelligent traffic distribution
Usage¶
To see a full example, check out the main.tf file in the example folder.
Requirements¶
Name | Version |
---|---|
terraform | >= 1.5.0 |
aws | ~> 5.0 |
Providers¶
Name | Version |
---|---|
aws | 5.84.0 |
Modules¶
Name | Source | Version |
---|---|---|
arc_security_group | sourcefuse/arc-security-group/aws | 0.0.1 |
tags | sourcefuse/arc-tags/aws | 1.2.6 |
Resources¶
Name | Type |
---|---|
aws_lb.this | resource |
aws_lb_listener.this | resource |
aws_lb_listener_certificate.this | resource |
aws_lb_listener_rule.this | resource |
aws_lb_target_group.this | resource |
aws_lb_target_group_attachment.this | resource |
aws_lb_trust_store.this | resource |
Inputs¶
Name | Description | Type | Default | Required |
---|---|---|---|---|
alb_listener | n/a | object({ |
n/a | yes |
default_action | Default actions for the ALB listener. | list(object({ |
[] |
no |
lb_trust_store_config | The configuration for the Load Balancer Trust Stores | list(object({ |
null |
no |
listener_certificates | A map of listener certificates with their ARN | map(object({ |
{} |
no |
listener_rules | A map of listener rules | map(object({ |
{} |
no |
load_balancer_config | ######### alb security group config ########## | object({ |
n/a | yes |
network_forward_action | Default forward action for the ALB listener. | bool |
false |
no |
security_group_data | (optional) Security Group data | object({ |
{ |
no |
security_group_name | alb security group name | string |
n/a | yes |
security_groups | n/a | list(string) |
[] |
no |
tags | Tags to assign to the resource. | map(string) |
{} |
no |
target_group_attachment_config | List of target group attachment configurations | list(object({ |
null |
no |
target_group_config | ######### alb target group config ########## | object({ |
null |
no |
vpc_id | The VPC ID for the resources | string |
n/a | yes |
Outputs¶
Name | Description |
---|---|
arn | ARN of the load balancer |
dns_name | DNS name of the load balancer |
id | ID of the load balancer |
listener_arn | ARN of the load balancer listener |
security_group_ids | Security group IDs created |
target_group_arn | ARN of the target group |
target_group_health_check | Health check configuration of the target group |
target_group_stickiness | Stickiness configuration of the target group |
Versioning¶
This project uses a .version
file at the root of the repo which the pipeline reads from and does a git tag.
When you intend to commit to main
, you will need to increment this version. Once the project is merged,
the pipeline will kick off and tag the latest git commit.
Development¶
Prerequisites¶
Configurations¶
- Configure pre-commit hooks
Versioning¶
while Contributing or doing git commit please specify the breaking change in your commit message whether its major,minor or patch
For Example
Tests¶
- Tests are available in
test
directory - Configure the dependencies
- Now execute the test
Authors¶
This project is authored by: - SourceFuse ARC Team