google_compute_target_pool

Manages a Target Pool within GCE. This is a collection of instances used as target of a network load balancer (Forwarding Rule). For more information see the official documentation and API.

Example Usage

resource "google_compute_target_pool" "default" {
  name = "instance-pool"

  instances = [
    "us-central1-a/myinstance1",
    "us-central1-b/myinstance2",
  ]

  health_checks = [
    google_compute_http_health_check.default.name,
  ]
}

resource "google_compute_http_health_check" "default" {
  name               = "default"
  request_path       = "/"
  check_interval_sec = 1
  timeout_sec        = 1
}

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: configuration options:

Import

Target pools can be imported using any of the following formats:

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

import {
  id = "projects/{{project}}/regions/{{region}}/targetPools/{{name}}"
  to = google_compute_target_pool.default
}

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

$ terraform import google_compute_target_pool.default projects/{{project}}/regions/{{region}}/targetPools/{{name}}
$ terraform import google_compute_target_pool.default {{project}}/{{region}}/{{name}}
$ terraform import google_compute_target_pool.default {{region}}/{{name}}
$ terraform import google_compute_target_pool.default {{name}}