Skip to content

Commit 79c464b

Browse files
authored
Bugfix issue with ALB bucket output name and name in general (#247)
1 parent 9697073 commit 79c464b

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
locals {
2-
enabled = module.this.enabled
3-
partition = join("", data.aws_partition.current[*].partition)
2+
enabled = module.this.enabled
3+
partition = join("", data.aws_partition.current[*].partition)
4+
s3_bucket_access_log_name = var.s3_bucket_access_log_bucket_name != "" ? var.s3_bucket_access_log_bucket_name : "${module.this.id}-alb-logs-${random_string.elb_logs_suffix.result}"
45
}
56

67
data "aws_partition" "current" {
@@ -1103,7 +1104,7 @@ module "elb_logs" {
11031104
source = "cloudposse/lb-s3-bucket/aws"
11041105
version = "0.19.0"
11051106
enabled = var.enable_loadbalancer_logs && local.enabled && var.tier == "WebServer" && var.environment_type == "LoadBalanced" && var.loadbalancer_type != "network" && !var.loadbalancer_is_shared ? true : false
1106-
name = "${module.this.id}-alb-logs-${random_string.elb_logs_suffix.result}"
1107+
name = local.s3_bucket_access_log_name
11071108
force_destroy = var.force_destroy
11081109
versioning_enabled = var.s3_bucket_versioning_enabled
11091110
context = module.this.context

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ output "load_balancers" {
8484
}
8585

8686
output "load_balancer_log_bucket" {
87-
value = var.enable_loadbalancer_logs ? "${module.this.id}-eb-loadbalancer-logs-${random_string.elb_logs_suffix.result}" : null
87+
value = var.enable_loadbalancer_logs ? local.s3_bucket_access_log_name : null
8888
description = "Name of bucket where Load Balancer logs are stored (if enabled)"
8989
}
9090

0 commit comments

Comments
 (0)