Skip to content

Commit dd06fec

Browse files
author
Steven Nemetz
committed
Only create S3 related resource if ALB
1 parent 2540feb commit dd06fec

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

main.tf

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,60 @@ data "aws_acm_certificate" "this" {
6565
/*
6666
resource "aws_lb" "application" {
6767
count = "${module.enabled.value && var.type == "application" ? 1 : 0}"
68+
name = "${module.label.id_32}"
69+
internal = "${var.internal}"
70+
load_balancer_type = "${var.type}"
71+
#enable_deletion_protection = "${}"
72+
idle_timeout = "${var.idle_timeout}"
73+
#ip_address_type = "${}"
74+
security_groups = ["${var.security_groups}"]
75+
subnets = ["${var.subnets}"]
76+
tags = "${module.label.tags}"
77+
access_logs {
78+
bucket = "${var.log_bucket_name}"
79+
prefix = "${var.log_location_prefix}"
80+
enabled = "${module.enable_logging.value}"
81+
}
82+
/*
83+
subnet_mapping {
84+
subnet_id = "${}"
85+
allocation_id = "${}"
86+
}
87+
*/
88+
/*
89+
timeouts {
90+
create =
91+
delete =
92+
update =
93+
}
94+
*//*
95+
depends_on = ["aws_s3_bucket.log_bucket"]
96+
}
97+
/*
6898
resource "aws_lb" "network" {
6999
count = "${module.enabled.value && var.type == "network" ? 1 : 0}"
100+
name = "${module.label.id_32}"
101+
internal = "${var.internal}"
102+
load_balancer_type = "${var.type}"
103+
#enable_deletion_protection = "${}"
104+
idle_timeout = "${var.idle_timeout}"
105+
#ip_address_type = "${}"
106+
subnets = ["${var.subnets}"]
107+
tags = "${module.label.tags}"
108+
/*
109+
subnet_mapping {
110+
subnet_id = "${}"
111+
allocation_id = "${}"
112+
}
113+
*/
114+
/*
115+
timeouts {
116+
create =
117+
delete =
118+
update =
119+
}
120+
*//*
121+
}
70122
*/
71123
resource "aws_lb" "this" {
72124
count = "${module.enabled.value}"
@@ -107,6 +159,7 @@ data "aws_iam_policy_document" "bucket_policy" {
107159
count = "${
108160
module.enabled.value &&
109161
module.enable_logging.value &&
162+
var.type == "application" &&
110163
var.create_log_bucket ? 1 : 0}"
111164
statement {
112165
sid = "AllowToPutLoadBalancerLogsToS3Bucket"
@@ -127,6 +180,7 @@ resource "aws_s3_bucket" "log_bucket" {
127180
count = "${
128181
module.enabled.value &&
129182
module.enable_logging.value &&
183+
var.type == "application &&"
130184
var.create_log_bucket ? 1 : 0}"
131185
bucket = "${var.log_bucket_name}"
132186
#acl

0 commit comments

Comments
 (0)