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

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",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_target_group(id="target_group_id")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getTargetGroup
      arguments:
        id: target_group_id
Copy

By Name

import * as pulumi from "@pulumi/pulumi";
import * as ionoscloud from "@pulumi/ionoscloud";

const example = ionoscloud.getTargetGroup({
    name: "Target Group Example",
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_target_group(name="Target Group Example")
Copy
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
	})
}
Copy
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",
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getTargetGroup
      arguments:
        name: Target Group Example
Copy

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,
});
Copy
import pulumi
import pulumi_ionoscloud as ionoscloud

example = ionoscloud.get_target_group(name="Example",
    partial_match=True)
Copy
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
	})
}
Copy
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,
    });

});
Copy
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());

    }
}
Copy
variables:
  example:
    fn::invoke:
      function: ionoscloud:getTargetGroup
      arguments:
        name: Example
        partialMatch: true
Copy

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>
Copy
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]
Copy
func LookupTargetGroup(ctx *Context, args *LookupTargetGroupArgs, opts ...InvokeOption) (*LookupTargetGroupResult, error)
func LookupTargetGroupOutput(ctx *Context, args *LookupTargetGroupOutputArgs, opts ...InvokeOption) LookupTargetGroupResultOutput
Copy

> 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)
}
Copy
public static CompletableFuture<GetTargetGroupResult> getTargetGroup(GetTargetGroupArgs args, InvokeOptions options)
public static Output<GetTargetGroupResult> getTargetGroup(GetTargetGroupArgs args, InvokeOptions options)
Copy
fn::invoke:
  function: ionoscloud:index/getTargetGroup:getTargetGroup
  arguments:
    # arguments dictionary
Copy

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 This property is required. double
The interval in milliseconds between consecutive health checks; default is 2000.
CheckTimeout This property is required. 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 This property is required. 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 This property is required. float64
The interval in milliseconds between consecutive health checks; default is 2000.
CheckTimeout This property is required. 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 This property is required. 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 This property is required. Double
The interval in milliseconds between consecutive health checks; default is 2000.
checkTimeout This property is required. 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 This property is required. 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 This property is required. number
The interval in milliseconds between consecutive health checks; default is 2000.
checkTimeout This property is required. 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 This property is required. 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 This property is required. float
The interval in milliseconds between consecutive health checks; default is 2000.
check_timeout This property is required. 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 This property is required. 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 This property is required. Number
The interval in milliseconds between consecutive health checks; default is 2000.
checkTimeout This property is required. 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 This property is required. 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 This property is required. string
Method This property is required. string
The method for the HTTP health check.
Negate This property is required. bool
Path This property is required. string
The path (destination URL) for the HTTP health check request; the default is /.
Regex This property is required. bool
Response This property is required. string
The response returned by the request, depending on the match type.
MatchType This property is required. string
Method This property is required. string
The method for the HTTP health check.
Negate This property is required. bool
Path This property is required. string
The path (destination URL) for the HTTP health check request; the default is /.
Regex This property is required. bool
Response This property is required. string
The response returned by the request, depending on the match type.
matchType This property is required. String
method This property is required. String
The method for the HTTP health check.
negate This property is required. Boolean
path This property is required. String
The path (destination URL) for the HTTP health check request; the default is /.
regex This property is required. Boolean
response This property is required. String
The response returned by the request, depending on the match type.
matchType This property is required. string
method This property is required. string
The method for the HTTP health check.
negate This property is required. boolean
path This property is required. string
The path (destination URL) for the HTTP health check request; the default is /.
regex This property is required. boolean
response This property is required. string
The response returned by the request, depending on the match type.
match_type This property is required. str
method This property is required. str
The method for the HTTP health check.
negate This property is required. bool
path This property is required. str
The path (destination URL) for the HTTP health check request; the default is /.
regex This property is required. bool
response This property is required. str
The response returned by the request, depending on the match type.
matchType This property is required. String
method This property is required. String
The method for the HTTP health check.
negate This property is required. Boolean
path This property is required. String
The path (destination URL) for the HTTP health check request; the default is /.
regex This property is required. Boolean
response This property is required. String
The response returned by the request, depending on the match type.

GetTargetGroupTarget

HealthCheckEnabled This property is required. 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 This property is required. string
The IP of the balanced target VM.
MaintenanceEnabled This property is required. bool
Maintenance mode prevents the target from receiving balanced traffic.
Port This property is required. double
The port of the balanced target service; valid range is 1 to 65535.
ProxyProtocol This property is required. string
The proxy protocol version.
Weight This property is required. 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 This property is required. 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 This property is required. string
The IP of the balanced target VM.
MaintenanceEnabled This property is required. bool
Maintenance mode prevents the target from receiving balanced traffic.
Port This property is required. float64
The port of the balanced target service; valid range is 1 to 65535.
ProxyProtocol This property is required. string
The proxy protocol version.
Weight This property is required. 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 This property is required. 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 This property is required. String
The IP of the balanced target VM.
maintenanceEnabled This property is required. Boolean
Maintenance mode prevents the target from receiving balanced traffic.
port This property is required. Double
The port of the balanced target service; valid range is 1 to 65535.
proxyProtocol This property is required. String
The proxy protocol version.
weight This property is required. 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 This property is required. 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 This property is required. string
The IP of the balanced target VM.
maintenanceEnabled This property is required. boolean
Maintenance mode prevents the target from receiving balanced traffic.
port This property is required. number
The port of the balanced target service; valid range is 1 to 65535.
proxyProtocol This property is required. string
The proxy protocol version.
weight This property is required. 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 This property is required. 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 This property is required. str
The IP of the balanced target VM.
maintenance_enabled This property is required. bool
Maintenance mode prevents the target from receiving balanced traffic.
port This property is required. float
The port of the balanced target service; valid range is 1 to 65535.
proxy_protocol This property is required. str
The proxy protocol version.
weight This property is required. 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 This property is required. 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 This property is required. String
The IP of the balanced target VM.
maintenanceEnabled This property is required. Boolean
Maintenance mode prevents the target from receiving balanced traffic.
port This property is required. Number
The port of the balanced target service; valid range is 1 to 65535.
proxyProtocol This property is required. String
The proxy protocol version.
weight This property is required. 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.