All Projects → trussworks → terraform-aws-nlb-containers

trussworks / terraform-aws-nlb-containers

Licence: BSD-3-Clause license
Creates a Network Load Balancer (NLB) for serving an ECS backed service.

Programming Languages

HCL
1544 projects
go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to terraform-aws-nlb-containers

terraform-codedeploy
Terraform module to add codedeploy
Stars: ✭ 29 (+163.64%)
Mutual labels:  terraform-modules
terraform-aws-base-networking
Terraform module for building base networking in AWS
Stars: ✭ 15 (+36.36%)
Mutual labels:  terraform-modules
terraform-ecs-fargate-nlb
A Terraform template used for provisioning network application stacks on AWS ECS Fargate
Stars: ✭ 50 (+354.55%)
Mutual labels:  nlb
terraform-azurerm-compute
Terraform Azure RM Compute Module
Stars: ✭ 133 (+1109.09%)
Mutual labels:  terraform-modules
terraform-aws-backup
Terraform module to provision AWS Backup, a fully managed backup service that makes it easy to centralize and automate the back up of data across AWS services such as EBS volumes, RDS databases, DynamoDB tables, EFS file systems, and AWS Storage Gateway volumes.
Stars: ✭ 62 (+463.64%)
Mutual labels:  terraform-modules
terraform-aws-config
This module configures AWS Config, a service that enables you to assess, audit, and evaluate the configurations of your AWS resources.
Stars: ✭ 24 (+118.18%)
Mutual labels:  terraform-modules
terraform-aws-cloudtrail
Creates and configures AWS CloudTrail
Stars: ✭ 40 (+263.64%)
Mutual labels:  terraform-modules
terraform-aws-ecs-task-definition
A Terraform module for creating Amazon ECS Task Definitions
Stars: ✭ 67 (+509.09%)
Mutual labels:  terraform-modules
terraform-aws-api-gateway
Terraform module to create Route53 resource on AWS for create api gateway with it's basic elements.
Stars: ✭ 43 (+290.91%)
Mutual labels:  terraform-modules
terraform-aws-iam-user
A Terraform module to create and manage Identity and Access Management (IAM) Users on Amazon Web Services (AWS). https://aws.amazon.com/iam
Stars: ✭ 17 (+54.55%)
Mutual labels:  terraform-modules
terraform-oci-vcn
A reusable and extensible Terraform module that provisions a VCN on Oracle Cloud Infrastructure
Stars: ✭ 22 (+100%)
Mutual labels:  terraform-modules
terranetes
Terraform boilerplate for production-grade Kubernetes clusters on AWS (optionally includes kube-system components, OpenVPN, an ingress controller, monitoring services...)
Stars: ✭ 15 (+36.36%)
Mutual labels:  terraform-modules
terraform-aws-druid
Terraform module to deploy Apache Druid in Kubernetes
Stars: ✭ 16 (+45.45%)
Mutual labels:  terraform-modules
terraform-aws-route53-cluster-zone
Terraform module to easily define consistent cluster domains on Route53 (e.g. `prod.ourcompany.com`)
Stars: ✭ 42 (+281.82%)
Mutual labels:  terraform-modules
terraform-module-versions
CLI tool that checks Terraform code for module updates. Single binary, no dependencies. linux, osx, windows. #golang #cli #terraform
Stars: ✭ 143 (+1200%)
Mutual labels:  terraform-modules
terraform-aws-efs-backup
Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
Stars: ✭ 40 (+263.64%)
Mutual labels:  terraform-modules
terraform-aws-cloudtrail
Terraform module to provision an AWS CloudTrail and an encrypted S3 bucket with versioning to store CloudTrail logs
Stars: ✭ 78 (+609.09%)
Mutual labels:  terraform-modules
terraform-google-kubernetes-istio
Creates a kubernetes cluster with istio enabled on GKE
Stars: ✭ 27 (+145.45%)
Mutual labels:  terraform-modules
terraform-aws-lambda-auto-package
A terraform module to define a lambda function which source files are automatically built and packaged for lambda deployment.
Stars: ✭ 23 (+109.09%)
Mutual labels:  terraform-modules
hk-independent-bus-eta
獨立無廣告巴士預報 App
Stars: ✭ 20 (+81.82%)
Mutual labels:  nlb

Creates a Network Load Balancer (NLB) for serving an ECS backed service.

Creates the following resources:

  • NLB associated with 3 Elastic IP addresses xor 3 IPv4 addresses.
  • TCP listener.
  • Target group for the TCP listener over the specified container port.

Terraform Versions

Terraform 0.13 and newer. Pin module version to ~> 4.X. Submit pull-requests to master branch.

Terraform 0.12. Pin module version to ~> 2.X. Submit pull-requests to terraform012 branch.

