From 7b73044555d834ef97c9a9319529b8fe62e97e46 Mon Sep 17 00:00:00 2001 From: Puneeth Date: Mon, 6 Dec 2021 09:30:40 +0100 Subject: [PATCH] NLB module (#9) --- nlb/README.md | 36 ++++++++++++++++++++++++++++++++++++ nlb/main.tf | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 nlb/README.md create mode 100644 nlb/main.tf diff --git a/nlb/README.md b/nlb/README.md new file mode 100644 index 0000000..d10e7cf --- /dev/null +++ b/nlb/README.md @@ -0,0 +1,36 @@ +## Requirements + +No requirements. + +## Providers + +| Name | Version | +|------|---------| +| [aws](#provider\_aws) | n/a | + +## Modules + +No modules. + +## Resources + +| Name | Type | +|------|------| +| [aws_lb.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb) | resource | + +## Inputs + +| Name | Description | Type | Default | Required | +|------|-------------|------|---------|:--------:| +| [enable\_cross\_zone\_load\_balancing](#input\_enable\_cross\_zone\_load\_balancing) | Whether the loadbalancer should have cross zone load balancing enabled | `bool` | `true` | no | +| [enable\_delete\_protection](#input\_enable\_delete\_protection) | Whether the loadbalancer should have delete protection enabled | `bool` | `true` | no | +| [internal](#input\_internal) | Whether the loadbalancer is internal or not | `bool` | n/a | yes | +| [name](#input\_name) | The name of the loadbalancer | `string` | n/a | yes | +| [subnets](#input\_subnets) | The subnets to attach to the loadbalancer | `list(string)` | n/a | yes | +| [tags](#input\_tags) | Tags to apply to the loadbalancer | `map(string)` | `{}` | no | + +## Outputs + +| Name | Description | +|------|-------------| +| [output](#output\_output) | Loadbalancer attributes | diff --git a/nlb/main.tf b/nlb/main.tf new file mode 100644 index 0000000..911b465 --- /dev/null +++ b/nlb/main.tf @@ -0,0 +1,47 @@ +variable "name" { + type = string + description = "The name of the loadbalancer" +} + +variable "internal" { + type = bool + description = "Whether the loadbalancer is internal or not" +} + +variable "subnets" { + type = list(string) + description = "The subnets to attach to the loadbalancer" +} + +variable "enable_delete_protection" { + type = bool + description = "Whether the loadbalancer should have delete protection enabled" + default = true +} + +variable "enable_cross_zone_load_balancing" { + type = bool + description = "Whether the loadbalancer should have cross zone load balancing enabled" + default = true +} + +variable "tags" { + type = map(string) + description = "Tags to apply to the loadbalancer" + default = {} +} + +resource "aws_lb" "this" { + name = var.name + internal = var.internal + load_balancer_type = "network" + enable_deletion_protection = var.enable_delete_protection + enable_cross_zone_load_balancing = var.enable_cross_zone_load_balancing + subnets = var.subnets + tags = var.tags +} + +output "output" { + value = aws_lb.this + description = "Loadbalancer attributes" +}