1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. compute
  5. TargetPool
Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi

gcp.compute.TargetPool

Explore with Pulumi AI

gcp logo
Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi

    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

    Coming soon!

    Coming soon!

    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()        
                .requestPath("/")
                .checkIntervalSec(1)
                .timeoutSec(1)
                .build());
    
            var defaultTargetPool = new TargetPool("defaultTargetPool", TargetPoolArgs.builder()        
                .instances(            
                    "us-central1-a/myinstance1",
                    "us-central1-b/myinstance2")
                .healthChecks(defaultHttpHealthCheck.name())
                .build());
    
        }
    }
    

    Coming soon!

    Coming soon!

    resources:
      defaultTargetPool:
        type: gcp:compute:TargetPool
        properties:
          instances:
            - us-central1-a/myinstance1
            - us-central1-b/myinstance2
          healthChecks:
            - ${defaultHttpHealthCheck.name}
      defaultHttpHealthCheck:
        type: gcp:compute:HttpHealthCheck
        properties:
          requestPath: /
          checkIntervalSec: 1
          timeoutSec: 1
    

    Create TargetPool Resource

    new TargetPool(name: string, args?: TargetPoolArgs, opts?: CustomResourceOptions);
    @overload
    def TargetPool(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   backup_pool: Optional[str] = None,
                   description: Optional[str] = None,
                   failover_ratio: Optional[float] = None,
                   health_checks: Optional[str] = None,
                   instances: Optional[Sequence[str]] = None,
                   name: Optional[str] = None,
                   project: Optional[str] = None,
                   region: Optional[str] = None,
                   security_policy: Optional[str] = None,
                   session_affinity: Optional[str] = None)
    @overload
    def TargetPool(resource_name: str,
                   args: Optional[TargetPoolArgs] = None,
                   opts: Optional[ResourceOptions] = None)
    func NewTargetPool(ctx *Context, name string, args *TargetPoolArgs, opts ...ResourceOption) (*TargetPool, error)
    public TargetPool(string name, TargetPoolArgs? args = null, CustomResourceOptions? opts = null)
    public TargetPool(String name, TargetPoolArgs args)
    public TargetPool(String name, TargetPoolArgs args, CustomResourceOptions options)
    
    type: gcp:compute:TargetPool
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args TargetPoolArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args TargetPoolArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args TargetPoolArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TargetPoolArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TargetPoolArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    TargetPool Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The TargetPool resource accepts the following input properties:

    BackupPool string

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

    Description string

    Textual description field.

    FailoverRatio double

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

    HealthChecks string

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

    Instances List<string>

    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.

    Name string

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


    Project string

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

    Region string

    Where the target pool resides. Defaults to project region.

    SecurityPolicy string

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

    SessionAffinity string

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

    BackupPool string

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

    Description string

    Textual description field.

    FailoverRatio float64

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

    HealthChecks string

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

    Instances []string

    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.

    Name string

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


    Project string

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

    Region string

    Where the target pool resides. Defaults to project region.

    SecurityPolicy string

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

    SessionAffinity string

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

    backupPool String

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

    description String

    Textual description field.

    failoverRatio Double

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

    healthChecks String

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

    instances List<String>

    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.

    name String

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


    project String

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

    region String

    Where the target pool resides. Defaults to project region.

    securityPolicy String

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

    sessionAffinity String

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

    backupPool string

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

    description string

    Textual description field.

    failoverRatio number

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

    healthChecks string

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

    instances string[]

    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.

    name string

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


    project string

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

    region string

    Where the target pool resides. Defaults to project region.

    securityPolicy string

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

    sessionAffinity string

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

    backup_pool str

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

    description str

    Textual description field.

    failover_ratio float

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

    health_checks str

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

    instances Sequence[str]

    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.

    name str

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


    project str

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

    region str

    Where the target pool resides. Defaults to project region.

    security_policy str

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

    session_affinity str

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

    backupPool String

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

    description String

    Textual description field.

    failoverRatio Number

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

    healthChecks String

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

    instances List<String>

    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.

    name String

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


    project String

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

    region String

    Where the target pool resides. Defaults to project region.

    securityPolicy String

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

    sessionAffinity String

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

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TargetPool resource produces the following output properties:

    Id string

    The provider-assigned unique ID for this managed resource.

    SelfLink string

    The URI of the created resource.

    Id string

    The provider-assigned unique ID for this managed resource.

    SelfLink string

    The URI of the created resource.

    id String

    The provider-assigned unique ID for this managed resource.

    selfLink String

    The URI of the created resource.

    id string

    The provider-assigned unique ID for this managed resource.

    selfLink string

    The URI of the created resource.

    id str

    The provider-assigned unique ID for this managed resource.

    self_link str

    The URI of the created resource.

    id String

    The provider-assigned unique ID for this managed resource.

    selfLink String

    The URI of the created resource.

    Look up Existing TargetPool Resource

    Get an existing TargetPool resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: TargetPoolState, opts?: CustomResourceOptions): TargetPool
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            backup_pool: Optional[str] = None,
            description: Optional[str] = None,
            failover_ratio: Optional[float] = None,
            health_checks: Optional[str] = None,
            instances: Optional[Sequence[str]] = None,
            name: Optional[str] = None,
            project: Optional[str] = None,
            region: Optional[str] = None,
            security_policy: Optional[str] = None,
            self_link: Optional[str] = None,
            session_affinity: Optional[str] = None) -> TargetPool
    func GetTargetPool(ctx *Context, name string, id IDInput, state *TargetPoolState, opts ...ResourceOption) (*TargetPool, error)
    public static TargetPool Get(string name, Input<string> id, TargetPoolState? state, CustomResourceOptions? opts = null)
    public static TargetPool get(String name, Output<String> id, TargetPoolState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    BackupPool string

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

    Description string

    Textual description field.

    FailoverRatio double

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

    HealthChecks string

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

    Instances List<string>

    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.

    Name string

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


    Project string

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

    Region string

    Where the target pool resides. Defaults to project region.

    SecurityPolicy string

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

    SelfLink string

    The URI of the created resource.

    SessionAffinity string

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

    BackupPool string

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

    Description string

    Textual description field.

    FailoverRatio float64

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

    HealthChecks string

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

    Instances []string

    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.

    Name string

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


    Project string

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

    Region string

    Where the target pool resides. Defaults to project region.

    SecurityPolicy string

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

    SelfLink string

    The URI of the created resource.

    SessionAffinity string

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

    backupPool String

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

    description String

    Textual description field.

    failoverRatio Double

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

    healthChecks String

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

    instances List<String>

    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.

    name String

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


    project String

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

    region String

    Where the target pool resides. Defaults to project region.

    securityPolicy String

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

    selfLink String

    The URI of the created resource.

    sessionAffinity String

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

    backupPool string

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

    description string

    Textual description field.

    failoverRatio number

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

    healthChecks string

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

    instances string[]

    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.

    name string

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


    project string

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

    region string

    Where the target pool resides. Defaults to project region.

    securityPolicy string

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

    selfLink string

    The URI of the created resource.

    sessionAffinity string

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

    backup_pool str

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

    description str

    Textual description field.

    failover_ratio float

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

    health_checks str

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

    instances Sequence[str]

    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.

    name str

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


    project str

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

    region str

    Where the target pool resides. Defaults to project region.

    security_policy str

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

    self_link str

    The URI of the created resource.

    session_affinity str

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

    backupPool String

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

    description String

    Textual description field.

    failoverRatio Number

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

    healthChecks String

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

    instances List<String>

    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.

    name String

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


    project String

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

    region String

    Where the target pool resides. Defaults to project region.

    securityPolicy String

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

    selfLink String

    The URI of the created resource.

    sessionAffinity String

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

    Import

    Target pools can be imported using any of the following formats* projects/{{project}}/regions/{{region}}/targetPools/{{name}} * {{project}}/{{region}}/{{name}} * {{region}}/{{name}} * {{name}} In Terraform v1.5.0 and later, use an import block to import target pools using one of the formats above. For exampletf import {

    id = “projects/{{project}}/regions/{{region}}/targetPools/{{name}}”

    to = google_compute_target_pool.default }

     $ pulumi import gcp:compute/targetPool:TargetPool When using the [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import), 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}}
    

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes

    This Pulumi package is based on the google-beta Terraform Provider.

    gcp logo
    Google Cloud Classic v7.2.1 published on Wednesday, Nov 22, 2023 by Pulumi