forked from techservicesillinois/terraform-aws-lb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
44 lines (37 loc) · 1.39 KB
/
main.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_lb" "default" {
count = length(keys(var.access_logs)) == 0 ? 1 : 0
name = var.name
internal = var.internal
security_groups = concat(var.security_groups, [aws_security_group.default.id])
subnets = module.get-subnets.subnets.ids
idle_timeout = var.idle_timeout
access_logs {
bucket = "log-${data.aws_region.current.name}-${data.aws_caller_identity.current.account_id}"
prefix = "lb"
enabled = true
}
tags = var.tags
ip_address_type = var.ip_address_type
enable_deletion_protection = var.enable_deletion_protection
enable_http2 = var.enable_http2
}
resource "aws_lb" "user" {
count = length(keys(var.access_logs)) != 0 ? 1 : 0
name = var.name
internal = var.internal
security_groups = concat(var.security_groups, [aws_security_group.default.id])
subnets = module.get-subnets.subnets.ids
idle_timeout = var.idle_timeout
dynamic "access_logs" {
for_each = [var.access_logs]
content {
bucket = lookup(access_logs.value, "bucket")
enabled = lookup(access_logs.value, "enabled", false)
prefix = lookup(access_logs.value, "prefix", null)
}
}
tags = var.tags
ip_address_type = var.ip_address_type
enable_deletion_protection = var.enable_deletion_protection
enable_http2 = var.enable_http2
}