Terraform module for Load Balancer
This is a stable example. It should successfully build out of the box
This module provides a Load Balancer resources in AWS cloud provider.......
This module needs Terraform 0.12.19 or newer. You can download the latest Terraform version from here.
This module deploys aws services details are in respective feature branches.
Below we are able to check the resources that are being created as part of this module call:
- Load Balancer
To use this module, add the following call to your code:
- Example: For Application Load Balancer
module "alb" {
source = "git::https://github.com/nitinda/terraform-module-aws-lb.git?ref=master"
providers = {
aws = aws.services
}
name = "alb"
security_groups = [
module.security_group_alb.id
]
subnets = [
module.vpc_subnet_public_1a.id,
module.vpc_subnet_public_1b.id
]
tags = merge(
var.common_tags,
{
Environment = "prod"
Name = "alb"
}
)
}
- Example: For Network Load Balancer
module "nlb" {
source = "git::https://github.com/nitinda/terraform-module-aws-lb.git?ref=master"
providers = {
aws = aws.services
}
name = "nlb"
load_balancer_type = "network"
subnets = [
module.vpc_subnet_public_1a.id,
module.vpc_subnet_public_1b.id
]
tags = merge(
var.common_tags,
{
Environment = "prod"
Name = "nlb"
}
)
}
The variables required in order for the module to be successfully called from the deployment repository are the following:
Variable | Description | Type | Argument Status | Default Value |
---|---|---|---|---|
name | The name of the LB | string | Optional | null |
name | Creates a unique name beginning with the specified prefix | string | Optional | null |
internal | If true, the LB will be internal | bool | Optional | false |
load_balancer_type | The type of load balancer to create | string | Optional | application |
security_groups | ALB security group. This is a Application load balancer feature. |
list(string) | Optional | [] |
access_logs | An Access Logs block | map(string) | Optional | {} |
subnets | A list of subnet IDs to attach to the LB | list(string) | Optional | [] |
subnet_mapping | A subnet mapping block as documented below | map(string) | Optional | {} |
enable_deletion_protection | If true, deletion of the load balancer will be disabled via the AWS API |
boolean | Optional | false |
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. |
boolean | Optional | false |
enable_http2 | Indicates whether HTTP/2 is enabled in application load balancers |
boolean | Optional | true |
tags | A mapping of tags to assign to the resource | map(string) | Optional | {} |
- dns_name
- id
- arn
The output variable is able to be accessed through terraform state file using the syntax below:
data.terraform_remote_state.<module_name>.<output_variable_name>
Module maintained by Module maintained by the - Nitin Das