Target Pool Args
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 thepulumi 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
Properties
URL to the backup target pool. Must also set failover_ratio.
Textual description field.
Ratio (0 to 1) of failed nodes before using the backup pool (which must also be set).
List of zero or one health check name or self_link. Only legacy gcp.compute.HttpHealthCheck
is supported.
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.
The resource URL for the security policy associated with this target pool.
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").