TargetPoolArgs

data class TargetPoolArgs(val backupPool: Output<String>? = null, val description: Output<String>? = null, val failoverRatio: Output<Double>? = null, val healthChecks: Output<String>? = null, val instances: Output<List<String>>? = null, val name: Output<String>? = null, val project: Output<String>? = null, val region: Output<String>? = null, val securityPolicy: Output<String>? = null, val sessionAffinity: Output<String>? = null) : ConvertibleToJava<TargetPoolArgs>

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](https://cloud.google.com/compute/docs/load-balancing/network/target-pools) and API.

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const defaultHttpHealthCheck = new gcp.compute.HttpHealthCheck("default", {
name: "default",
requestPath: "/",
checkIntervalSec: 1,
timeoutSec: 1,
});
const _default = new gcp.compute.TargetPool("default", {
name: "instance-pool",
instances: [
"us-central1-a/myinstance1",
"us-central1-b/myinstance2",
],
healthChecks: defaultHttpHealthCheck.name,
});
import pulumi
import pulumi_gcp as gcp
default_http_health_check = gcp.compute.HttpHealthCheck("default",
name="default",
request_path="/",
check_interval_sec=1,
timeout_sec=1)
default = gcp.compute.TargetPool("default",
name="instance-pool",
instances=[
"us-central1-a/myinstance1",
"us-central1-b/myinstance2",
],
health_checks=default_http_health_check.name)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var defaultHttpHealthCheck = new Gcp.Compute.HttpHealthCheck("default", new()
{
Name = "default",
RequestPath = "/",
CheckIntervalSec = 1,
TimeoutSec = 1,
});
var @default = new Gcp.Compute.TargetPool("default", new()
{
Name = "instance-pool",
Instances = new[]
{
"us-central1-a/myinstance1",
"us-central1-b/myinstance2",
},
HealthChecks = defaultHttpHealthCheck.Name,
});
});
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v7/go/gcp/compute"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
defaultHttpHealthCheck, err := compute.NewHttpHealthCheck(ctx, "default", &compute.HttpHealthCheckArgs{
Name: pulumi.String("default"),
RequestPath: pulumi.String("/"),
CheckIntervalSec: pulumi.Int(1),
TimeoutSec: pulumi.Int(1),
})
if err != nil {
return err
}
_, err = compute.NewTargetPool(ctx, "default", &compute.TargetPoolArgs{
Name: pulumi.String("instance-pool"),
Instances: pulumi.StringArray{
pulumi.String("us-central1-a/myinstance1"),
pulumi.String("us-central1-b/myinstance2"),
},
HealthChecks: defaultHttpHealthCheck.Name,
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.compute.HttpHealthCheck;
import com.pulumi.gcp.compute.HttpHealthCheckArgs;
import com.pulumi.gcp.compute.TargetPool;
import com.pulumi.gcp.compute.TargetPoolArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var defaultHttpHealthCheck = new HttpHealthCheck("defaultHttpHealthCheck", HttpHealthCheckArgs.builder()
.name("default")
.requestPath("/")
.checkIntervalSec(1)
.timeoutSec(1)
.build());
var default_ = new TargetPool("default", TargetPoolArgs.builder()
.name("instance-pool")
.instances(
"us-central1-a/myinstance1",
"us-central1-b/myinstance2")
.healthChecks(defaultHttpHealthCheck.name())
.build());
}
}
resources:
default:
type: gcp:compute:TargetPool
properties:
name: instance-pool
instances:
- us-central1-a/myinstance1
- us-central1-b/myinstance2
healthChecks: ${defaultHttpHealthCheck.name}
defaultHttpHealthCheck:
type: gcp:compute:HttpHealthCheck
name: default
properties:
name: default
requestPath: /
checkIntervalSec: 1
timeoutSec: 1

Import

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

  • projects/{{project}}/regions/{{region}}/targetPools/{{name}}

  • {{project}}/{{region}}/{{name}}

  • {{region}}/{{name}}

  • {{name}} When using the pulumi import command, target pools can be imported using one of the formats above. For example:

$ pulumi import gcp:compute/targetPool:TargetPool default projects/{{project}}/regions/{{region}}/targetPools/{{name}}
$ pulumi import gcp:compute/targetPool:TargetPool default {{project}}/{{region}}/{{name}}
$ pulumi import gcp:compute/targetPool:TargetPool default {{region}}/{{name}}
$ pulumi import gcp:compute/targetPool:TargetPool default {{name}}

Constructors

Link copied to clipboard
constructor(backupPool: Output<String>? = null, description: Output<String>? = null, failoverRatio: Output<Double>? = null, healthChecks: Output<String>? = null, instances: Output<List<String>>? = null, name: Output<String>? = null, project: Output<String>? = null, region: Output<String>? = null, securityPolicy: Output<String>? = null, sessionAffinity: Output<String>? = null)

Properties

Link copied to clipboard
val backupPool: Output<String>? = null

URL to the backup target pool. Must also set failover_ratio.

Link copied to clipboard
val description: Output<String>? = null

Textual description field.

Link copied to clipboard
val failoverRatio: Output<Double>? = null

Ratio (0 to 1) of failed nodes before using the backup pool (which must also be set).

Link copied to clipboard
val healthChecks: Output<String>? = null

List of zero or one health check name or self_link. Only legacy gcp.compute.HttpHealthCheck is supported.

Link copied to clipboard
val instances: Output<List<String>>? = null

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 interpolation to create a dependency on the instances from the target pool.

Link copied to clipboard
val name: Output<String>? = null

A unique name for the resource, required by GCE. Changing this forces a new resource to be created.

Link copied to clipboard
val project: Output<String>? = null

The ID of the project in which the resource belongs. If it is not provided, the provider project is used.

Link copied to clipboard
val region: Output<String>? = null

Where the target pool resides. Defaults to project region.

Link copied to clipboard
val securityPolicy: Output<String>? = null

The resource URL for the security policy associated with this target pool.

Link copied to clipboard
val sessionAffinity: Output<String>? = null

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").

Functions

Link copied to clipboard
open override fun toJava(): TargetPoolArgs