DigitalOcean

v4.15.2 published on Friday, Sep 2, 2022 by Pulumi

getLoadBalancer

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

using System.Collections.Generic;
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 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, &GetLoadBalancerArgs{
			Name: pulumi.StringRef("app"),
		}, nil)
		if err != nil {
			return err
		}
		ctx.Export("lbOutput", example.Ip)
		return nil
	})
}
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()));
    }
}
import pulumi
import pulumi_digitalocean as digitalocean

example = digitalocean.get_load_balancer(name="app")
pulumi.export("lbOutput", example.ip)
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);
variables:
  example:
    Fn::Invoke:
      Function: digitalocean:getLoadBalancer
      Arguments:
        name: app
outputs:
  lbOutput: ${example.ip}

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:

Supporting Types

GetLoadBalancerForwardingRule

GetLoadBalancerHealthcheck

GetLoadBalancerStickySession

cookieName String
cookieTtlSeconds Integer
type String
cookieName string
cookieTtlSeconds number
type string
cookieName String
cookieTtlSeconds Number
type String

Package Details

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

This Pulumi package is based on the digitalocean Terraform Provider.