1. Packages
  2. AWS Classic
  3. API Docs
  4. alb
  5. getTargetGroup

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

aws.alb.getTargetGroup

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi

    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

    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,
    });
    
    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)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/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
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var lbTgArn = config.Get("lbTgArn") ?? "";
        var lbTgName = config.Get("lbTgName") ?? "";
        var test = Aws.LB.GetTargetGroup.Invoke(new()
        {
            Arn = lbTgArn,
            Name = lbTgName,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lb.LbFunctions;
    import com.pulumi.aws.lb.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 config = ctx.config();
            final var lbTgArn = config.get("lbTgArn").orElse("");
            final var lbTgName = config.get("lbTgName").orElse("");
            final var test = LbFunctions.getTargetGroup(GetTargetGroupArgs.builder()
                .arn(lbTgArn)
                .name(lbTgName)
                .build());
    
        }
    }
    
    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,
                         load_balancing_anomaly_mitigation: 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,
                         load_balancing_anomaly_mitigation: 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:alb/getTargetGroup:getTargetGroup
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Arn string
    Full ARN of the target group.
    LoadBalancingAnomalyMitigation string
    Name string
    Unique name of the target group.
    Tags Dictionary<string, string>

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    Arn string
    Full ARN of the target group.
    LoadBalancingAnomalyMitigation string
    Name string
    Unique name of the target group.
    Tags map[string]string

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    arn String
    Full ARN of the target group.
    loadBalancingAnomalyMitigation String
    name String
    Unique name of the target group.
    tags Map<String,String>

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    arn string
    Full ARN of the target group.
    loadBalancingAnomalyMitigation string
    name string
    Unique name of the target group.
    tags {[key: string]: string}

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    arn str
    Full ARN of the target group.
    load_balancing_anomaly_mitigation str
    name str
    Unique name of the target group.
    tags Mapping[str, str]

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    arn String
    Full ARN of the target group.
    loadBalancingAnomalyMitigation String
    name String
    Unique name of the target group.
    tags Map<String>

    Mapping of tags, each pair of which must exactly match a pair on the desired target group.

    NOTE: When both arn and name are specified, arn takes precedence. tags has the lowest precedence.

    getTargetGroup Result

    The following output properties are available:

    arn String
    arnSuffix String
    connectionTermination Boolean
    deregistrationDelay String
    healthCheck Property Map
    id String
    The provider-assigned unique ID for this managed resource.
    lambdaMultiValueHeadersEnabled Boolean
    loadBalancerArns List<String>
    loadBalancingAlgorithmType String
    loadBalancingAnomalyMitigation String
    loadBalancingCrossZoneEnabled 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
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.28.1 published on Thursday, Mar 28, 2024 by Pulumi