1. Packages
  2. AWS
  3. API Docs
  4. lb
  5. getLoadBalancer
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

aws.lb.getLoadBalancer

Explore with Pulumi AI

aws logo
AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi

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

    Provides information about a Load Balancer.

    This data source can prove useful when a module accepts an LB as an input variable and needs to, for example, determine the security groups associated with it, etc.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const config = new pulumi.Config();
    const lbArn = config.get("lbArn") || "";
    const lbName = config.get("lbName") || "";
    const test = aws.lb.getLoadBalancer({
        arn: lbArn,
        name: lbName,
    });
    
    import pulumi
    import pulumi_aws as aws
    
    config = pulumi.Config()
    lb_arn = config.get("lbArn")
    if lb_arn is None:
        lb_arn = ""
    lb_name = config.get("lbName")
    if lb_name is None:
        lb_name = ""
    test = aws.lb.get_load_balancer(arn=lb_arn,
        name=lb_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, "")
    		lbArn := ""
    		if param := cfg.Get("lbArn"); param != "" {
    			lbArn = param
    		}
    		lbName := ""
    		if param := cfg.Get("lbName"); param != "" {
    			lbName = param
    		}
    		_, err := lb.LookupLoadBalancer(ctx, &lb.LookupLoadBalancerArgs{
    			Arn:  pulumi.StringRef(lbArn),
    			Name: pulumi.StringRef(lbName),
    		}, 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 lbArn = config.Get("lbArn") ?? "";
        var lbName = config.Get("lbName") ?? "";
        var test = Aws.LB.GetLoadBalancer.Invoke(new()
        {
            Arn = lbArn,
            Name = lbName,
        });
    
    });
    
    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.GetLoadBalancerArgs;
    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 lbArn = config.get("lbArn").orElse("");
            final var lbName = config.get("lbName").orElse("");
            final var test = LbFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
                .arn(lbArn)
                .name(lbName)
                .build());
    
        }
    }
    
    configuration:
      lbArn:
        type: string
        default:
      lbName:
        type: string
        default:
    variables:
      test:
        fn::invoke:
          Function: aws:lb:getLoadBalancer
          Arguments:
            arn: ${lbArn}
            name: ${lbName}
    

    Using getLoadBalancer

    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 getLoadBalancer(args: GetLoadBalancerArgs, opts?: InvokeOptions): Promise<GetLoadBalancerResult>
    function getLoadBalancerOutput(args: GetLoadBalancerOutputArgs, opts?: InvokeOptions): Output<GetLoadBalancerResult>
    def get_load_balancer(arn: Optional[str] = None,
                          name: Optional[str] = None,
                          tags: Optional[Mapping[str, str]] = None,
                          opts: Optional[InvokeOptions] = None) -> GetLoadBalancerResult
    def get_load_balancer_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[GetLoadBalancerResult]
    func LookupLoadBalancer(ctx *Context, args *LookupLoadBalancerArgs, opts ...InvokeOption) (*LookupLoadBalancerResult, error)
    func LookupLoadBalancerOutput(ctx *Context, args *LookupLoadBalancerOutputArgs, opts ...InvokeOption) LookupLoadBalancerResultOutput

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

    public static class GetLoadBalancer 
    {
        public static Task<GetLoadBalancerResult> InvokeAsync(GetLoadBalancerArgs args, InvokeOptions? opts = null)
        public static Output<GetLoadBalancerResult> Invoke(GetLoadBalancerInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetLoadBalancerResult> getLoadBalancer(GetLoadBalancerArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: aws:lb/getLoadBalancer:getLoadBalancer
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Arn string
    Full ARN of the load balancer.
    Name string
    Unique name of the load balancer.
    Tags Dictionary<string, string>

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    Arn string
    Full ARN of the load balancer.
    Name string
    Unique name of the load balancer.
    Tags map[string]string

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    arn String
    Full ARN of the load balancer.
    name String
    Unique name of the load balancer.
    tags Map<String,String>

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    arn string
    Full ARN of the load balancer.
    name string
    Unique name of the load balancer.
    tags {[key: string]: string}

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    arn str
    Full ARN of the load balancer.
    name str
    Unique name of the load balancer.
    tags Mapping[str, str]

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    arn String
    Full ARN of the load balancer.
    name String
    Unique name of the load balancer.
    tags Map<String>

    Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.

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

    getLoadBalancer Result

    The following output properties are available:

    AccessLogs GetLoadBalancerAccessLogs
    Arn string
    ArnSuffix string
    ClientKeepAlive int
    ConnectionLogs List<GetLoadBalancerConnectionLog>
    CustomerOwnedIpv4Pool string
    DesyncMitigationMode string
    DnsName string
    DnsRecordClientRoutingPolicy string
    DropInvalidHeaderFields bool
    EnableCrossZoneLoadBalancing bool
    EnableDeletionProtection bool
    EnableHttp2 bool
    EnableTlsVersionAndCipherSuiteHeaders bool
    EnableWafFailOpen bool
    EnableXffClientPort bool
    EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic string
    Id string
    The provider-assigned unique ID for this managed resource.
    IdleTimeout int
    Internal bool
    IpAddressType string
    LoadBalancerType string
    Name string
    PreserveHostHeader bool
    SecurityGroups List<string>
    SubnetMappings List<GetLoadBalancerSubnetMapping>
    Subnets List<string>
    Tags Dictionary<string, string>
    VpcId string
    XffHeaderProcessingMode string
    ZoneId string
    AccessLogs GetLoadBalancerAccessLogs
    Arn string
    ArnSuffix string
    ClientKeepAlive int
    ConnectionLogs []GetLoadBalancerConnectionLog
    CustomerOwnedIpv4Pool string
    DesyncMitigationMode string
    DnsName string
    DnsRecordClientRoutingPolicy string
    DropInvalidHeaderFields bool
    EnableCrossZoneLoadBalancing bool
    EnableDeletionProtection bool
    EnableHttp2 bool
    EnableTlsVersionAndCipherSuiteHeaders bool
    EnableWafFailOpen bool
    EnableXffClientPort bool
    EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic string
    Id string
    The provider-assigned unique ID for this managed resource.
    IdleTimeout int
    Internal bool
    IpAddressType string
    LoadBalancerType string
    Name string
    PreserveHostHeader bool
    SecurityGroups []string
    SubnetMappings []GetLoadBalancerSubnetMapping
    Subnets []string
    Tags map[string]string
    VpcId string
    XffHeaderProcessingMode string
    ZoneId string
    accessLogs GetLoadBalancerAccessLogs
    arn String
    arnSuffix String
    clientKeepAlive Integer
    connectionLogs List<GetLoadBalancerConnectionLog>
    customerOwnedIpv4Pool String
    desyncMitigationMode String
    dnsName String
    dnsRecordClientRoutingPolicy String
    dropInvalidHeaderFields Boolean
    enableCrossZoneLoadBalancing Boolean
    enableDeletionProtection Boolean
    enableHttp2 Boolean
    enableTlsVersionAndCipherSuiteHeaders Boolean
    enableWafFailOpen Boolean
    enableXffClientPort Boolean
    enforceSecurityGroupInboundRulesOnPrivateLinkTraffic String
    id String
    The provider-assigned unique ID for this managed resource.
    idleTimeout Integer
    internal Boolean
    ipAddressType String
    loadBalancerType String
    name String
    preserveHostHeader Boolean
    securityGroups List<String>
    subnetMappings List<GetLoadBalancerSubnetMapping>
    subnets List<String>
    tags Map<String,String>
    vpcId String
    xffHeaderProcessingMode String
    zoneId String
    accessLogs GetLoadBalancerAccessLogs
    arn string
    arnSuffix string
    clientKeepAlive number
    connectionLogs GetLoadBalancerConnectionLog[]
    customerOwnedIpv4Pool string
    desyncMitigationMode string
    dnsName string
    dnsRecordClientRoutingPolicy string
    dropInvalidHeaderFields boolean
    enableCrossZoneLoadBalancing boolean
    enableDeletionProtection boolean
    enableHttp2 boolean
    enableTlsVersionAndCipherSuiteHeaders boolean
    enableWafFailOpen boolean
    enableXffClientPort boolean
    enforceSecurityGroupInboundRulesOnPrivateLinkTraffic string
    id string
    The provider-assigned unique ID for this managed resource.
    idleTimeout number
    internal boolean
    ipAddressType string
    loadBalancerType string
    name string
    preserveHostHeader boolean
    securityGroups string[]
    subnetMappings GetLoadBalancerSubnetMapping[]
    subnets string[]
    tags {[key: string]: string}
    vpcId string
    xffHeaderProcessingMode string
    zoneId string
    access_logs GetLoadBalancerAccessLogs
    arn str
    arn_suffix str
    client_keep_alive int
    connection_logs Sequence[GetLoadBalancerConnectionLog]
    customer_owned_ipv4_pool str
    desync_mitigation_mode str
    dns_name str
    dns_record_client_routing_policy str
    drop_invalid_header_fields bool
    enable_cross_zone_load_balancing bool
    enable_deletion_protection bool
    enable_http2 bool
    enable_tls_version_and_cipher_suite_headers bool
    enable_waf_fail_open bool
    enable_xff_client_port bool
    enforce_security_group_inbound_rules_on_private_link_traffic str
    id str
    The provider-assigned unique ID for this managed resource.
    idle_timeout int
    internal bool
    ip_address_type str
    load_balancer_type str
    name str
    preserve_host_header bool
    security_groups Sequence[str]
    subnet_mappings Sequence[GetLoadBalancerSubnetMapping]
    subnets Sequence[str]
    tags Mapping[str, str]
    vpc_id str
    xff_header_processing_mode str
    zone_id str
    accessLogs Property Map
    arn String
    arnSuffix String
    clientKeepAlive Number
    connectionLogs List<Property Map>
    customerOwnedIpv4Pool String
    desyncMitigationMode String
    dnsName String
    dnsRecordClientRoutingPolicy String
    dropInvalidHeaderFields Boolean
    enableCrossZoneLoadBalancing Boolean
    enableDeletionProtection Boolean
    enableHttp2 Boolean
    enableTlsVersionAndCipherSuiteHeaders Boolean
    enableWafFailOpen Boolean
    enableXffClientPort Boolean
    enforceSecurityGroupInboundRulesOnPrivateLinkTraffic String
    id String
    The provider-assigned unique ID for this managed resource.
    idleTimeout Number
    internal Boolean
    ipAddressType String
    loadBalancerType String
    name String
    preserveHostHeader Boolean
    securityGroups List<String>
    subnetMappings List<Property Map>
    subnets List<String>
    tags Map<String>
    vpcId String
    xffHeaderProcessingMode String
    zoneId String

    Supporting Types

    GetLoadBalancerAccessLogs

    Bucket string
    Enabled bool
    Prefix string
    Bucket string
    Enabled bool
    Prefix string
    bucket String
    enabled Boolean
    prefix String
    bucket string
    enabled boolean
    prefix string
    bucket str
    enabled bool
    prefix str
    bucket String
    enabled Boolean
    prefix String

    GetLoadBalancerConnectionLog

    Bucket string
    Enabled bool
    Prefix string
    Bucket string
    Enabled bool
    Prefix string
    bucket String
    enabled Boolean
    prefix String
    bucket string
    enabled boolean
    prefix string
    bucket str
    enabled bool
    prefix str
    bucket String
    enabled Boolean
    prefix String

    GetLoadBalancerSubnetMapping

    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
    AWS v6.54.0 published on Friday, Sep 27, 2024 by Pulumi