googleComputeTargetPool
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
/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as google from "./.gen/providers/google";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: google.
For a more precise conversion please use the --provider flag in convert.*/
const googleComputeHttpHealthCheckDefault =
new google.computeHttpHealthCheck.ComputeHttpHealthCheck(this, "default", {
check_interval_sec: 1,
name: "default",
request_path: "/",
timeout_sec: 1,
});
const googleComputeTargetPoolDefault =
new google.computeTargetPool.ComputeTargetPool(this, "default_1", {
health_checks: [googleComputeHttpHealthCheckDefault.name],
instances: ["us-central1-a/myinstance1", "us-central1-b/myinstance2"],
name: "instance-pool",
});
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
googleComputeTargetPoolDefault.overrideLogicalId("default");
Argument Reference
The following arguments are supported:
name
- (Required) A unique name for the resource, required by GCE. Changing this forces a new resource to be created.
-
backupPool
- (Optional) URL to the backup target pool. Must also set failover_ratio. -
description
- (Optional) Textual description field. -
failoverRatio
- (Optional) Ratio (0 to 1) of failed nodes before using the backup pool (which must also be set). -
healthChecks
- (Optional) List of zero or one health check name or self_link. Only legacygoogleComputeHttpHealthCheck
is supported. -
instances
- (Optional) List of instances in the pool. They can be given as URLs, or in the form of "zone/name". Note that the instances need not exist at the time of target pool creation, so there is no need to use the Terraform interpolators to create a dependency on the instances from the target pool. -
project
- (Optional) The ID of the project in which the resource belongs. If it is not provided, the provider project is used. -
region
- (Optional) Where the target pool resides. Defaults to project region. -
sessionAffinity
- (Optional) How to distribute load. Options are "NONE" (no affinity). "CLIENT_IP" (hash of the source/dest addresses / ports), and "CLIENT_IP_PROTO" also includes the protocol (default "NONE").
Attributes Reference
In addition to the arguments listed above, the following computed attributes are exported:
-
id
- an identifier for the resource with formatprojects/{{project}}/regions/{{region}}/targetPools/{{name}}
-
selfLink
- The URI of the created resource.
Timeouts
This resource provides the following Timeouts configuration options: configuration options:
create
- Default is 4 minutes.update
- Default is 4 minutes.delete
- Default is 4 minutes.
Import
Target pools can be imported using any of the following formats:
$ 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}}