An open API service indexing awesome lists of open source software.

https://github.com/geekcell/terraform-aws-application-load-balancer

Terraform module to provision an AWS Application Load Balancer.
https://github.com/geekcell/terraform-aws-application-load-balancer

aws load-balancer terraform terraform-module

Last synced: about 1 year ago
JSON representation

Terraform module to provision an AWS Application Load Balancer.

Awesome Lists containing this project

README

          

[![Geek Cell GmbH](https://raw.githubusercontent.com/geekcell/.github/main/geekcell-github-banner.png)](https://www.geekcell.io/)

### Code Quality
[![License](https://img.shields.io/github/license/geekcell/terraform-aws-application-load-balancer)](https://github.com/geekcell/terraform-aws-application-load-balancer/blob/master/LICENSE)
[![GitHub release (latest tag)](https://img.shields.io/github/v/release/geekcell/terraform-aws-application-load-balancer?logo=github&sort=semver)](https://github.com/geekcell/terraform-aws-application-load-balancer/releases)
[![Release](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/release.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/release.yaml)
[![Validate](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/validate.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/validate.yaml)
[![Lint](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/linter.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/linter.yaml)
[![Test](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/test.yaml/badge.svg)](https://github.com/geekcell/terraform-aws-application-load-balancer/actions/workflows/test.yaml)

# Terraform AWS Application Load Balancer

This Terraform module provides a preconfigured solution for setting up an
AWS Application Load Balancer in your AWS account. The Application Load
Balancer is a highly available and scalable load balancing solution for
your applications. With this Terraform module, you can easily and
efficiently set up and manage your load balancer, ensuring that your
applications are highly available and can handle increasing traffic.

Our team has extensive experience working with AWS load balancers and
has optimized this module to provide the best possible experience for
users. The module encapsulates all necessary configurations, making it
easy to use and integrate into your existing AWS environment. Whether you
are just getting started with load balancing or looking for a more efficient
way to manage your applications, this Terraform module provides a
preconfigured solution for high availability and scalability.

## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| [access\_logs\_bucket\_id](#input\_access\_logs\_bucket\_id) | The S3 bucket name to store the logs in. | `string` | `""` | no |
| [access\_logs\_bucket\_prefix](#input\_access\_logs\_bucket\_prefix) | The S3 bucket prefix. Logs are stored in the root if not configured. | `string` | `""` | no |
| [customer\_owned\_ipv4\_pool](#input\_customer\_owned\_ipv4\_pool) | The ID of the customer owned ipv4 pool to use for this load balancer. | `string` | `null` | no |
| [desync\_mitigation\_mode](#input\_desync\_mitigation\_mode) | Determines how the load balancer handles requests that might pose a security risk to an application due to HTTP desync. | `string` | `"strictest"` | no |
| [drop\_invalid\_header\_fields](#input\_drop\_invalid\_header\_fields) | Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true) or routed to targets (false). | `bool` | `false` | no |
| [enable\_cross\_zone\_load\_balancing](#input\_enable\_cross\_zone\_load\_balancing) | If true, cross-zone load balancing of the load balancer will be enabled. | `bool` | `false` | no |
| [enable\_deletion\_protection](#input\_enable\_deletion\_protection) | If true, deletion of the load balancer will be disabled via the AWS API. | `bool` | `true` | no |
| [enable\_http2](#input\_enable\_http2) | Indicates whether HTTP/2 is enabled in application load balancers. | `bool` | `true` | no |
| [enable\_http\_to\_https\_redirect](#input\_enable\_http\_to\_https\_redirect) | Whether to create a default HTTP to HTTPS redirect rule. | `bool` | `true` | no |
| [enable\_security\_group](#input\_enable\_security\_group) | Whether to create a security group for the load balancer. | `bool` | `true` | no |
| [enable\_security\_group\_default\_http\_https\_rule](#input\_enable\_security\_group\_default\_http\_https\_rule) | Whether to create a default security group rule to allow HTTP and HTTPS traffic from anywhere. | `bool` | `false` | no |
| [enable\_waf\_fail\_open](#input\_enable\_waf\_fail\_open) | Indicates whether to allow a WAF-enabled load balancer to route requests to targets if it is unable to forward the request to AWS WAF. | `bool` | `false` | no |
| [idle\_timeout](#input\_idle\_timeout) | The time in seconds that the connection is allowed to be idle. | `number` | `60` | no |
| [internal](#input\_internal) | If true, the LB will be internal. | `bool` | `false` | no |
| [ip\_address\_type](#input\_ip\_address\_type) | The type of IP addresses used by the subnets for your load balancer. | `string` | `"ipv4"` | no |
| [name](#input\_name) | Name or prefix of the Role. | `string` | n/a | yes |
| [preserve\_host\_header](#input\_preserve\_host\_header) | Indicates whether the Application Load Balancer should preserve the Host header in the HTTP request and send it to the target without any change. | `bool` | `false` | no |
| [security\_group\_egress\_rules](#input\_security\_group\_egress\_rules) | A list of CIDR blocks to allow ingress traffic from. | `any` | `[]` | no |
| [security\_group\_ingress\_rules](#input\_security\_group\_ingress\_rules) | A list of CIDR blocks to allow ingress traffic from. | `any` | `[]` | no |
| [security\_groups](#input\_security\_groups) | A list of security group IDs to assign to the LB. | `list(string)` | `[]` | no |
| [subnets](#input\_subnets) | A list of subnet IDs to attach to the LB. | `list(string)` | n/a | yes |
| [tags](#input\_tags) | Tags to add to the Role. | `map(any)` | `{}` | no |

## Outputs

| Name | Description |
|------|-------------|
| [arn](#output\_arn) | ARN of the Application Load Balancer |
| [arn\_suffix](#output\_arn\_suffix) | The ARN suffix for use with CloudWatch Metrics. |
| [dns\_name](#output\_dns\_name) | The DNS name of the load balancer. |
| [http\_to\_https\_listener\_arn](#output\_http\_to\_https\_listener\_arn) | ARN of the HTTP to HTTPS listener |
| [security\_group](#output\_security\_group) | Security group ID of the Application Load Balancer |
| [zone\_id](#output\_zone\_id) | The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record) |

## Providers

| Name | Version |
|------|---------|
| [aws](#provider\_aws) | >= 4.4 |

## Resources

- resource.aws_lb.main (main.tf#19)
- resource.aws_lb_listener.main (main.tf#49)
- data source.aws_subnet.main (data.tf#1)

# Examples
### Basic Example
```hcl
module "vpc" {
source = "registry.terraform.io/terraform-aws-modules/vpc/aws"
version = "~> 5.0.0"

name = "main"
cidr = "10.100.0.0/16"
azs = ["eu-central-1a", "eu-central-1b"]
public_subnets = ["10.100.10.0/24", "10.100.11.0/24"]
}

module "basic-example" {
source = "../../"

name = "my-lb"
subnets = module.vpc.public_subnets

enable_security_group_default_http_https_rule = true
}
```