Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
specific host match redirect rules for ENX redirect domains (#1984)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehelmick authored Apr 6, 2021
1 parent 5843752 commit 32f02e3
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions terraform/redirect-lb.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ locals {
redirect_root_domains = distinct(compact([
var.enx_redirect_domain,
]))

enx_domains = [for o in concat(var.enx_redirect_domain_map, var.enx_redirect_domain_map_add) : o.host]
}

resource "google_compute_global_address" "verification-enx-redirect" {
Expand All @@ -36,7 +38,32 @@ resource "google_compute_url_map" "enx-redirect-urlmap-http" {
provider = google-beta
project = var.project

// path rule for each known redirect domain
dynamic "host_rule" {
for_each = local.enx_domains

content {
path_matcher = host_rule.value
hosts = toset([host_rule.value])
}
}

dynamic "path_matcher" {
for_each = local.enx_domains

content {
name = path_matcher.value
default_url_redirect {
host_redirect = path_matcher.value
https_redirect = true
strip_query = false
}
}
}

default_url_redirect {
host_redirect = "g.co"
path_redirect = "/ens"
strip_query = false
https_redirect = true
}
Expand Down

0 comments on commit 32f02e3

Please sign in to comment.