google_network_services_tls_route

TlsRoute defines how traffic should be routed based on SNI and other matching L3 attributes.

To get more information about TlsRoute, see:

Open in Cloud Shell

Example Usage - Network Services Tls Route Basic

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
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Network Services Tls Route Mesh Basic

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
      }
    }
  }
}
Open in Cloud Shell

Example Usage - Network Services Tls Route Gateway Basic

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:

The rules block supports:

The matches block supports:

The action block supports:

The destinations block supports:


Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported:

Timeouts

This resource provides the following Timeouts configuration options:

Import

TlsRoute can be imported using any of these accepted formats:

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}}

User Project Overrides

This resource supports User Project Overrides.