Module: nlb
Terraform module to create an NLB and a default NLB target and related security groups.
Usage
For a complete example, see examples/complete.
For automated test of the complete example using bats
and Terratest
, see test.
provider "aws" {
region = var.region
}
module "vpc" {
source = "cloudposse/vpc/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
cidr_block = var.vpc_cidr_block
context = module.this.context
namespace = "eg"
}
module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
availability_zones = var.availability_zones
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
nat_gateway_enabled = false
nat_instance_enabled = false
context = module.this.context
namespace = "eg"
}
module "nlb" {
source = "cloudposse/nlb/aws"
# Cloud Posse recommends pinning every module to a specific version
# version = "x.x.x"
vpc_id = module.vpc.vpc_id
subnet_ids = module.subnets.public_subnet_ids
internal = var.internal
tcp_enabled = var.tcp_enabled
access_logs_enabled = var.access_logs_enabled
nlb_access_logs_s3_bucket_force_destroy = var.nlb_access_logs_s3_bucket_force_destroy
nlb_access_logs_s3_bucket_force_destroy_enabled = var.nlb_access_logs_s3_bucket_force_destroy_enabled
cross_zone_load_balancing_enabled = var.cross_zone_load_balancing_enabled
idle_timeout = var.idle_timeout
ip_address_type = var.ip_address_type
deletion_protection_enabled = var.deletion_protection_enabled
deregistration_delay = var.deregistration_delay
health_check_path = var.health_check_path
health_check_timeout = var.health_check_timeout
health_check_threshold = var.health_check_healthy_threshold
health_check_unhealthy_threshold = var.health_check_unhealthy_threshold
health_check_interval = var.health_check_interval
target_group_port = var.target_group_port
target_group_target_type = var.target_group_target_type
context = module.this.context
}