google_compute_target_tcp_proxy

Represents a TargetTcpProxy resource, which is used by one or more global forwarding rule to route incoming TCP requests to a Backend service.

To get more information about TargetTcpProxy, see:

Open in Cloud Shell

Example Usage - Target Tcp Proxy Basic

resource "google_compute_target_tcp_proxy" "default" {
  name            = "test-proxy"
  backend_service = google_compute_backend_service.default.id
}

resource "google_compute_backend_service" "default" {
  name        = "backend-service"
  protocol    = "TCP"
  timeout_sec = 10

  health_checks = [google_compute_health_check.default.id]
}

resource "google_compute_health_check" "default" {
  name               = "health-check"
  timeout_sec        = 1
  check_interval_sec = 1

  tcp_health_check {
    port = "443"
  }
}

Argument Reference

The following arguments are supported:


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

TargetTcpProxy can be imported using any of these accepted formats:

In Terraform v1.5.0 and later, use an import block to import TargetTcpProxy using one of the formats above. For example:

import {
  id = "projects/{{project}}/global/targetTcpProxies/{{name}}"
  to = google_compute_target_tcp_proxy.default
}

When using the terraform import command, TargetTcpProxy can be imported using one of the formats above. For example:

$ terraform import google_compute_target_tcp_proxy.default projects/{{project}}/global/targetTcpProxies/{{name}}
$ terraform import google_compute_target_tcp_proxy.default {{project}}/{{name}}
$ terraform import google_compute_target_tcp_proxy.default {{name}}

User Project Overrides

This resource supports User Project Overrides.