1. Packages
  2. Ionoscloud Provider
  3. API Docs
  4. getTargetGroup
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

ionoscloud.getTargetGroup

Explore with Pulumi AI

ionoscloud logo
ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud

    The Target Group data source can be used to search for and return an existing Application Load Balancer Target Group. You can provide a string for the name parameter which will be compared with provisioned Application Load Balancer Target Groups. If a single match is found, it will be returned. If your search results in multiple matches, an error will be returned. When this happens, please refine your search and make sure that your resources have unique names.

    Example Usage

    By Id

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getTargetGroup({
        id: "target_group_id",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_target_group(id="target_group_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupTargetGroup(ctx, &ionoscloud.LookupTargetGroupArgs{
    			Id: pulumi.StringRef("target_group_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetTargetGroup.Invoke(new()
        {
            Id = "target_group_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetTargetGroupArgs;
    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) {
            final var example = IonoscloudFunctions.getTargetGroup(GetTargetGroupArgs.builder()
                .id("target_group_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getTargetGroup
          arguments:
            id: target_group_id
    

    By Name

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getTargetGroup({
        name: "Target Group Example",
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_target_group(name="Target Group Example")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupTargetGroup(ctx, &ionoscloud.LookupTargetGroupArgs{
    			Name: pulumi.StringRef("Target Group Example"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetTargetGroup.Invoke(new()
        {
            Name = "Target Group Example",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetTargetGroupArgs;
    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) {
            final var example = IonoscloudFunctions.getTargetGroup(GetTargetGroupArgs.builder()
                .name("Target Group Example")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getTargetGroup
          arguments:
            name: Target Group Example
    

    By Name with Partial Match

    import * as pulumi from "@pulumi/pulumi";
    import * as ionoscloud from "@pulumi/ionoscloud";
    
    const example = ionoscloud.getTargetGroup({
        name: "Example",
        partialMatch: true,
    });
    
    import pulumi
    import pulumi_ionoscloud as ionoscloud
    
    example = ionoscloud.get_target_group(name="Example",
        partial_match=True)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/ionoscloud/v6/ionoscloud"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := ionoscloud.LookupTargetGroup(ctx, &ionoscloud.LookupTargetGroupArgs{
    			Name:         pulumi.StringRef("Example"),
    			PartialMatch: pulumi.BoolRef(true),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Ionoscloud = Pulumi.Ionoscloud;
    
    return await Deployment.RunAsync(() => 
    {
        var example = Ionoscloud.GetTargetGroup.Invoke(new()
        {
            Name = "Example",
            PartialMatch = true,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.ionoscloud.IonoscloudFunctions;
    import com.pulumi.ionoscloud.inputs.GetTargetGroupArgs;
    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) {
            final var example = IonoscloudFunctions.getTargetGroup(GetTargetGroupArgs.builder()
                .name("Example")
                .partialMatch(true)
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          function: ionoscloud:getTargetGroup
          arguments:
            name: Example
            partialMatch: true
    

    Using getTargetGroup

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getTargetGroup(args: GetTargetGroupArgs, opts?: InvokeOptions): Promise<GetTargetGroupResult>
    function getTargetGroupOutput(args: GetTargetGroupOutputArgs, opts?: InvokeOptions): Output<GetTargetGroupResult>
    def get_target_group(id: Optional[str] = None,
                         name: Optional[str] = None,
                         partial_match: Optional[bool] = None,
                         timeouts: Optional[GetTargetGroupTimeouts] = None,
                         opts: Optional[InvokeOptions] = None) -> GetTargetGroupResult
    def get_target_group_output(id: Optional[pulumi.Input[str]] = None,
                         name: Optional[pulumi.Input[str]] = None,
                         partial_match: Optional[pulumi.Input[bool]] = None,
                         timeouts: Optional[pulumi.Input[GetTargetGroupTimeoutsArgs]] = None,
                         opts: Optional[InvokeOptions] = None) -> Output[GetTargetGroupResult]
    func LookupTargetGroup(ctx *Context, args *LookupTargetGroupArgs, opts ...InvokeOption) (*LookupTargetGroupResult, error)
    func LookupTargetGroupOutput(ctx *Context, args *LookupTargetGroupOutputArgs, opts ...InvokeOption) LookupTargetGroupResultOutput

    > Note: This function is named LookupTargetGroup in the Go SDK.

    public static class GetTargetGroup 
    {
        public static Task<GetTargetGroupResult> InvokeAsync(GetTargetGroupArgs args, InvokeOptions? opts = null)
        public static Output<GetTargetGroupResult> Invoke(GetTargetGroupInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetTargetGroupResult> getTargetGroup(GetTargetGroupArgs args, InvokeOptions options)
    public static Output<GetTargetGroupResult> getTargetGroup(GetTargetGroupArgs args, InvokeOptions options)
    
    fn::invoke:
      function: ionoscloud:index/getTargetGroup:getTargetGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    ID of the target group you want to search for.
    Name string
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    PartialMatch bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    Timeouts GetTargetGroupTimeouts
    Id string
    ID of the target group you want to search for.
    Name string
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    PartialMatch bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    Timeouts GetTargetGroupTimeouts
    id String
    ID of the target group you want to search for.
    name String
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch Boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    timeouts GetTargetGroupTimeouts
    id string
    ID of the target group you want to search for.
    name string
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    timeouts GetTargetGroupTimeouts
    id str
    ID of the target group you want to search for.
    name str
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partial_match bool

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    timeouts GetTargetGroupTimeouts
    id String
    ID of the target group you want to search for.
    name String
    Name of an existing target group that you want to search for. Search by name is case-insensitive. The whole resource name is required if partial_match parameter is not set to true.
    partialMatch Boolean

    Whether partial matching is allowed or not when using name argument. Default value is false.

    Either name or id must be provided. If none, or both of name and id are provided, the datasource will return an error.

    timeouts Property Map

    getTargetGroup Result

    The following output properties are available:

    Algorithm string
    Balancing algorithm.
    HealthChecks List<GetTargetGroupHealthCheck>
    Health check attributes for Target Group.
    HttpHealthChecks List<GetTargetGroupHttpHealthCheck>
    Http health check attributes for Target Group
    Id string
    The Id of that Target group
    Name string
    The name of that Target Group.
    Protocol string
    Balancing protocol.
    ProtocolVersion string
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    Targets List<GetTargetGroupTarget>
    Array of items in the collection
    PartialMatch bool
    Timeouts GetTargetGroupTimeouts
    Algorithm string
    Balancing algorithm.
    HealthChecks []GetTargetGroupHealthCheck
    Health check attributes for Target Group.
    HttpHealthChecks []GetTargetGroupHttpHealthCheck
    Http health check attributes for Target Group
    Id string
    The Id of that Target group
    Name string
    The name of that Target Group.
    Protocol string
    Balancing protocol.
    ProtocolVersion string
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    Targets []GetTargetGroupTarget
    Array of items in the collection
    PartialMatch bool
    Timeouts GetTargetGroupTimeouts
    algorithm String
    Balancing algorithm.
    healthChecks List<GetTargetGroupHealthCheck>
    Health check attributes for Target Group.
    httpHealthChecks List<GetTargetGroupHttpHealthCheck>
    Http health check attributes for Target Group
    id String
    The Id of that Target group
    name String
    The name of that Target Group.
    protocol String
    Balancing protocol.
    protocolVersion String
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    targets List<GetTargetGroupTarget>
    Array of items in the collection
    partialMatch Boolean
    timeouts GetTargetGroupTimeouts
    algorithm string
    Balancing algorithm.
    healthChecks GetTargetGroupHealthCheck[]
    Health check attributes for Target Group.
    httpHealthChecks GetTargetGroupHttpHealthCheck[]
    Http health check attributes for Target Group
    id string
    The Id of that Target group
    name string
    The name of that Target Group.
    protocol string
    Balancing protocol.
    protocolVersion string
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    targets GetTargetGroupTarget[]
    Array of items in the collection
    partialMatch boolean
    timeouts GetTargetGroupTimeouts
    algorithm str
    Balancing algorithm.
    health_checks Sequence[GetTargetGroupHealthCheck]
    Health check attributes for Target Group.
    http_health_checks Sequence[GetTargetGroupHttpHealthCheck]
    Http health check attributes for Target Group
    id str
    The Id of that Target group
    name str
    The name of that Target Group.
    protocol str
    Balancing protocol.
    protocol_version str
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    targets Sequence[GetTargetGroupTarget]
    Array of items in the collection
    partial_match bool
    timeouts GetTargetGroupTimeouts
    algorithm String
    Balancing algorithm.
    healthChecks List<Property Map>
    Health check attributes for Target Group.
    httpHealthChecks List<Property Map>
    Http health check attributes for Target Group
    id String
    The Id of that Target group
    name String
    The name of that Target Group.
    protocol String
    Balancing protocol.
    protocolVersion String
    The forwarding protocol version. Value is ignored when protocol is not 'HTTP'.
    targets List<Property Map>
    Array of items in the collection
    partialMatch Boolean
    timeouts Property Map

    Supporting Types

    GetTargetGroupHealthCheck

    CheckInterval double
    The interval in milliseconds between consecutive health checks; default is 2000.
    CheckTimeout double
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    Retries double
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.
    CheckInterval float64
    The interval in milliseconds between consecutive health checks; default is 2000.
    CheckTimeout float64
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    Retries float64
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.
    checkInterval Double
    The interval in milliseconds between consecutive health checks; default is 2000.
    checkTimeout Double
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    retries Double
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.
    checkInterval number
    The interval in milliseconds between consecutive health checks; default is 2000.
    checkTimeout number
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    retries number
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.
    check_interval float
    The interval in milliseconds between consecutive health checks; default is 2000.
    check_timeout float
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    retries float
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.
    checkInterval Number
    The interval in milliseconds between consecutive health checks; default is 2000.
    checkTimeout Number
    The maximum time in milliseconds to wait for a target to respond to a check. For target VMs with 'Check Interval' set, the lesser of the two values is used once the TCP connection is established.
    retries Number
    The maximum number of attempts to reconnect to a target after a connection failure. Valid range is 0 to 65535, and default is three reconnection.

    GetTargetGroupHttpHealthCheck

    MatchType string
    Method string
    The method for the HTTP health check.
    Negate bool
    Path string
    The path (destination URL) for the HTTP health check request; the default is /.
    Regex bool
    Response string
    The response returned by the request, depending on the match type.
    MatchType string
    Method string
    The method for the HTTP health check.
    Negate bool
    Path string
    The path (destination URL) for the HTTP health check request; the default is /.
    Regex bool
    Response string
    The response returned by the request, depending on the match type.
    matchType String
    method String
    The method for the HTTP health check.
    negate Boolean
    path String
    The path (destination URL) for the HTTP health check request; the default is /.
    regex Boolean
    response String
    The response returned by the request, depending on the match type.
    matchType string
    method string
    The method for the HTTP health check.
    negate boolean
    path string
    The path (destination URL) for the HTTP health check request; the default is /.
    regex boolean
    response string
    The response returned by the request, depending on the match type.
    match_type str
    method str
    The method for the HTTP health check.
    negate bool
    path str
    The path (destination URL) for the HTTP health check request; the default is /.
    regex bool
    response str
    The response returned by the request, depending on the match type.
    matchType String
    method String
    The method for the HTTP health check.
    negate Boolean
    path String
    The path (destination URL) for the HTTP health check request; the default is /.
    regex Boolean
    response String
    The response returned by the request, depending on the match type.

    GetTargetGroupTarget

    HealthCheckEnabled bool
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    Ip string
    The IP of the balanced target VM.
    MaintenanceEnabled bool
    Maintenance mode prevents the target from receiving balanced traffic.
    Port double
    The port of the balanced target service; valid range is 1 to 65535.
    ProxyProtocol string
    The proxy protocol version.
    Weight double
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.
    HealthCheckEnabled bool
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    Ip string
    The IP of the balanced target VM.
    MaintenanceEnabled bool
    Maintenance mode prevents the target from receiving balanced traffic.
    Port float64
    The port of the balanced target service; valid range is 1 to 65535.
    ProxyProtocol string
    The proxy protocol version.
    Weight float64
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.
    healthCheckEnabled Boolean
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    ip String
    The IP of the balanced target VM.
    maintenanceEnabled Boolean
    Maintenance mode prevents the target from receiving balanced traffic.
    port Double
    The port of the balanced target service; valid range is 1 to 65535.
    proxyProtocol String
    The proxy protocol version.
    weight Double
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.
    healthCheckEnabled boolean
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    ip string
    The IP of the balanced target VM.
    maintenanceEnabled boolean
    Maintenance mode prevents the target from receiving balanced traffic.
    port number
    The port of the balanced target service; valid range is 1 to 65535.
    proxyProtocol string
    The proxy protocol version.
    weight number
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.
    health_check_enabled bool
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    ip str
    The IP of the balanced target VM.
    maintenance_enabled bool
    Maintenance mode prevents the target from receiving balanced traffic.
    port float
    The port of the balanced target service; valid range is 1 to 65535.
    proxy_protocol str
    The proxy protocol version.
    weight float
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.
    healthCheckEnabled Boolean
    Makes the target available only if it accepts periodic health check TCP connection attempts; when turned off, the target is considered always available. The health check only consists of a connection attempt to the address and port of the target. Default is True.
    ip String
    The IP of the balanced target VM.
    maintenanceEnabled Boolean
    Maintenance mode prevents the target from receiving balanced traffic.
    port Number
    The port of the balanced target service; valid range is 1 to 65535.
    proxyProtocol String
    The proxy protocol version.
    weight Number
    Traffic is distributed in proportion to target weight, relative to the combined weight of all targets. A target with higher weight receives a greater share of traffic. Valid range is 0 to 256 and default is 1; targets with weight of 0 do not participate in load balancing but still accept persistent connections. It is best use values in the middle of the range to leave room for later adjustments.

    GetTargetGroupTimeouts

    Create string
    Default string
    Delete string
    Update string
    Create string
    Default string
    Delete string
    Update string
    create String
    default_ String
    delete String
    update String
    create string
    default string
    delete string
    update string
    create String
    default String
    delete String
    update String

    Package Details

    Repository
    ionoscloud ionos-cloud/terraform-provider-ionoscloud
    License
    Notes
    This Pulumi package is based on the ionoscloud Terraform Provider.
    ionoscloud logo
    ionoscloud 6.7.6 published on Monday, Apr 14, 2025 by ionos-cloud