TlsRoute defines how traffic should be routed based on SNI and other matching L3 attributes.
To get more information about TlsRoute, see:
resource "google_compute_backend_service" "default" {
provider = google-beta
name = "my-backend-service"
health_checks = [google_compute_http_health_check.default.id]
}
resource "google_compute_http_health_check" "default" {
provider = google-beta
name = "backend-service-health-check"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
resource "google_network_services_tls_route" "default" {
provider = google-beta
name = "my-tls-route"
description = "my description"
rules {
matches {
sni_host = ["example.com"]
alpn = ["http/1.1"]
}
action {
destinations {
service_name = google_compute_backend_service.default.id
weight = 1
}
}
}
}
resource "google_compute_backend_service" "default" {
provider = google-beta
name = "my-backend-service"
health_checks = [google_compute_http_health_check.default.id]
}
resource "google_compute_http_health_check" "default" {
provider = google-beta
name = "backend-service-health-check"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
resource "google_network_services_mesh" "default" {
provider = google-beta
name = "my-tls-route"
labels = {
foo = "bar"
}
description = "my description"
}
resource "google_network_services_tls_route" "default" {
provider = google-beta
name = "my-tls-route"
description = "my description"
meshes = [
google_network_services_mesh.default.id
]
rules {
matches {
sni_host = ["example.com"]
alpn = ["http/1.1"]
}
action {
destinations {
service_name = google_compute_backend_service.default.id
weight = 1
}
}
}
}
resource "google_compute_backend_service" "default" {
provider = google-beta
name = "my-backend-service"
health_checks = [google_compute_http_health_check.default.id]
}
resource "google_compute_http_health_check" "default" {
provider = google-beta
name = "backend-service-health-check"
request_path = "/"
check_interval_sec = 1
timeout_sec = 1
}
resource "google_network_services_gateway" "default" {
provider = google-beta
name = "my-tls-route"
labels = {
foo = "bar"
}
description = "my description"
scope = "my-scope"
type = "OPEN_MESH"
ports = [443]
}
resource "google_network_services_tls_route" "default" {
provider = google-beta
name = "my-tls-route"
description = "my description"
gateways = [
google_network_services_gateway.default.id
]
rules {
matches {
sni_host = ["example.com"]
alpn = ["http/1.1"]
}
action {
destinations {
service_name = google_compute_backend_service.default.id
weight = 1
}
}
}
}
The following arguments are supported:
rules
-
(Required)
Rules that define how traffic is routed and handled.
Structure is documented below.
name
-
(Required)
Name of the TlsRoute resource.
matches
-
(Required)
Matches define the predicate used to match requests to a given action.
Structure is documented below.
action
-
(Required)
Required. A detailed rule defining how to route traffic.
Structure is documented below.
sni_host
-
(Optional)
SNI (server name indicator) to match against. SNI will be matched against all wildcard domains, i.e. www.example.com will be first matched against www.example.com, then *.example.com, then *.com.
Partial wildcards are not supported, and values like *w.example.com are invalid. At least one of sniHost and alpn is required. Up to 5 sni hosts across all matches can be set.
alpn
-
(Optional)
ALPN (Application-Layer Protocol Negotiation) to match against. Examples: "http/1.1", "h2". At least one of sniHost and alpn is required. Up to 5 alpns across all matches can be set.
destinations
-
(Optional)
The destination to which traffic should be forwarded.
Structure is documented below.The destinations
block supports:
service_name
-
(Optional)
The URL of a BackendService to route traffic to.
weight
-
(Optional)
Specifies the proportion of requests forwarded to the backend referenced by the serviceName field.
description
-
(Optional)
A free-text description of the resource. Max length 1024 characters.
meshes
-
(Optional)
Meshes defines a list of meshes this TlsRoute is attached to, as one of the routing rules to route the requests served by the mesh.
Each mesh reference should match the pattern: projects/*/locations/global/meshes/
gateways
-
(Optional)
Gateways defines a list of gateways this TlsRoute is attached to, as one of the routing rules to route the requests served by the gateway.
Each gateway reference should match the pattern: projects/*/locations/global/gateways/
project
- (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
In addition to the arguments listed above, the following computed attributes are exported:
id
- an identifier for the resource with format projects/{{project}}/locations/global/tlsRoutes/{{name}}
self_link
-
Server-defined URL of this resource.
create_time
-
Time the TlsRoute was created in UTC.
update_time
-
Time the TlsRoute was updated in UTC.
This resource provides the following Timeouts configuration options:
create
- Default is 30 minutes.update
- Default is 30 minutes.delete
- Default is 30 minutes.TlsRoute can be imported using any of these accepted formats:
projects/{{project}}/locations/global/tlsRoutes/{{name}}
{{project}}/{{name}}
{{name}}
In Terraform v1.5.0 and later, use an import
block to import TlsRoute using one of the formats above. For example:
import {
id = "projects/{{project}}/locations/global/tlsRoutes/{{name}}"
to = google_network_services_tls_route.default
}
When using the terraform import
command, TlsRoute can be imported using one of the formats above. For example:
$ terraform import google_network_services_tls_route.default projects/{{project}}/locations/global/tlsRoutes/{{name}}
$ terraform import google_network_services_tls_route.default {{project}}/{{name}}
$ terraform import google_network_services_tls_route.default {{name}}
This resource supports User Project Overrides.