Skip to content

Commit 9bcc0f2

Browse files
michaelmoussabrandonjbjelland
authored andcommitted
name moved to name_prefix which limits ALB name descriptiveness to 6 characters (#53)
1 parent 624d34b commit 9bcc0f2

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

examples/alb_test_fixture/main.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ provider "aws" {
77
region = "${var.region}"
88
}
99

10+
resource "random_id" "alb_name_suffix" {
11+
byte_length = 16
12+
}
13+
1014
resource "aws_iam_server_certificate" "fixture_cert" {
1115
name = "test_cert-${data.aws_caller_identity.current.account_id}-${data.aws_region.current.name}"
1216
certificate_body = "${file("${path.module}/../../examples/alb_test_fixture/certs/example.crt.pem")}"
@@ -56,7 +60,7 @@ module "security_group" {
5660

5761
module "alb" {
5862
source = "../.."
59-
load_balancer_name = "test-alb"
63+
load_balancer_name = "test-alb-${random_id.alb_name_suffix.hex}"
6064
load_balancer_security_groups = ["${module.security_group.this_security_group_id}"]
6165
log_bucket_name = "${aws_s3_bucket.log_bucket.id}"
6266
log_location_prefix = "${var.log_location_prefix}"

main.tf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
locals {
2-
prefix_length = "${length(var.load_balancer_name) < 6 ? length(var.load_balancer_name) : 6 }"
3-
name_prefix = "${substr(var.load_balancer_name, 0, local.prefix_length)}"
4-
}
5-
61
resource "aws_lb" "application" {
72
load_balancer_type = "application"
8-
name_prefix = "${local.name_prefix}"
3+
name = "${var.load_balancer_name}"
94
internal = "${var.load_balancer_is_internal}"
105
security_groups = ["${var.load_balancer_security_groups}"]
116
subnets = ["${var.subnets}"]

0 commit comments

Comments
 (0)