@@ -33,7 +33,7 @@ resource "google_compute_global_forwarding_rule" "http" {
3333 provider = google- beta
3434 project = var. project
3535 count = local. create_http_forward ? 1 : 0
36- name = var. name
36+ name = " ${ var . name_prefixes . http_forwarding_rule != null ? var . name_prefixes . http_forwarding_rule : var . name } ${ var . name_suffixes . http_forwarding_rule } "
3737 target = google_compute_target_http_proxy. default [0 ]. self_link
3838 ip_address = local. address
3939 port_range = var. http_port
@@ -46,7 +46,7 @@ resource "google_compute_global_forwarding_rule" "https" {
4646 provider = google- beta
4747 project = var. project
4848 count = var. ssl ? 1 : 0
49- name = " ${ var . name } -https "
49+ name = " ${ var . name_prefixes . https_forwarding_rule != null ? var . name_prefixes . https_forwarding_rule : var . name } ${ var . name_suffixes . https_forwarding_rule } "
5050 target = google_compute_target_https_proxy. default [0 ]. self_link
5151 ip_address = local. address
5252 port_range = var. https_port
@@ -59,7 +59,7 @@ resource "google_compute_global_address" "default" {
5959 provider = google- beta
6060 count = local. is_internal ? 0 : var. create_address ? 1 : 0
6161 project = var. project
62- name = " ${ var . name } - address"
62+ name = " ${ var . name_prefixes . address != null ? var . name_prefixes . address : var . name } ${ var . name_suffixes . address } "
6363 ip_version = " IPV4"
6464 labels = var. labels
6565}
@@ -70,7 +70,7 @@ resource "google_compute_global_forwarding_rule" "http_ipv6" {
7070 provider = google- beta
7171 project = var. project
7272 count = (var. enable_ipv6 && local. create_http_forward ) ? 1 : 0
73- name = " ${ var . name } -ipv6-http "
73+ name = " ${ var . name_prefixes . http_ipv6_forwarding_rule != null ? var . name_prefixes . http_ipv6_forwarding_rule : var . name } ${ var . name_suffixes . http_ipv6_forwarding_rule } "
7474 target = google_compute_target_http_proxy. default [0 ]. self_link
7575 ip_address = local. ipv6_address
7676 port_range = " 80"
@@ -83,7 +83,7 @@ resource "google_compute_global_forwarding_rule" "https_ipv6" {
8383 provider = google- beta
8484 project = var. project
8585 count = var. enable_ipv6 && var. ssl ? 1 : 0
86- name = " ${ var . name } -ipv6-https "
86+ name = " ${ var . name_prefixes . https_ipv6_forwarding_rule != null ? var . name_prefixes . https_ipv6_forwarding_rule : var . name } ${ var . name_suffixes . https_ipv6_forwarding_rule } "
8787 target = google_compute_target_https_proxy. default [0 ]. self_link
8888 ip_address = local. ipv6_address
8989 port_range = " 443"
@@ -96,7 +96,7 @@ resource "google_compute_global_address" "default_ipv6" {
9696 provider = google- beta
9797 count = local. is_internal ? 0 : (var. enable_ipv6 && var. create_ipv6_address ) ? 1 : 0
9898 project = var. project
99- name = " ${ var . name } -ipv6-address "
99+ name = " ${ var . name_prefixes . address_ipv6 != null ? var . name_prefixes . address_ipv6 : var . name } ${ var . name_suffixes . address_ipv6 } "
100100 ip_version = " IPV6"
101101 labels = var. labels
102102}
@@ -106,15 +106,15 @@ resource "google_compute_global_address" "default_ipv6" {
106106resource "google_compute_target_http_proxy" "default" {
107107 project = var. project
108108 count = local. create_http_forward ? 1 : 0
109- name = " ${ var . name } -http-proxy "
109+ name = " ${ var . name_prefixes . target_http_proxy != null ? var . name_prefixes . target_http_proxy : var . name } ${ var . name_suffixes . target_http_proxy } "
110110 url_map = var. https_redirect == false ? local. url_map : join (" " , google_compute_url_map. https_redirect [* ]. self_link )
111111}
112112
113113# HTTPS proxy when ssl is true
114114resource "google_compute_target_https_proxy" "default" {
115115 project = var. project
116116 count = var. ssl ? 1 : 0
117- name = " ${ var . name } -https-proxy "
117+ name = " ${ var . name_prefixes . target_https_proxy != null ? var . name_prefixes . target_https_proxy : var . name } ${ var . name_suffixes . target_https_proxy } "
118118 url_map = local. url_map
119119
120120 ssl_certificates = compact (concat (var. ssl_certificates , google_compute_ssl_certificate. default [* ]. self_link , google_compute_managed_ssl_certificate. default [* ]. self_link , ), )
@@ -151,7 +151,7 @@ resource "google_compute_managed_ssl_certificate" "default" {
151151 provider = google- beta
152152 project = var. project
153153 count = var. ssl && length (var. managed_ssl_certificate_domains ) > 0 ? 1 : 0
154- name = var. random_certificate_suffix == true ? random_id. certificate [0 ]. hex : " ${ var . name } -cert "
154+ name = var. random_certificate_suffix == true ? random_id. certificate [0 ]. hex : " ${ var . name_prefixes . certificate != null ? var . name_prefixes . certificate : var . name } ${ var . name_suffixes . certificate } "
155155
156156 lifecycle {
157157 create_before_destroy = true
@@ -166,14 +166,14 @@ resource "google_compute_url_map" "default" {
166166 provider = google- beta
167167 project = var. project
168168 count = var. create_url_map ? 1 : 0
169- name = " ${ var . name } -url-map "
169+ name = " ${ var . name_prefixes . url_map != null ? var . name_prefixes . url_map : var . name } ${ var . name_suffixes . url_map } "
170170 default_service = google_compute_backend_service. default [keys (var. backends )[0 ]]. self_link
171171}
172172
173173resource "google_compute_url_map" "https_redirect" {
174174 project = var. project
175175 count = var. https_redirect ? 1 : 0
176- name = " ${ var . name } -https-redirect "
176+ name = " ${ var . name_prefixes . url_map_https_redirect != null ? var . name_prefixes . url_map_https_redirect : var . name } ${ var . name_suffixes . url_map_https_redirect } "
177177 default_url_redirect {
178178 https_redirect = true
179179 redirect_response_code = " MOVED_PERMANENTLY_DEFAULT"
@@ -186,7 +186,7 @@ resource "google_compute_backend_service" "default" {
186186 for_each = var. backends
187187
188188 project = coalesce (each. value [" project" ], var. project )
189- name = " ${ var . name } -backend-${ each . key } "
189+ name = " ${ var . name_prefixes . backend_service != null ? var . name_prefixes . backend_service : " ${ var . name } -backend-" } ${ each . key } ${ var . name_suffixes . backend_service } "
190190
191191 load_balancing_scheme = var. load_balancing_scheme
192192
@@ -326,7 +326,7 @@ resource "google_compute_health_check" "default" {
326326 provider = google- beta
327327 for_each = local. health_checked_backends
328328 project = coalesce (each. value [" project" ], var. project )
329- name = " ${ var . name } -hc-${ each . key } "
329+ name = " ${ var . name_prefixes . health_check != null ? var . name_prefixes . health_check : " ${ var . name } -hc" } -${ each . key } ${ var . name_suffixes . health_check } "
330330
331331 check_interval_sec = lookup (each. value [" health_check" ], " check_interval_sec" , 5 )
332332 timeout_sec = lookup (each. value [" health_check" ], " timeout_sec" , 5 )
@@ -435,7 +435,7 @@ resource "google_compute_health_check" "default" {
435435resource "google_compute_firewall" "default-hc" {
436436 count = length (var. firewall_networks )
437437 project = length (var. firewall_networks ) == 1 && var. firewall_projects [0 ] == " default" ? var. project : var. firewall_projects [count . index ]
438- name = " ${ var . name } -hc-${ count . index } "
438+ name = " ${ var . name_prefixes . health_check != null ? var . name_prefixes . health_check : " ${ var . name } -hc" } ${ var . name_suffixes . health_check } -${ count . index } "
439439 network = var. firewall_networks [count . index ]
440440 source_ranges = [
441441 " 130.211.0.0/22" ,
0 commit comments