diff --git a/mmv1/products/compute/TargetTcpProxy.yaml b/mmv1/products/compute/TargetTcpProxy.yaml index 1634456bff42..ddfe48b87ccb 100644 --- a/mmv1/products/compute/TargetTcpProxy.yaml +++ b/mmv1/products/compute/TargetTcpProxy.yaml @@ -55,6 +55,11 @@ examples: backend_service_name: 'backend-service' health_check_name: 'health-check' - name: target_tcp_proxy_backendless + min_version: beta + primary_resource_id: default + vars: + target_tcp_proxy_name: test-proxy + - name: target_tcp_proxy_tls_route min_version: beta primary_resource_id: default vars: diff --git a/mmv1/products/networkservices/TlsRoute.yaml b/mmv1/products/networkservices/TlsRoute.yaml index 94d9c55b9200..0c3edca76ce9 100644 --- a/mmv1/products/networkservices/TlsRoute.yaml +++ b/mmv1/products/networkservices/TlsRoute.yaml @@ -71,6 +71,14 @@ examples: resource_name: 'my-tls-route' backend_service_name: 'my-backend-service' health_check_name: 'backend-service-health-check' + - name: 'network_services_tls_route_target_tcp_proxy_basic' + min_version: beta + primary_resource_id: 'default' + vars: + resource_name: 'my-tls-route' + target_tcp_proxy_name: 'my-target-tcp-proxy' + backend_service_name: 'my-backend-service' + health_check_name: 'my-health-check' - name: 'network_services_tls_route_region_target_tcp_proxy_basic' min_version: beta primary_resource_id: 'default' diff --git a/mmv1/templates/terraform/examples/network_services_tls_route_target_tcp_proxy_basic.tf.tmpl b/mmv1/templates/terraform/examples/network_services_tls_route_target_tcp_proxy_basic.tf.tmpl new file mode 100644 index 000000000000..3f6791bb1643 --- /dev/null +++ b/mmv1/templates/terraform/examples/network_services_tls_route_target_tcp_proxy_basic.tf.tmpl @@ -0,0 +1,42 @@ +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "backend_service_name"}}" + load_balancing_scheme = "INTERNAL_MANAGED" + protocol = "TCP" + health_checks = [google_compute_health_check.{{$.PrimaryResourceId}}.id] +} + +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "health_check_name"}}" + + https_health_check { + port = 443 + } +} + +resource "google_compute_target_tcp_proxy" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "target_tcp_proxy_name"}}" + load_balancing_scheme = "INTERNAL_MANAGED" +} + +resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "resource_name"}}" + + target_proxies = [ + google_compute_target_tcp_proxy.{{$.PrimaryResourceId}}.id + ] + + rules { + matches { + sni_host = ["example.com"] + } + action { + destinations { + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id + } + } + } +} diff --git a/mmv1/templates/terraform/examples/target_tcp_proxy_tls_route.tf.tmpl b/mmv1/templates/terraform/examples/target_tcp_proxy_tls_route.tf.tmpl new file mode 100644 index 000000000000..d09ece303d72 --- /dev/null +++ b/mmv1/templates/terraform/examples/target_tcp_proxy_tls_route.tf.tmpl @@ -0,0 +1,42 @@ +resource "google_compute_target_tcp_proxy" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "target_tcp_proxy_name"}}" + load_balancing_scheme = "INTERNAL_MANAGED" +} + +resource "google_compute_backend_service" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "backend_service_name"}}" + load_balancing_scheme = "INTERNAL_MANAGED" + protocol = "TCP" + health_checks = [google_compute_health_check.{{$.PrimaryResourceId}}.id] +} + +resource "google_compute_health_check" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "health_check_name"}}" + + https_health_check { + port = 443 + } +} + +resource "google_network_services_tls_route" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "tls_route_name"}}" + + target_proxies = [ + google_compute_target_tcp_proxy.{{$.PrimaryResourceId}}.id + ] + + rules { + matches { + sni_host = ["example.com"] + } + action { + destinations { + service_name = google_compute_backend_service.{{$.PrimaryResourceId}}.id + } + } + } +}