1. Packages
  2. Civo
  3. API Docs
  4. getLoadBalancer
Civo v2.3.14 published on Thursday, Mar 21, 2024 by Pulumi

civo.getLoadBalancer

Explore with Pulumi AI

civo logo
Civo v2.3.14 published on Thursday, Mar 21, 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 Civo account.

    An error will be raised if the provided load balancer name does not exist in your Civo account.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as civo from "@pulumi/civo";
    
    const my-lb = civo.getLoadBalancer({
        name: "lb-name",
        region: "LON1",
    });
    export const civoLoadbalancerOutput = my_lb.then(my_lb => my_lb.publicIp);
    
    import pulumi
    import pulumi_civo as civo
    
    my_lb = civo.get_load_balancer(name="lb-name",
        region="LON1")
    pulumi.export("civoLoadbalancerOutput", my_lb.public_ip)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-civo/sdk/v2/go/civo"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		my_lb, err := civo.GetLoadBalancer(ctx, &civo.GetLoadBalancerArgs{
    			Name:   pulumi.StringRef("lb-name"),
    			Region: pulumi.StringRef("LON1"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		ctx.Export("civoLoadbalancerOutput", my_lb.PublicIp)
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Civo = Pulumi.Civo;
    
    return await Deployment.RunAsync(() => 
    {
        var my_lb = Civo.GetLoadBalancer.Invoke(new()
        {
            Name = "lb-name",
            Region = "LON1",
        });
    
        return new Dictionary<string, object?>
        {
            ["civoLoadbalancerOutput"] = my_lb.Apply(my_lb => my_lb.Apply(getLoadBalancerResult => getLoadBalancerResult.PublicIp)),
        };
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.civo.CivoFunctions;
    import com.pulumi.civo.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 my-lb = CivoFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
                .name("lb-name")
                .region("LON1")
                .build());
    
            ctx.export("civoLoadbalancerOutput", my_lb.publicIp());
        }
    }
    
    variables:
      my-lb:
        fn::invoke:
          Function: civo:getLoadBalancer
          Arguments:
            name: lb-name
            region: LON1
    outputs:
      civoLoadbalancerOutput: ${["my-lb"].publicIp}
    

    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,
                          region: 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,
                          region: Optional[pulumi.Input[str]] = None,
                          opts: Optional[InvokeOptions] = None) -> Output[GetLoadBalancerResult]
    func GetLoadBalancer(ctx *Context, args *GetLoadBalancerArgs, opts ...InvokeOption) (*GetLoadBalancerResult, error)
    func GetLoadBalancerOutput(ctx *Context, args *GetLoadBalancerOutputArgs, opts ...InvokeOption) GetLoadBalancerResultOutput

    > Note: This function is named GetLoadBalancer 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: civo:index/getLoadBalancer:getLoadBalancer
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    Name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    Region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    Id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    Name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    Region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    id String
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name String
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region String
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    id str
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name str
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region str
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    id String
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name String
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region String
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider

    getLoadBalancer Result

    The following output properties are available:

    Algorithm string
    The algorithm used by the load balancer
    Backends List<GetLoadBalancerBackend>
    ClusterId string
    The cluster id of the load balancer
    EnableProxyProtocol string
    The enabled proxy protocol of the load balancer
    ExternalTrafficPolicy string
    The external traffic policy of the load balancer
    FirewallId string
    The firewall id of the load balancer
    PrivateIp string
    The private ip of the load balancer
    PublicIp string
    The public ip of the load balancer
    SessionAffinity string
    The session affinity of the load balancer
    SessionAffinityConfigTimeout int
    The session affinity config timeout of the load balancer
    State string
    The state of the load balancer
    Id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    Name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    Region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    Algorithm string
    The algorithm used by the load balancer
    Backends []GetLoadBalancerBackend
    ClusterId string
    The cluster id of the load balancer
    EnableProxyProtocol string
    The enabled proxy protocol of the load balancer
    ExternalTrafficPolicy string
    The external traffic policy of the load balancer
    FirewallId string
    The firewall id of the load balancer
    PrivateIp string
    The private ip of the load balancer
    PublicIp string
    The public ip of the load balancer
    SessionAffinity string
    The session affinity of the load balancer
    SessionAffinityConfigTimeout int
    The session affinity config timeout of the load balancer
    State string
    The state of the load balancer
    Id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    Name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    Region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    algorithm String
    The algorithm used by the load balancer
    backends List<GetLoadBalancerBackend>
    clusterId String
    The cluster id of the load balancer
    enableProxyProtocol String
    The enabled proxy protocol of the load balancer
    externalTrafficPolicy String
    The external traffic policy of the load balancer
    firewallId String
    The firewall id of the load balancer
    privateIp String
    The private ip of the load balancer
    publicIp String
    The public ip of the load balancer
    sessionAffinity String
    The session affinity of the load balancer
    sessionAffinityConfigTimeout Integer
    The session affinity config timeout of the load balancer
    state String
    The state of the load balancer
    id String
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name String
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region String
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    algorithm string
    The algorithm used by the load balancer
    backends GetLoadBalancerBackend[]
    clusterId string
    The cluster id of the load balancer
    enableProxyProtocol string
    The enabled proxy protocol of the load balancer
    externalTrafficPolicy string
    The external traffic policy of the load balancer
    firewallId string
    The firewall id of the load balancer
    privateIp string
    The private ip of the load balancer
    publicIp string
    The public ip of the load balancer
    sessionAffinity string
    The session affinity of the load balancer
    sessionAffinityConfigTimeout number
    The session affinity config timeout of the load balancer
    state string
    The state of the load balancer
    id string
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name string
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region string
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    algorithm str
    The algorithm used by the load balancer
    backends Sequence[GetLoadBalancerBackend]
    cluster_id str
    The cluster id of the load balancer
    enable_proxy_protocol str
    The enabled proxy protocol of the load balancer
    external_traffic_policy str
    The external traffic policy of the load balancer
    firewall_id str
    The firewall id of the load balancer
    private_ip str
    The private ip of the load balancer
    public_ip str
    The public ip of the load balancer
    session_affinity str
    The session affinity of the load balancer
    session_affinity_config_timeout int
    The session affinity config timeout of the load balancer
    state str
    The state of the load balancer
    id str
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name str
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region str
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider
    algorithm String
    The algorithm used by the load balancer
    backends List<Property Map>
    clusterId String
    The cluster id of the load balancer
    enableProxyProtocol String
    The enabled proxy protocol of the load balancer
    externalTrafficPolicy String
    The external traffic policy of the load balancer
    firewallId String
    The firewall id of the load balancer
    privateIp String
    The private ip of the load balancer
    publicIp String
    The public ip of the load balancer
    sessionAffinity String
    The session affinity of the load balancer
    sessionAffinityConfigTimeout Number
    The session affinity config timeout of the load balancer
    state String
    The state of the load balancer
    id String
    The id of the load balancer to retrieve (You can find this id from service annotations 'kubernetes.civo.com/loadbalancer-id')
    name String
    The name of the load balancer (You can find this name from service annotations 'kubernetes.civo.com/loadbalancer-name')
    region String
    The region of the load balancer, if you declare this field, the datasource will use this value instead of the one defined in the provider

    Supporting Types

    GetLoadBalancerBackend

    HealthCheckPort int
    The health check port of the backend
    Ip string
    The ip of the backend
    Protocol string
    The protocol of the backend
    SourcePort int
    The source port of the backend
    TargetPort int
    The target port of the backend
    HealthCheckPort int
    The health check port of the backend
    Ip string
    The ip of the backend
    Protocol string
    The protocol of the backend
    SourcePort int
    The source port of the backend
    TargetPort int
    The target port of the backend
    healthCheckPort Integer
    The health check port of the backend
    ip String
    The ip of the backend
    protocol String
    The protocol of the backend
    sourcePort Integer
    The source port of the backend
    targetPort Integer
    The target port of the backend
    healthCheckPort number
    The health check port of the backend
    ip string
    The ip of the backend
    protocol string
    The protocol of the backend
    sourcePort number
    The source port of the backend
    targetPort number
    The target port of the backend
    health_check_port int
    The health check port of the backend
    ip str
    The ip of the backend
    protocol str
    The protocol of the backend
    source_port int
    The source port of the backend
    target_port int
    The target port of the backend
    healthCheckPort Number
    The health check port of the backend
    ip String
    The ip of the backend
    protocol String
    The protocol of the backend
    sourcePort Number
    The source port of the backend
    targetPort Number
    The target port of the backend

    Package Details

    Repository
    Civo pulumi/pulumi-civo
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the civo Terraform Provider.
    civo logo
    Civo v2.3.14 published on Thursday, Mar 21, 2024 by Pulumi