Skip to content

realfredlai/terraform-aws-alb

 
 

Repository files navigation

GitHub release (latest SemVer)

AWS Application and Network Load Balancer Terraform module

Terraform module which creates Application and/or Network Load Balancer resources in AWS.

These types of resources are supported:

Terraform versions

Terraform 0.12. Pin module version to ~> v2.1. Submit pull-requests to master branch.

Usage

Application Load Balancer

module "alb" {
  source = "umotif-public/alb/aws"
  version = "~> 2.1.0"

  name_prefix = "complete-alb"

  load_balancer_type = "application"

  internal = false
  vpc_id             = "vpc-abasdasd132"
  subnets            = ["subnet-abasdasd132123", "subnet-abasdasd132123132"]

  access_logs = {
    bucket = "alb-logs"
  }

  tags = {
    Project = "Test"
  }
}

Network Load Balancer

module "nlb" {
  source = "umotif-public/alb/aws"
  version = "~> 2.1.0"

  name_prefix = "complete-nlb"

  load_balancer_type = "network"

  vpc_id             = "vpc-abasdasd132"
  subnets            = ["subnet-abasdasd132123", "subnet-abasdasd132123132"]

  access_logs = {
    bucket = "nlb-logs"
  }

  tags = {
    Project = "Test"
  }
}

Examples

Authors

Authors

Module managed by uMotif.

Requirements

Name Version
terraform ~> 1.0.11
aws >= 3.40.0

Providers

Name Version
aws >= 3.40.0

Modules

No modules.

Resources

Name Type
aws_lb.main resource
aws_lb_listener.frontend_http_to_https_redirect resource
aws_security_group.main resource
aws_security_group_rule.allow_port_443_ingress_for_http_to_https_redirect resource
aws_security_group_rule.allow_port_80_ingress_for_http_to_https_redirect resource
aws_security_group_rule.egress resource

Inputs

Name Description Type Default Required
access_logs An Access Logs block. map(string) {} no
cidr_blocks_redirect List of CIDR ranges to allow at security group level. Defaults to 0.0.0.0/0 list(string)
[
"0.0.0.0/0"
]
no
description The description of the all resources. string "Managed by Terraform" no
enable_cross_zone_load_balancing If true, cross-zone load balancing of the load balancer will be enabled. This is a network load balancer feature. bool false no
enable_deletion_protection If true, deletion of the load balancer will be disabled via the AWS API. This will prevent Terraform from deleting the load balancer. bool false no
enable_http2 Indicates whether HTTP/2 is enabled in application load balancers. bool true no
enable_http_to_https_redirect Enable default redirect rule from port 80 to 443. bool false no
idle_timeout (Optional) The time in seconds that the connection is allowed to be idle. Only valid for Load Balancers of type application. number 60 no
internal Provision an internal load balancer. Defaults to false. bool false no
ip_address_type The type of IP addresses used by the subnets for your load balancer. The possible values are ipv4 and dualstack. string "ipv4" no
load_balancer_create_timeout Timeout value when creating the ALB. string "15m" no
load_balancer_delete_timeout Timeout value when deleting the ALB. string "15m" no
load_balancer_type Type of load balancer to provision (network or application). string "application" no
load_balancer_update_timeout Timeout value when updating the ALB. string "15m" no
name_prefix A prefix used for naming resources. string n/a yes
subnet_mapping A list of subnet mapping blocks describing subnets to attach to network load balancer list(map(string)) [] no
subnets A list of subnet IDs to attach to the LB. list(string) n/a yes
tags A map of tags (key-value pairs) passed to resources. map(string) {} no
vpc_id The VPC ID. string n/a yes

Outputs

Name Description
arn The ARN of the load balancer.
arn_suffix The ARN suffix for use with CloudWatch Metrics.
dns_name The DNS name of the load balancer.
name The name of the load balancer.
origin_id First part of the DNS name of the load balancer.
security_group_id The ID of the security group.
zone_id The canonical hosted zone ID of the load balancer (to be used in a Route 53 Alias record).

License

See LICENSE for full details.

Pre-commit hooks

Install dependencies

MacOS

brew install pre-commit terraform-docs tflint

brew tap git-chglog/git-chglog
brew install git-chglog

About

A Terraform module to create an AWS Application Load Balancer (ALB).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 94.2%
  • Makefile 5.8%