-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathalb-target-group-authenticated-oidc.tf
59 lines (51 loc) · 1.51 KB
/
alb-target-group-authenticated-oidc.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
resource "aws_lb_listener_rule" "green_auth_oidc" {
count = var.auth_oidc_enabled ? 1 : 0
listener_arn = var.alb_listener_https_arn
action {
type = "authenticate-oidc"
authenticate_oidc {
authorization_endpoint = var.auth_oidc_authorization_endpoint
client_id = var.auth_oidc_client_id
client_secret = var.auth_oidc_client_secret
issuer = var.auth_oidc_issuer
token_endpoint = var.auth_oidc_token_endpoint
user_info_endpoint = var.auth_oidc_user_info_endpoint
session_timeout = var.auth_oidc_session_timeout
}
}
action {
type = "forward"
target_group_arn = aws_lb_target_group.green.arn
}
dynamic "condition" {
for_each = length(var.auth_oidc_paths) > 0 ? [var.auth_oidc_paths] : []
content {
path_pattern {
values = toset(condition.value)
}
}
}
dynamic "condition" {
for_each = length(var.auth_oidc_hostnames) > 0 ? [var.auth_oidc_hostnames] : [var.hostnames]
content {
host_header {
values = toset(condition.value)
}
}
}
dynamic "condition" {
for_each = var.http_header
content {
http_header {
http_header_name = condition.value.name
values = condition.value.values
}
}
}
lifecycle {
ignore_changes = [
action[1].target_group_arn
]
}
priority = var.alb_priority != 0 ? var.alb_priority : null # this rule must come before the default rule
}