get Load Balancer
Note:
aws.alb.LoadBalanceris known asaws.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)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 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
})
}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}Return
A collection of values returned by getLoadBalancer.
Parameters
A collection of arguments for invoking getLoadBalancer.
Return
A collection of values returned by getLoadBalancer.
See also
Parameters
Full ARN of the load balancer.
Unique name of the load balancer.
Mapping of tags, each pair of which must exactly match a pair on the desired load balancer.
NOTE: When both
arnandnameare specified,arntakes precedence.tagshas lowest precedence.
Return
A collection of values returned by getLoadBalancer.
See also
Parameters
Builder for com.pulumi.aws.lb.kotlin.inputs.GetLoadBalancerPlainArgs.