blob: 072fcb5c327fc089eba7dab5c6925cf1166749e1 [file] [log] [blame]
---
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** Type: MMv1 ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in
# .github/CONTRIBUTING.md.
#
# ----------------------------------------------------------------------------
subcategory: "Network services"
description: |-
TlsRoute defines how traffic should be routed based on SNI and other matching L3 attributes.
---
# google\_network\_services\_tls\_route
TlsRoute defines how traffic should be routed based on SNI and other matching L3 attributes.
~> **Warning:** This resource is in beta, and should be used with the terraform-provider-google-beta provider.
See [Provider Versions](https://terraform.io/docs/providers/google/guides/provider_versions.html) for more details on beta resources.
To get more information about TlsRoute, see:
* [API documentation](https://cloud.google.com/traffic-director/docs/reference/network-services/rest/v1beta1/projects.locations.tlsRoutes)
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=network_services_tls_route_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Network Services Tls Route Basic
```hcl
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
}
}
}
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=network_services_tls_route_mesh_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Network Services Tls Route Mesh Basic
```hcl
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
}
}
}
}
```
<div class = "oics-button" style="float: right; margin: 0 0 -15px">
<a href="https://console.cloud.google.com/cloudshell/open?cloudshell_git_repo=https%3A%2F%2Fgithub.com%2Fterraform-google-modules%2Fdocs-examples.git&cloudshell_working_dir=network_services_tls_route_gateway_basic&cloudshell_image=gcr.io%2Fcloudshell-images%2Fcloudshell%3Alatest&open_in_editor=main.tf&cloudshell_print=.%2Fmotd&cloudshell_tutorial=.%2Ftutorial.md" target="_blank">
<img alt="Open in Cloud Shell" src="//gstatic.com/cloudssh/images/open-btn.svg" style="max-height: 44px; margin: 32px auto; max-width: 100%;">
</a>
</div>
## Example Usage - Network Services Tls Route Gateway Basic
```hcl
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
}
}
}
}
```
## Argument Reference
The following arguments are supported:
* `rules` -
(Required)
Rules that define how traffic is routed and handled.
Structure is [documented below](#nested_rules).
* `name` -
(Required)
Name of the TlsRoute resource.
<a name="nested_rules"></a>The `rules` block supports:
* `matches` -
(Required)
Matches define the predicate used to match requests to a given action.
Structure is [documented below](#nested_matches).
* `action` -
(Required)
Required. A detailed rule defining how to route traffic.
Structure is [documented below](#nested_action).
<a name="nested_matches"></a>The `matches` block supports:
* `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.
<a name="nested_action"></a>The `action` block supports:
* `destinations` -
(Optional)
The destination to which traffic should be forwarded.
Structure is [documented below](#nested_destinations).
<a name="nested_destinations"></a>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/<mesh_name>
The attached Mesh should be of a type SIDECAR
* `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/<gateway_name>
* `project` - (Optional) The ID of the project in which the resource belongs.
If it is not provided, the provider project is used.
## Attributes Reference
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.
## Timeouts
This resource provides the following
[Timeouts](https://developer.hashicorp.com/terraform/plugin/sdkv2/resources/retries-and-customizable-timeouts) configuration options:
- `create` - Default is 30 minutes.
- `update` - Default is 30 minutes.
- `delete` - Default is 30 minutes.
## Import
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](https://developer.hashicorp.com/terraform/language/import) to import TlsRoute using one of the formats above. For example:
```tf
import {
id = "projects/{{project}}/locations/global/tlsRoutes/{{name}}"
to = google_network_services_tls_route.default
}
```
When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}}
```
## User Project Overrides
This resource supports [User Project Overrides](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/provider_reference#user_project_override).