Skip to content

Commit f685cd6

Browse files
committed
Fixing errors on module
1 parent 1f3a12b commit f685cd6

File tree

3 files changed

+40
-40
lines changed

3 files changed

+40
-40
lines changed

main.tf

+20-11
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ provider "aws" {
66
region = var.region
77
}
88

9+
# ---------------------------------------------------------------------------------------------------------------------
10+
# S3 BUCKET - For access logs
11+
# ---------------------------------------------------------------------------------------------------------------------
12+
# resource "aws_s3_bucket" "logs" {
13+
# bucket = "${var.name_preffix}-lb-logs"
14+
# region = var.region
15+
# tags = {
16+
# Name = "${var.name_preffix}-lb-logs"
17+
# }
18+
# }
19+
920
# ---------------------------------------------------------------------------------------------------------------------
1021
# APPLICATION LOAD BALANCER
1122
# ---------------------------------------------------------------------------------------------------------------------
@@ -20,17 +31,15 @@ resource "aws_lb" "lb" {
2031
enable_cross_zone_load_balancing = var.enable_cross_zone_load_balancing
2132
enable_http2 = var.enable_http2
2233
ip_address_type = var.ip_address_type
23-
security_groups = compact(
34+
security_groups = compact(
2435
concat(var.security_groups, [aws_security_group.lb_access_sg.id]),
2536
)
26-
dynamic "access_logs" {
27-
for_each = var.access_logs == null ? [] : [var.access_logs]
28-
content {
29-
bucket = access_logs.value.bucket
30-
prefix = access_logs.value.prefix
31-
enabled = access_logs.value.enabled
32-
}
33-
}
37+
# TODO - Enable this feature
38+
# access_logs {
39+
# bucket = aws_s3_bucket.logs.id
40+
# prefix = ""
41+
# enabled = true
42+
# }
3443
tags = {
3544
Name = "${var.name_preffix}-lb"
3645
}
@@ -91,8 +100,8 @@ resource "aws_lb_target_group" "lb_http_tgs" {
91100
dynamic "stickiness" {
92101
for_each = var.stickiness == null ? [] : [var.stickiness]
93102
content {
94-
type = stickiness.value.bucket
95-
cookie_duration = stickiness.value.prefix
103+
type = stickiness.value.type
104+
cookie_duration = stickiness.value.cookie_duration
96105
enabled = stickiness.value.enabled
97106
}
98107
}

outputs.tf

+19-19
Original file line numberDiff line numberDiff line change
@@ -31,96 +31,96 @@ output "aws_lb_lb_zone_id" {
3131
# ---------------------------------------------------------------------------------------------------------------------
3232
output "aws_security_group_lb_access_sg_id" {
3333
description = "The ID of the security group"
34-
value = aws_security_group.lb_access_sg.id
34+
value = aws_security_group.lb_access_sg.id
3535
}
3636

3737
output "aws_security_group_lb_access_sg_arn" {
3838
description = "The ARN of the security group"
39-
value = aws_security_group.lb_access_sg.arn
39+
value = aws_security_group.lb_access_sg.arn
4040
}
4141

4242
output "aws_security_group_lb_access_sg_vpc_id" {
4343
description = "The VPC ID."
44-
value = aws_security_group.lb_access_sg.vpc_id
44+
value = aws_security_group.lb_access_sg.vpc_id
4545
}
4646

4747
output "aws_security_group_lb_access_sg_owner_id" {
4848
description = "The owner ID."
49-
value = aws_security_group.lb_access_sg.owner_id
49+
value = aws_security_group.lb_access_sg.owner_id
5050
}
5151

5252
output "aws_security_group_lb_access_sg_name" {
5353
description = "The name of the security group"
54-
value = aws_security_group.lb_access_sg.name
54+
value = aws_security_group.lb_access_sg.name
5555
}
5656

5757
output "aws_security_group_lb_access_sg_description" {
5858
description = "The description of the security group"
59-
value = aws_security_group.lb_access_sg.description
59+
value = aws_security_group.lb_access_sg.description
6060
}
6161

6262
output "aws_security_group_lb_access_sg_ingress" {
6363
description = "The ingress rules."
64-
value = aws_security_group.lb_access_sg.ingress
64+
value = aws_security_group.lb_access_sg.ingress
6565
}
6666

6767
output "aws_security_group_lb_access_sg_egress" {
6868
description = "The egress rules."
69-
value = aws_security_group.lb_access_sg.egress
69+
value = aws_security_group.lb_access_sg.egress
7070
}
7171

7272
# ---------------------------------------------------------------------------------------------------------------------
7373
# AWS LOAD BALANCER - Target Groups
7474
# ---------------------------------------------------------------------------------------------------------------------
7575
output "lb_http_tgs_ids" {
7676
description = "List of HTTP Target Groups IDs"
77-
value = ["${aws_lb_target_group.lb_http_tgs.*.id}"]
77+
value = ["${aws_lb_target_group.lb_http_tgs.*.id}"]
7878
}
7979

8080
output "lb_http_tgs_arns" {
8181
description = "List of HTTP Target Groups ARNs"
82-
value = ["${aws_lb_target_group.lb_http_tgs.*.arn}"]
82+
value = ["${aws_lb_target_group.lb_http_tgs.*.arn}"]
8383
}
8484

8585
output "lb_http_tgs_names" {
8686
description = "List of HTTP Target Groups Names"
87-
value = ["${aws_lb_target_group.lb_http_tgs.*.name}"]
87+
value = ["${aws_lb_target_group.lb_http_tgs.*.name}"]
8888
}
8989

9090
output "lb_https_tgs_ids" {
9191
description = "List of HTTPS Target Groups IDs"
92-
value = ["${aws_lb_target_group.lb_https_tgs.*.id}"]
92+
value = ["${aws_lb_target_group.lb_https_tgs.*.id}"]
9393
}
9494

9595
output "lb_https_tgs_arns" {
9696
description = "List of HTTPS Target Groups ARNs"
97-
value = ["${aws_lb_target_group.lb_https_tgs.*.arn}"]
97+
value = ["${aws_lb_target_group.lb_https_tgs.*.arn}"]
9898
}
9999

100100
output "lb_https_tgs_names" {
101101
description = "List of HTTPS Target Groups Names"
102-
value = ["${aws_lb_target_group.lb_https_tgs.*.name}"]
102+
value = ["${aws_lb_target_group.lb_https_tgs.*.name}"]
103103
}
104104

105105
# ---------------------------------------------------------------------------------------------------------------------
106106
# AWS LOAD BALANCER - Listeners
107107
# ---------------------------------------------------------------------------------------------------------------------
108108
output "lb_http_listeners_ids" {
109109
description = "List of HTTP Listeners IDs"
110-
value = ["${aws_lb_listener.lb_http_listeners.*.id}"]
110+
value = ["${aws_lb_listener.lb_http_listeners.*.id}"]
111111
}
112112

113113
output "lb_http_listeners_arns" {
114114
description = "List of HTTP Listeners ARNs"
115-
value = ["${aws_lb_listener.lb_http_listeners.*.arn}"]
115+
value = ["${aws_lb_listener.lb_http_listeners.*.arn}"]
116116
}
117117

118118
output "lb_https_listeners_ids" {
119119
description = "List of HTTPS Listeners IDs"
120-
value = ["${aws_lb_listener.lb_https_listeners.*.id}"]
120+
value = ["${aws_lb_listener.lb_https_listeners.*.id}"]
121121
}
122122

123123
output "lb_https_listeners_arns" {
124124
description = "List of HTTPS Listeners ARNs"
125-
value = ["${aws_lb_listener.lb_https_listeners.*.arn}"]
126-
}
125+
value = ["${aws_lb_listener.lb_https_listeners.*.arn}"]
126+
}

variables.tf

+1-10
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,6 @@ variable "drop_invalid_header_fields" {
4444
default = false
4545
}
4646

47-
variable "access_logs" {
48-
description = "(Optional) An Access Logs block. Provide three fields. bucket, the S3 bucket name to store the logs in. prefix, the S3 bucket prefix. enabled, boolean to enable / disable access_logs."
49-
type = object({
50-
bucket = string
51-
prefix = string
52-
enabled = bool
53-
})
54-
default = null
55-
}
56-
5747
variable "private_subnets" {
5848
description = "A list of private subnet IDs to attach to the LB if it is INTERNAL."
5949
type = list(string)
@@ -196,6 +186,7 @@ variable "target_group_health_check_interval" {
196186
variable "target_group_health_check_path" {
197187
description = "The destination for the health check request."
198188
type = string
189+
default = "/"
199190
}
200191

201192
variable "target_group_health_check_timeout" {

0 commit comments

Comments
 (0)