1. Packages
  2. Digitalocean Provider
  3. API Docs
  4. getLoadBalancer
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

digitalocean.getLoadBalancer

Explore with Pulumi AI

digitalocean logo
DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi

    Get information on a load balancer for use in other resources. This data source provides all of the load balancers properties as configured on your DigitalOcean account. This is useful if the load balancer in question is not managed by the provider or you need to utilize any of the load balancers data.

    An error is triggered if the provided load balancer name does not exist.

    Example Usage

    Get the load balancer by name:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = digitalocean.getLoadBalancer({
        name: "app",
    });
    export const lbOutput = example.then(example => example.ip);
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_load_balancer(name="app")
    pulumi.export("lbOutput", example.ip)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := digitalocean.LookupLoadBalancer(ctx, &digitalocean.LookupLoadBalancerArgs{
    			Name: pulumi.StringRef("app"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("lbOutput", example.Ip)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetLoadBalancer.Invoke(new()
        {
            Name = "app",
        });
    
        return new Dictionary<string, object?>
        {
            ["lbOutput"] = example.Apply(getLoadBalancerResult => getLoadBalancerResult.Ip),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.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 example = DigitaloceanFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
                .name("app")
                .build());
    
            ctx.export("lbOutput", example.applyValue(getLoadBalancerResult -> getLoadBalancerResult.ip()));
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getLoadBalancer
          Arguments:
            name: app
    outputs:
      lbOutput: ${example.ip}
    

    Get the load balancer by ID:

    import * as pulumi from "@pulumi/pulumi";
    import * as digitalocean from "@pulumi/digitalocean";
    
    const example = digitalocean.getLoadBalancer({
        id: "loadbalancer_id",
    });
    
    import pulumi
    import pulumi_digitalocean as digitalocean
    
    example = digitalocean.get_load_balancer(id="loadbalancer_id")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-digitalocean/sdk/v4/go/digitalocean"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := digitalocean.LookupLoadBalancer(ctx, &digitalocean.LookupLoadBalancerArgs{
    			Id: pulumi.StringRef("loadbalancer_id"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using DigitalOcean = Pulumi.DigitalOcean;
    
    return await Deployment.RunAsync(() => 
    {
        var example = DigitalOcean.GetLoadBalancer.Invoke(new()
        {
            Id = "loadbalancer_id",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.digitalocean.DigitaloceanFunctions;
    import com.pulumi.digitalocean.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 example = DigitaloceanFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
                .id("loadbalancer_id")
                .build());
    
        }
    }
    
    variables:
      example:
        fn::invoke:
          Function: digitalocean:getLoadBalancer
          Arguments:
            id: loadbalancer_id
    

    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(id: Optional[str] = None,
                          name: Optional[str] = None,
                          opts: Optional[InvokeOptions] = None) -> GetLoadBalancerResult
    def get_load_balancer_output(id: Optional[pulumi.Input[str]] = None,
                          name: Optional[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: digitalocean:index/getLoadBalancer:getLoadBalancer
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The ID of load balancer.
    Name string
    The name of load balancer.
    Id string
    The ID of load balancer.
    Name string
    The name of load balancer.
    id String
    The ID of load balancer.
    name String
    The name of load balancer.
    id string
    The ID of load balancer.
    name string
    The name of load balancer.
    id str
    The ID of load balancer.
    name str
    The name of load balancer.
    id String
    The ID of load balancer.
    name String
    The name of load balancer.

    getLoadBalancer Result

    The following output properties are available:

    Algorithm string

    Deprecated: This field has been deprecated. You can no longer specify an algorithm for load balancers.

    DisableLetsEncryptDnsRecords bool
    Domains List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerDomain>
    DropletIds List<int>
    DropletTag string
    EnableBackendKeepalive bool
    EnableProxyProtocol bool
    Firewalls List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerFirewall>
    ForwardingRules List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerForwardingRule>
    GlbSettings List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerGlbSetting>
    Healthchecks List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerHealthcheck>
    HttpIdleTimeoutSeconds int
    Ip string
    LoadBalancerUrn string
    Network string
    ProjectId string
    RedirectHttpToHttps bool
    Region string
    Size string
    SizeUnit int
    Status string
    StickySessions List<Pulumi.DigitalOcean.Outputs.GetLoadBalancerStickySession>
    TargetLoadBalancerIds List<string>
    Type string
    VpcUuid string
    Id string
    Name string

    Supporting Types

    GetLoadBalancerDomain

    CertificateId string
    certificate ID for TLS handshaking
    CertificateName string
    name of certificate required for TLS handshaking
    IsManaged bool
    flag indicating if domain is managed by DigitalOcean
    Name string
    The name of load balancer.
    SslValidationErrorReasons List<string>
    list of domain SSL validation errors
    VerificationErrorReasons List<string>
    list of domain verification errors
    CertificateId string
    certificate ID for TLS handshaking
    CertificateName string
    name of certificate required for TLS handshaking
    IsManaged bool
    flag indicating if domain is managed by DigitalOcean
    Name string
    The name of load balancer.
    SslValidationErrorReasons []string
    list of domain SSL validation errors
    VerificationErrorReasons []string
    list of domain verification errors
    certificateId String
    certificate ID for TLS handshaking
    certificateName String
    name of certificate required for TLS handshaking
    isManaged Boolean
    flag indicating if domain is managed by DigitalOcean
    name String
    The name of load balancer.
    sslValidationErrorReasons List<String>
    list of domain SSL validation errors
    verificationErrorReasons List<String>
    list of domain verification errors
    certificateId string
    certificate ID for TLS handshaking
    certificateName string
    name of certificate required for TLS handshaking
    isManaged boolean
    flag indicating if domain is managed by DigitalOcean
    name string
    The name of load balancer.
    sslValidationErrorReasons string[]
    list of domain SSL validation errors
    verificationErrorReasons string[]
    list of domain verification errors
    certificate_id str
    certificate ID for TLS handshaking
    certificate_name str
    name of certificate required for TLS handshaking
    is_managed bool
    flag indicating if domain is managed by DigitalOcean
    name str
    The name of load balancer.
    ssl_validation_error_reasons Sequence[str]
    list of domain SSL validation errors
    verification_error_reasons Sequence[str]
    list of domain verification errors
    certificateId String
    certificate ID for TLS handshaking
    certificateName String
    name of certificate required for TLS handshaking
    isManaged Boolean
    flag indicating if domain is managed by DigitalOcean
    name String
    The name of load balancer.
    sslValidationErrorReasons List<String>
    list of domain SSL validation errors
    verificationErrorReasons List<String>
    list of domain verification errors

    GetLoadBalancerFirewall

    Allows List<string>
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    Denies List<string>
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    Allows []string
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    Denies []string
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    allows List<String>
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    denies List<String>
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    allows string[]
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    denies string[]
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    allows Sequence[str]
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    denies Sequence[str]
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    allows List<String>
    the rules for ALLOWING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')
    denies List<String>
    the rules for DENYING traffic to the LB (strings in the form: 'ip:1.2.3.4' or 'cidr:1.2.0.0/16')

    GetLoadBalancerForwardingRule

    CertificateId string
    the id of the tls certificate used for ssl termination if enabled
    CertificateName string
    the name of the tls certificate used for ssl termination if enabled
    EntryPort int
    the port on which the load balancer instance will listen
    EntryProtocol string
    the protocol used for traffic to the load balancer
    TargetPort int
    the port on the backend Droplets to which the load balancer will send traffic
    TargetProtocol string
    the protocol used for traffic to the backend droplets
    TlsPassthrough bool
    whether ssl encrypted traffic will be passed through to the backend droplets
    CertificateId string
    the id of the tls certificate used for ssl termination if enabled
    CertificateName string
    the name of the tls certificate used for ssl termination if enabled
    EntryPort int
    the port on which the load balancer instance will listen
    EntryProtocol string
    the protocol used for traffic to the load balancer
    TargetPort int
    the port on the backend Droplets to which the load balancer will send traffic
    TargetProtocol string
    the protocol used for traffic to the backend droplets
    TlsPassthrough bool
    whether ssl encrypted traffic will be passed through to the backend droplets
    certificateId String
    the id of the tls certificate used for ssl termination if enabled
    certificateName String
    the name of the tls certificate used for ssl termination if enabled
    entryPort Integer
    the port on which the load balancer instance will listen
    entryProtocol String
    the protocol used for traffic to the load balancer
    targetPort Integer
    the port on the backend Droplets to which the load balancer will send traffic
    targetProtocol String
    the protocol used for traffic to the backend droplets
    tlsPassthrough Boolean
    whether ssl encrypted traffic will be passed through to the backend droplets
    certificateId string
    the id of the tls certificate used for ssl termination if enabled
    certificateName string
    the name of the tls certificate used for ssl termination if enabled
    entryPort number
    the port on which the load balancer instance will listen
    entryProtocol string
    the protocol used for traffic to the load balancer
    targetPort number
    the port on the backend Droplets to which the load balancer will send traffic
    targetProtocol string
    the protocol used for traffic to the backend droplets
    tlsPassthrough boolean
    whether ssl encrypted traffic will be passed through to the backend droplets
    certificate_id str
    the id of the tls certificate used for ssl termination if enabled
    certificate_name str
    the name of the tls certificate used for ssl termination if enabled
    entry_port int
    the port on which the load balancer instance will listen
    entry_protocol str
    the protocol used for traffic to the load balancer
    target_port int
    the port on the backend Droplets to which the load balancer will send traffic
    target_protocol str
    the protocol used for traffic to the backend droplets
    tls_passthrough bool
    whether ssl encrypted traffic will be passed through to the backend droplets
    certificateId String
    the id of the tls certificate used for ssl termination if enabled
    certificateName String
    the name of the tls certificate used for ssl termination if enabled
    entryPort Number
    the port on which the load balancer instance will listen
    entryProtocol String
    the protocol used for traffic to the load balancer
    targetPort Number
    the port on the backend Droplets to which the load balancer will send traffic
    targetProtocol String
    the protocol used for traffic to the backend droplets
    tlsPassthrough Boolean
    whether ssl encrypted traffic will be passed through to the backend droplets

    GetLoadBalancerGlbSetting

    Cdns List<Pulumi.DigitalOcean.Inputs.GetLoadBalancerGlbSettingCdn>
    CDN specific configurations
    FailoverThreshold int
    fail-over threshold
    RegionPriorities Dictionary<string, int>
    region priority map
    TargetPort int
    target port rules
    TargetProtocol string
    target protocol rules
    Cdns []GetLoadBalancerGlbSettingCdn
    CDN specific configurations
    FailoverThreshold int
    fail-over threshold
    RegionPriorities map[string]int
    region priority map
    TargetPort int
    target port rules
    TargetProtocol string
    target protocol rules
    cdns List<GetLoadBalancerGlbSettingCdn>
    CDN specific configurations
    failoverThreshold Integer
    fail-over threshold
    regionPriorities Map<String,Integer>
    region priority map
    targetPort Integer
    target port rules
    targetProtocol String
    target protocol rules
    cdns GetLoadBalancerGlbSettingCdn[]
    CDN specific configurations
    failoverThreshold number
    fail-over threshold
    regionPriorities {[key: string]: number}
    region priority map
    targetPort number
    target port rules
    targetProtocol string
    target protocol rules
    cdns Sequence[GetLoadBalancerGlbSettingCdn]
    CDN specific configurations
    failover_threshold int
    fail-over threshold
    region_priorities Mapping[str, int]
    region priority map
    target_port int
    target port rules
    target_protocol str
    target protocol rules
    cdns List<Property Map>
    CDN specific configurations
    failoverThreshold Number
    fail-over threshold
    regionPriorities Map<Number>
    region priority map
    targetPort Number
    target port rules
    targetProtocol String
    target protocol rules

    GetLoadBalancerGlbSettingCdn

    IsEnabled bool
    cache enable flag
    IsEnabled bool
    cache enable flag
    isEnabled Boolean
    cache enable flag
    isEnabled boolean
    cache enable flag
    is_enabled bool
    cache enable flag
    isEnabled Boolean
    cache enable flag

    GetLoadBalancerHealthcheck

    CheckIntervalSeconds int
    the number of seconds between between two consecutive health checks
    HealthyThreshold int
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    Path string
    the path on the backend Droplets to which the Load Balancer will send a request
    Port int
    the port on the backend droplets on which the health check will attempt a connection
    Protocol string
    the protocol used for health checks sent to the backend droplets
    ResponseTimeoutSeconds int
    the number of seconds to wait for a response until marking a health check as failed
    UnhealthyThreshold int
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool
    CheckIntervalSeconds int
    the number of seconds between between two consecutive health checks
    HealthyThreshold int
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    Path string
    the path on the backend Droplets to which the Load Balancer will send a request
    Port int
    the port on the backend droplets on which the health check will attempt a connection
    Protocol string
    the protocol used for health checks sent to the backend droplets
    ResponseTimeoutSeconds int
    the number of seconds to wait for a response until marking a health check as failed
    UnhealthyThreshold int
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool
    checkIntervalSeconds Integer
    the number of seconds between between two consecutive health checks
    healthyThreshold Integer
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    path String
    the path on the backend Droplets to which the Load Balancer will send a request
    port Integer
    the port on the backend droplets on which the health check will attempt a connection
    protocol String
    the protocol used for health checks sent to the backend droplets
    responseTimeoutSeconds Integer
    the number of seconds to wait for a response until marking a health check as failed
    unhealthyThreshold Integer
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool
    checkIntervalSeconds number
    the number of seconds between between two consecutive health checks
    healthyThreshold number
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    path string
    the path on the backend Droplets to which the Load Balancer will send a request
    port number
    the port on the backend droplets on which the health check will attempt a connection
    protocol string
    the protocol used for health checks sent to the backend droplets
    responseTimeoutSeconds number
    the number of seconds to wait for a response until marking a health check as failed
    unhealthyThreshold number
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool
    check_interval_seconds int
    the number of seconds between between two consecutive health checks
    healthy_threshold int
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    path str
    the path on the backend Droplets to which the Load Balancer will send a request
    port int
    the port on the backend droplets on which the health check will attempt a connection
    protocol str
    the protocol used for health checks sent to the backend droplets
    response_timeout_seconds int
    the number of seconds to wait for a response until marking a health check as failed
    unhealthy_threshold int
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool
    checkIntervalSeconds Number
    the number of seconds between between two consecutive health checks
    healthyThreshold Number
    the number of times a health check must pass for a backend droplet to be marked 'healthy' and be re-added to the pool
    path String
    the path on the backend Droplets to which the Load Balancer will send a request
    port Number
    the port on the backend droplets on which the health check will attempt a connection
    protocol String
    the protocol used for health checks sent to the backend droplets
    responseTimeoutSeconds Number
    the number of seconds to wait for a response until marking a health check as failed
    unhealthyThreshold Number
    The number of times a health check must fail for a backend droplet to be marked 'unhealthy' and be removed from the pool

    GetLoadBalancerStickySession

    CookieName string
    the name of the cookie sent to the client
    CookieTtlSeconds int
    the number of seconds until the cookie set by the Load Balancer expires
    Type string
    how and if requests from a client will be persistently served by the same backend droplet
    CookieName string
    the name of the cookie sent to the client
    CookieTtlSeconds int
    the number of seconds until the cookie set by the Load Balancer expires
    Type string
    how and if requests from a client will be persistently served by the same backend droplet
    cookieName String
    the name of the cookie sent to the client
    cookieTtlSeconds Integer
    the number of seconds until the cookie set by the Load Balancer expires
    type String
    how and if requests from a client will be persistently served by the same backend droplet
    cookieName string
    the name of the cookie sent to the client
    cookieTtlSeconds number
    the number of seconds until the cookie set by the Load Balancer expires
    type string
    how and if requests from a client will be persistently served by the same backend droplet
    cookie_name str
    the name of the cookie sent to the client
    cookie_ttl_seconds int
    the number of seconds until the cookie set by the Load Balancer expires
    type str
    how and if requests from a client will be persistently served by the same backend droplet
    cookieName String
    the name of the cookie sent to the client
    cookieTtlSeconds Number
    the number of seconds until the cookie set by the Load Balancer expires
    type String
    how and if requests from a client will be persistently served by the same backend droplet

    Package Details

    Repository
    DigitalOcean pulumi/pulumi-digitalocean
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the digitalocean Terraform Provider.
    digitalocean logo
    DigitalOcean v4.35.0 published on Tuesday, Nov 19, 2024 by Pulumi