AWS Application Load Balancer (ALB) Terraform Module

Terraform module to provision Application Load Balancer on AWS.

Usage

Simple setup

Create a simple ALB with default configurations.

    module "alb" {
        source          = "app.terraform.io/ncodelibrary/alb/aws"
        version         = "0.1.2"
        security_groups = "sg-xxxxxxxxxx"
        identifier      = "example"
        subnet_ids      = ["subnet-xxxxxxxxxxxx", "subnet-xxxxxxxxxxxx"]
        vpc_id          = "vpc-xxxxxxxxxxx"
        tags            = {
            Owner       = "sysops"
            env         = "dev"
            Cost_Center = "XYZ"
        }
    }

For more details on a working example, please visit examples/simple

Advanced Setup

If you want to create ALB with enhanced configuration e.g HTTPS listener, Internal Traffic Only etc., you can use the module like this:

    module "alb" {
        source              = "app.terraform.io/ncodelibrary/alb/aws"
        version             = "0.1.2"
        security_groups     = "sg-xxxxxxxxxx"
        identifier          = "example"
        lb_is_internal      = true
        alb_certificate_arn = ["arn:aws:acm:us-east-1:XXXXXXXX:certificate/xxxxxxxxxxxx"]
        subnet_ids          = ["subnet-xxxxxxxxxxxx", "subnet-xxxxxxxxxxxx"]
        vpc_id              = "vpc-xxxxxxxxxxx"
        tags                = {
            Owner       = "sysops"
            env         = "dev"
            Cost_Center = "XYZ"
        }
    }

For more options refer to a working example at examples/advanced

Examples

Here are some working examples of using this module:

Requirements

Name Version
terraform >= 0.12

Providers

Name Version
aws n/a

Modules

No Modules.

Resources

Name
aws_lb
aws_lb_listener
aws_lb_listener_certificate

Inputs

Name Description Type Default Required
alb_certificate_arn ARN for the load balancer certificate list(string) [] no
append_workspace Appends the terraform workspace at the end of resource names, - bool true no
identifier Identifier for all the resource string "" no
lb_is_internal Boolean that represent if the load balancer will be internal or no bool false no
security_groups Security group list(string) n/a yes
subnet_ids List of all the subnets list(string) [] no
tags Tags to be applied to the resource map {} no
vpc_id The VPC where all the resources belong string "" no

Outputs

Name Description
output n/a

Contributing

If you want to contribute to this repository check all the guidelines specified here before submitting a new PR.