Skip to content

Commit b72f599

Browse files
committed
Add option to create internal load balancer
1 parent 3add18e commit b72f599

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ module "alb" {
55
description = var.description
66
name = var.name
77
enable_access_logs = var.enable_access_logs
8+
internal_alb = var.internal_alb
89
s3_logs_bucket_name = var.s3_logs_bucket_name
910

1011
namespace = var.namespace

modules/alb/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
resource "aws_alb" "this" {
22
name = join("-", concat(var.namespace, [var.name]))
3+
internal = var.internal_alb
34
security_groups = [aws_security_group.this.id]
45

56
dynamic "access_logs" {

modules/alb/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ variable "enable_access_logs" {
88
default = false
99
description = "Enable or disable ALB access logs. If set to true, logs will be stored in an S3 bucket."
1010
}
11+
12+
variable "internal_alb" {
13+
description = "If true, the LB will be internal. Defaults to false"
14+
type = bool
15+
default = false
16+
}
1117
variable "name" {
1218
description = "Name for this load balancer"
1319
type = string

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ variable "hosted_zone_name" {
7474
default = null
7575
}
7676

77+
variable "internal_alb" {
78+
description = "If true, the LB will be internal. Defaults to false"
79+
type = bool
80+
default = false
81+
}
82+
7783
variable "issue_certificates" {
7884
description = "Set to false to disable creation of ACM certificates"
7985
type = bool

0 commit comments

Comments
 (0)