Upgrade from 3.x to 4.0.0

Version 4.0.0 added the ability to specify IPv4 addresses instead of elastic IPs. The nlb_ipv4_addrs option was added.

As part of this upgrade, the output variable nlb_elastic_ips was renamed to nlb_ips. Therefore, if you use that output variable in your code, you will need to rename it to nlb_ips.

Usage

This module requires attachment to either 3 EIPs (defined with nlb_eip_ids) xor 3 IPv4 addresses (nlb_ipv4_addrs), but not both EIPs and IPv4 addresses at the same time. If neither option is defined, the module will fail.

With EIPs:

module "app_nlb" {
  source = "trussworks/nlb-containers/aws"

  name           = "app"
  environment    = "prod"
  logs_s3_bucket = "my-aws-logs"

  container_port           = "8443"
  enable_proxy_protocol_v2 = true

  nlb_eip_ids = [
    "eipalloc-0a2306142e1ef53c7",
    "eipalloc-02b30c140722f7659",
    "eipalloc-0e51514ffe125ad3c",
  ]
  nlb_subnet_ids = "${module.vpc.public_subnets}"
  nlb_vpc_id     = "${module.vpc.vpc_id}"
}

With IPv4 addresses:

module "app_nlb" {
  source = "trussworks/nlb-containers/aws"

  name           = "app"
  environment    = "prod"
  logs_s3_bucket = "my-aws-logs"

  container_port           = "8443"
  enable_proxy_protocol_v2 = true

  nlb_ipv4_addrs = [
    "10.1.1.1",
    "10.1.2.1",
    "10.1.3.1",
  ]
  nlb_subnet_ids = "${module.vpc.public_subnets}"
  nlb_vpc_id     = "${module.vpc.vpc_id}"
}

Requirements

Name Version
terraform >= 0.13.0
aws >= 3.0

Providers

Name Version
aws >= 3.0

Modules

No modules.

Resources

Name Type
aws_lb.main resource
aws_lb_listener.main resource
aws_lb_target_group.main resource
aws_eip.nlb_eip1 data source
aws_eip.nlb_eip2 data source
aws_eip.nlb_eip3 data source

Inputs

Name Description Type Default Required
container_port The port on which the container will receive traffic. string 443 no
enable_cross_zone_load_balancing If true, cross-zone load balancing of the load balancer will be enabled. string true no
enable_proxy_protocol_v2 Boolean to enable / disable support for proxy protocol v2. string "true" no
environment Environment tag, e.g prod. string n/a yes
health_check_interval The approximate amount of time, in seconds, between health checks of an individual target. Minimum value 5 seconds, Maximum value 300 seconds. Default 30 seconds. string 30 no
health_check_path When using a HTTP(S) health check, the destination for the health check requests to the container. string "/" no
health_check_port The port on which the container will receive health checks. string 443 no
health_check_protocol The protocol that will be used for health checks. Options are: TCP, HTTP, HTTPS string "TCP" no
logs_s3_bucket S3 bucket for storing Network Load Balancer logs. Access logs are created only if the load balancer has a TLS listener and they contain information only about TLS requests. string n/a yes
name The service name. string n/a yes
nlb_eip_ids Use either this or nlb_ipv4_addrs, but not both. List of Elastic IP allocation IDs to associate with the NLB. Requires exactly 3 IPs. Not compatible with the nlb_ipv4_addrs variable. list(string) [] no
nlb_ipv4_addrs Use either this or nlb_eip_ids, but not both. List of private IPv4 addresses to associate with the NLB. Requires exactly 3 IPs. Not compatible with the nlb_eip_ids variable. list(string) [] no
nlb_listener_port The port on which the NLB will receive traffic. string "443" no
nlb_subnet_ids Subnets IDs for the NLB. list(string) n/a yes
nlb_vpc_id VPC ID to be used by the NLB. string n/a yes
target_group_name Override the default name of the NLB's target group. Must be less than or equal to 32 characters. Default: ecs-[name]-[environment]-[port]. string "" no

Outputs

Name Description
nlb_arn The ARN of the NLB.
nlb_dns_name DNS name of the NLB.
nlb_ips List of IP addresses associated with the NLB.
nlb_listener_arn The ARN associated with the listener on the NLB.
nlb_target_group_arn ARN of the NLB target group.
nlb_target_group_id ID of the NLB target group.
nlb_zone_id The canonical hosted zone ID of the load balancer.

Developer Setup

Install dependencies (macOS)

brew install pre-commit go terraform terraform-docs

Testing

Terratest is being used for automated testing with this module. Tests in the test folder can be run locally by running the following command:

make test

Or with aws-vault:

AWS_VAULT_KEYCHAIN_NAME=<NAME> aws-vault exec <PROFILE> -- make test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].