AWS Classic

Pulumi Official
Package maintained by Pulumi
v5.10.0 published on Monday, Jul 11, 2022 by Pulumi

getTargetGroup

Note: aws.alb.TargetGroup is known as aws.lb.TargetGroup. The functionality is identical.

Provides information about a Load Balancer Target Group.

This data source can prove useful when a module accepts an LB Target Group as an input variable and needs to know its attributes. It can also be used to get the ARN of an LB Target Group for use in other resources, given LB Target Group name.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
    public MyStack()
    {
        var config = new Config();
        var lbTgArn = config.Get("lbTgArn") ?? "";
        var lbTgName = config.Get("lbTgName") ?? "";
        var test = Output.Create(Aws.LB.GetTargetGroup.InvokeAsync(new Aws.LB.GetTargetGroupArgs
        {
            Arn = lbTgArn,
            Name = lbTgName,
        }));
    }

}
package main

import (
	"github.com/pulumi/pulumi-aws/sdk/v5/go/aws/lb"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		lbTgArn := ""
		if param := cfg.Get("lbTgArn"); param != "" {
			lbTgArn = param
		}
		lbTgName := ""
		if param := cfg.Get("lbTgName"); param != "" {
			lbTgName = param
		}
		_, err := lb.LookupTargetGroup(ctx, &lb.LookupTargetGroupArgs{
			Arn:  pulumi.StringRef(lbTgArn),
			Name: pulumi.StringRef(lbTgName),
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import java.util.*;
import java.io.*;
import java.nio.*;
import com.pulumi.*;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        final var config = ctx.config();
        final var lbTgArn = config.get("lbTgArn").orElse("");
        final var lbTgName = config.get("lbTgName").orElse("");
        final var test = Output.of(LbFunctions.getTargetGroup(GetTargetGroupArgs.builder()
            .arn(lbTgArn)
            .name(lbTgName)
            .build()));

    }
}
import pulumi
import pulumi_aws as aws

config = pulumi.Config()
lb_tg_arn = config.get("lbTgArn")
if lb_tg_arn is None:
    lb_tg_arn = ""
lb_tg_name = config.get("lbTgName")
if lb_tg_name is None:
    lb_tg_name = ""
test = aws.lb.get_target_group(arn=lb_tg_arn,
    name=lb_tg_name)
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const config = new pulumi.Config();
const lbTgArn = config.get("lbTgArn") || "";
const lbTgName = config.get("lbTgName") || "";
const test = aws.lb.getTargetGroup({
    arn: lbTgArn,
    name: lbTgName,
});
configuration:
  lbTgArn:
    type: string
    default:
  lbTgName:
    type: string
    default:
variables:
  test:
    Fn::Invoke:
      Function: aws:lb:getTargetGroup
      Arguments:
        arn: ${lbTgArn}
        name: ${lbTgName}

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(arn: Optional[str] = None,
                     name: Optional[str] = None,
                     tags: Optional[Mapping[str, str]] = None,
                     opts: Optional[InvokeOptions] = None) -> GetTargetGroupResult
def get_target_group_output(arn: Optional[pulumi.Input[str]] = None,
                     name: Optional[pulumi.Input[str]] = None,
                     tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = 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)
// Output-based functions aren't available in Java yet
Fn::Invoke:
  Function: aws:lb/getTargetGroup:getTargetGroup
  Arguments:
    # Arguments dictionary

The following arguments are supported:

Arn string

The full ARN of the target group.

Name string

The unique name of the target group.

Tags Dictionary<string, string>
Arn string

The full ARN of the target group.

Name string

The unique name of the target group.

Tags map[string]string
arn String

The full ARN of the target group.

name String

The unique name of the target group.

tags Map<String,String>
arn string

The full ARN of the target group.

name string

The unique name of the target group.

tags {[key: string]: string}
arn str

The full ARN of the target group.

name str

The unique name of the target group.

tags Mapping[str, str]
arn String

The full ARN of the target group.

name String

The unique name of the target group.

tags Map<String>

getTargetGroup Result

The following output properties are available:

Arn string
ArnSuffix string
ConnectionTermination bool
DeregistrationDelay int
HealthCheck GetTargetGroupHealthCheck
Id string

The provider-assigned unique ID for this managed resource.

LambdaMultiValueHeadersEnabled bool
LoadBalancingAlgorithmType string
Name string
Port int
PreserveClientIp string
Protocol string
ProtocolVersion string
ProxyProtocolV2 bool
SlowStart int
Stickiness GetTargetGroupStickiness
Tags Dictionary<string, string>
TargetType string
VpcId string
arn String
arnSuffix String
connectionTermination Boolean
deregistrationDelay Integer
healthCheck GetTargetGroupHealthCheck
id String

The provider-assigned unique ID for this managed resource.

lambdaMultiValueHeadersEnabled Boolean
loadBalancingAlgorithmType String
name String
port Integer
preserveClientIp String
protocol String
protocolVersion String
proxyProtocolV2 Boolean
slowStart Integer
stickiness GetTargetGroupStickiness
tags Map<String,String>
targetType String
vpcId String
arn string
arnSuffix string
connectionTermination boolean
deregistrationDelay number
healthCheck GetTargetGroupHealthCheck
id string

The provider-assigned unique ID for this managed resource.

lambdaMultiValueHeadersEnabled boolean
loadBalancingAlgorithmType string
name string
port number
preserveClientIp string
protocol string
protocolVersion string
proxyProtocolV2 boolean
slowStart number
stickiness GetTargetGroupStickiness
tags {[key: string]: string}
targetType string
vpcId string
arn String
arnSuffix String
connectionTermination Boolean
deregistrationDelay Number
healthCheck Property Map
id String

The provider-assigned unique ID for this managed resource.

lambdaMultiValueHeadersEnabled Boolean
loadBalancingAlgorithmType String
name String
port Number
preserveClientIp String
protocol String
protocolVersion String
proxyProtocolV2 Boolean
slowStart Number
stickiness Property Map
tags Map<String>
targetType String
vpcId String

Supporting Types

GetTargetGroupHealthCheck

enabled Boolean
healthyThreshold Integer
interval Integer
matcher String
path String
port String
protocol String
timeout Integer
unhealthyThreshold Integer
enabled boolean
healthyThreshold number
interval number
matcher string
path string
port string
protocol string
timeout number
unhealthyThreshold number
enabled Boolean
healthyThreshold Number
interval Number
matcher String
path String
port String
protocol String
timeout Number
unhealthyThreshold Number

GetTargetGroupStickiness

cookieDuration Integer
cookieName String
enabled Boolean
type String
cookieDuration number
cookieName string
enabled boolean
type string
cookieDuration Number
cookieName String
enabled Boolean
type String

Package Details

Repository
https://github.com/pulumi/pulumi-aws
License
Apache-2.0
Notes

This Pulumi package is based on the aws Terraform Provider.