Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Terraform module to deploy an NLB in front of your ALB and automatically update the targetgroups.

License

Notifications You must be signed in to change notification settings

lvthillo/terraform-nlb-alb-connector

Repository files navigation

Deprecation warning

AWS has launched direct NLB - ALB integration. This new feature allows AWS customers to directly register an ALB as an NLB target, eliminating the need to actively manage changing ALB IP addresses. This makes the use of this module obsolete.

Terraform NLB ALB connector

The NLB ALB connector is a Terraform module which makes it easy to create an AWS Network Load Balancer (L4) in front of an AWS Application Load Balancer (L7). A potential use case could be when a private connection from a different VPC to an ALB in your VPC is needed. AWS PrivateLink uses Network Load Balancers to connect interface endpoints to services. The TCP listener on a NLB accepts the private traffic and forwards it to an internal ALB. The ALB terminates TLS, examines HTTP headers, and routes requests based on your configured rules to target groups with your instances or containers.

The module will deploy an AWS Lambda function. The lambda will be watching the ALB for IP address changes and will update the NLB target group when needed.

Usage

module "nlb-alb-connector" {
  source = "lvthillo/alb-connector/nlb"
  nlb_target_arn = aws_lb_target_group.nlb-target.arn
  bucket_name = "my-nlb-alb-connector-bucket"
  alb_listener = 443
  alb_dns_name = aws_lb.my-alb.dns_name
}

Requirements

Name Version
terraform >= 0.12.26
aws >= 3.15

Providers

Name Version
aws >= 3.15

Modules

No modules.

Resources

Name Type
aws_cloudwatch_event_rule.every_minute resource
aws_cloudwatch_event_target.check_connection_every_minute resource
aws_iam_policy.lambda_policy resource
aws_iam_role.lambda_role resource
aws_iam_role_policy_attachment.lambda_role_policy_attachment resource
aws_lambda_function.lambda resource
aws_lambda_permission.allow_cloudwatch_to_call_lambda resource
aws_s3_bucket.bucket resource
aws_iam_policy_document.AWSLambdaTrustPolicy data source

Inputs

Name Description Type Default Required
alb_dns_name DNS of ALB string n/a yes
alb_listener Port of ALB number n/a yes
bucket_destroy Force destroy of S3 bucket used by Lambda string "false" no
bucket_name Name of required S3 bucket used by Lambda string n/a yes
cloudwatch_event_rule_name Name of Cloudwatch event rule string "" no
lambda_function_name Name for nlb-alb-connector-lambda string "nlb-alb-connector-lambda" no
lambda_policy_name Name for IAM role required for nlb-alb-connector-lambda string "nlb-alb-connector-lambda-policy" no
lambda_role_name Name for IAM role required for nlb-alb-connector-lambda string "nlb-alb-connector-lambda-role" no
nlb_target_arn Target ARN of NLB string n/a yes

Outputs

Name Description
bucket_arn The ARN of the bucket
bucket_id The ID of the bucket
lambda_arn The ARN of the lambda
lambda_id The ID of the lambda
policy_arn The ARN of the policy
policy_id The ID of the policy
role_arn The ARN of the role
role_id The ID of the role

About

Terraform module to deploy an NLB in front of your ALB and automatically update the targetgroups.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published