AWS v6.78.0 published on Thursday, Apr 24, 2025 by Pulumi
aws.alb.getListener
Explore with Pulumi AI
Note:
aws.alb.Listener
is known asaws.lb.Listener
. The functionality is identical.
Provides information about a Load Balancer Listener.
This data source can prove useful when a module accepts an LB Listener as an input variable and needs to know the LB it is attached to, or other information specific to the listener in question.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const config = new pulumi.Config();
const listenerArn = config.require("listenerArn");
const listener = aws.lb.getListener({
arn: listenerArn,
});
// get listener from load_balancer_arn and port
const selected = aws.lb.getLoadBalancer({
name: "default-public",
});
const selected443 = selected.then(selected => aws.lb.getListener({
loadBalancerArn: selected.arn,
port: 443,
}));
import pulumi
import pulumi_aws as aws
config = pulumi.Config()
listener_arn = config.require("listenerArn")
listener = aws.lb.get_listener(arn=listener_arn)
# get listener from load_balancer_arn and port
selected = aws.lb.get_load_balancer(name="default-public")
selected443 = aws.lb.get_listener(load_balancer_arn=selected.arn,
port=443)
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, "")
listenerArn := cfg.Require("listenerArn")
_, err := lb.LookupListener(ctx, &lb.LookupListenerArgs{
Arn: pulumi.StringRef(listenerArn),
}, nil)
if err != nil {
return err
}
// get listener from load_balancer_arn and port
selected, err := lb.LookupLoadBalancer(ctx, &lb.LookupLoadBalancerArgs{
Name: pulumi.StringRef("default-public"),
}, nil)
if err != nil {
return err
}
_, err = lb.LookupListener(ctx, &lb.LookupListenerArgs{
LoadBalancerArn: pulumi.StringRef(selected.Arn),
Port: pulumi.IntRef(443),
}, 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 listenerArn = config.Require("listenerArn");
var listener = Aws.LB.GetListener.Invoke(new()
{
Arn = listenerArn,
});
// get listener from load_balancer_arn and port
var selected = Aws.LB.GetLoadBalancer.Invoke(new()
{
Name = "default-public",
});
var selected443 = Aws.LB.GetListener.Invoke(new()
{
LoadBalancerArn = selected.Apply(getLoadBalancerResult => getLoadBalancerResult.Arn),
Port = 443,
});
});
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.GetListenerArgs;
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 listenerArn = config.get("listenerArn");
final var listener = LbFunctions.getListener(GetListenerArgs.builder()
.arn(listenerArn)
.build());
// get listener from load_balancer_arn and port
final var selected = LbFunctions.getLoadBalancer(GetLoadBalancerArgs.builder()
.name("default-public")
.build());
final var selected443 = LbFunctions.getListener(GetListenerArgs.builder()
.loadBalancerArn(selected.arn())
.port(443)
.build());
}
}
configuration:
# get listener from listener arn
listenerArn:
type: string
variables:
listener:
fn::invoke:
function: aws:lb:getListener
arguments:
arn: ${listenerArn}
# get listener from load_balancer_arn and port
selected:
fn::invoke:
function: aws:lb:getLoadBalancer
arguments:
name: default-public
selected443:
fn::invoke:
function: aws:lb:getListener
arguments:
loadBalancerArn: ${selected.arn}
port: 443
Using getListener
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 getListener(args: GetListenerArgs, opts?: InvokeOptions): Promise<GetListenerResult>
function getListenerOutput(args: GetListenerOutputArgs, opts?: InvokeOptions): Output<GetListenerResult>
def get_listener(arn: Optional[str] = None,
load_balancer_arn: Optional[str] = None,
port: Optional[int] = None,
tags: Optional[Mapping[str, str]] = None,
opts: Optional[InvokeOptions] = None) -> GetListenerResult
def get_listener_output(arn: Optional[pulumi.Input[str]] = None,
load_balancer_arn: Optional[pulumi.Input[str]] = None,
port: Optional[pulumi.Input[int]] = None,
tags: Optional[pulumi.Input[Mapping[str, pulumi.Input[str]]]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetListenerResult]
func LookupListener(ctx *Context, args *LookupListenerArgs, opts ...InvokeOption) (*LookupListenerResult, error)
func LookupListenerOutput(ctx *Context, args *LookupListenerOutputArgs, opts ...InvokeOption) LookupListenerResultOutput
> Note: This function is named LookupListener
in the Go SDK.
public static class GetListener
{
public static Task<GetListenerResult> InvokeAsync(GetListenerArgs args, InvokeOptions? opts = null)
public static Output<GetListenerResult> Invoke(GetListenerInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetListenerResult> getListener(GetListenerArgs args, InvokeOptions options)
public static Output<GetListenerResult> getListener(GetListenerArgs args, InvokeOptions options)
fn::invoke:
function: aws:alb/getListener:getListener
arguments:
# arguments dictionary
The following arguments are supported:
- Arn string
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - Load
Balancer stringArn - ARN of the load balancer. Required if
arn
is not set. - Port int
- Port of the listener. Required if
arn
is not set. - Dictionary<string, string>
- Arn string
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - Load
Balancer stringArn - ARN of the load balancer. Required if
arn
is not set. - Port int
- Port of the listener. Required if
arn
is not set. - map[string]string
- arn String
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - load
Balancer StringArn - ARN of the load balancer. Required if
arn
is not set. - port Integer
- Port of the listener. Required if
arn
is not set. - Map<String,String>
- arn string
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - load
Balancer stringArn - ARN of the load balancer. Required if
arn
is not set. - port number
- Port of the listener. Required if
arn
is not set. - {[key: string]: string}
- arn str
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - load_
balancer_ strarn - ARN of the load balancer. Required if
arn
is not set. - port int
- Port of the listener. Required if
arn
is not set. - Mapping[str, str]
- arn String
- ARN of the listener. Required if
load_balancer_arn
andport
is not set. - load
Balancer StringArn - ARN of the load balancer. Required if
arn
is not set. - port Number
- Port of the listener. Required if
arn
is not set. - Map<String>
getListener Result
The following output properties are available:
- Alpn
Policy string - Arn string
- Certificate
Arn string - Default
Actions List<GetListener Default Action> - Id string
- The provider-assigned unique ID for this managed resource.
- Load
Balancer stringArn - Mutual
Authentications List<GetListener Mutual Authentication> - Port int
- Protocol string
- Ssl
Policy string - Dictionary<string, string>
- Alpn
Policy string - Arn string
- Certificate
Arn string - Default
Actions []GetListener Default Action - Id string
- The provider-assigned unique ID for this managed resource.
- Load
Balancer stringArn - Mutual
Authentications []GetListener Mutual Authentication - Port int
- Protocol string
- Ssl
Policy string - map[string]string
- alpn
Policy String - arn String
- certificate
Arn String - default
Actions List<GetListener Default Action> - id String
- The provider-assigned unique ID for this managed resource.
- load
Balancer StringArn - mutual
Authentications List<GetListener Mutual Authentication> - port Integer
- protocol String
- ssl
Policy String - Map<String,String>
- alpn
Policy string - arn string
- certificate
Arn string - default
Actions GetListener Default Action[] - id string
- The provider-assigned unique ID for this managed resource.
- load
Balancer stringArn - mutual
Authentications GetListener Mutual Authentication[] - port number
- protocol string
- ssl
Policy string - {[key: string]: string}
- alpn_
policy str - arn str
- certificate_
arn str - default_
actions Sequence[GetListener Default Action] - id str
- The provider-assigned unique ID for this managed resource.
- load_
balancer_ strarn - mutual_
authentications Sequence[GetListener Mutual Authentication] - port int
- protocol str
- ssl_
policy str - Mapping[str, str]
- alpn
Policy String - arn String
- certificate
Arn String - default
Actions List<Property Map> - id String
- The provider-assigned unique ID for this managed resource.
- load
Balancer StringArn - mutual
Authentications List<Property Map> - port Number
- protocol String
- ssl
Policy String - Map<String>
Supporting Types
GetListenerDefaultAction
- Authenticate
Cognitos This property is required. List<GetListener Default Action Authenticate Cognito> - Authenticate
Oidcs This property is required. List<GetListener Default Action Authenticate Oidc> - Fixed
Responses This property is required. List<GetListener Default Action Fixed Response> - Forwards
This property is required. List<GetListener Default Action Forward> - Order
This property is required. int - Redirects
This property is required. List<GetListener Default Action Redirect> - Target
Group Arn This property is required. string - Type
This property is required. string
- Authenticate
Cognitos This property is required. []GetListener Default Action Authenticate Cognito - Authenticate
Oidcs This property is required. []GetListener Default Action Authenticate Oidc - Fixed
Responses This property is required. []GetListener Default Action Fixed Response - Forwards
This property is required. []GetListener Default Action Forward - Order
This property is required. int - Redirects
This property is required. []GetListener Default Action Redirect - Target
Group Arn This property is required. string - Type
This property is required. string
- authenticate
Cognitos This property is required. List<GetListener Default Action Authenticate Cognito> - authenticate
Oidcs This property is required. List<GetListener Default Action Authenticate Oidc> - fixed
Responses This property is required. List<GetListener Default Action Fixed Response> - forwards
This property is required. List<GetListener Default Action Forward> - order
This property is required. Integer - redirects
This property is required. List<GetListener Default Action Redirect> - target
Group Arn This property is required. String - type
This property is required. String
- authenticate
Cognitos This property is required. GetListener Default Action Authenticate Cognito[] - authenticate
Oidcs This property is required. GetListener Default Action Authenticate Oidc[] - fixed
Responses This property is required. GetListener Default Action Fixed Response[] - forwards
This property is required. GetListener Default Action Forward[] - order
This property is required. number - redirects
This property is required. GetListener Default Action Redirect[] - target
Group Arn This property is required. string - type
This property is required. string
- authenticate_
cognitos This property is required. Sequence[GetListener Default Action Authenticate Cognito] - authenticate_
oidcs This property is required. Sequence[GetListener Default Action Authenticate Oidc] - fixed_
responses This property is required. Sequence[GetListener Default Action Fixed Response] - forwards
This property is required. Sequence[GetListener Default Action Forward] - order
This property is required. int - redirects
This property is required. Sequence[GetListener Default Action Redirect] - target_
group_ arn This property is required. str - type
This property is required. str
- authenticate
Cognitos This property is required. List<Property Map> - authenticate
Oidcs This property is required. List<Property Map> - fixed
Responses This property is required. List<Property Map> - forwards
This property is required. List<Property Map> - order
This property is required. Number - redirects
This property is required. List<Property Map> - target
Group Arn This property is required. String - type
This property is required. String
GetListenerDefaultActionAuthenticateCognito
- Authentication
Request Extra Params This property is required. Dictionary<string, string> - On
Unauthenticated Request This property is required. string - Scope
This property is required. string This property is required. string- Session
Timeout This property is required. int - User
Pool Arn This property is required. string - User
Pool Client Id This property is required. string - User
Pool Domain This property is required. string
- Authentication
Request Extra Params This property is required. map[string]string - On
Unauthenticated Request This property is required. string - Scope
This property is required. string This property is required. string- Session
Timeout This property is required. int - User
Pool Arn This property is required. string - User
Pool Client Id This property is required. string - User
Pool Domain This property is required. string
- authentication
Request Extra Params This property is required. Map<String,String> - on
Unauthenticated Request This property is required. String - scope
This property is required. String This property is required. String- session
Timeout This property is required. Integer - user
Pool Arn This property is required. String - user
Pool Client Id This property is required. String - user
Pool Domain This property is required. String
- authentication
Request Extra Params This property is required. {[key: string]: string} - on
Unauthenticated Request This property is required. string - scope
This property is required. string This property is required. string- session
Timeout This property is required. number - user
Pool Arn This property is required. string - user
Pool Client Id This property is required. string - user
Pool Domain This property is required. string
- authentication_
request_ extra_ params This property is required. Mapping[str, str] - on_
unauthenticated_ request This property is required. str - scope
This property is required. str This property is required. str- session_
timeout This property is required. int - user_
pool_ arn This property is required. str - user_
pool_ client_ id This property is required. str - user_
pool_ domain This property is required. str
- authentication
Request Extra Params This property is required. Map<String> - on
Unauthenticated Request This property is required. String - scope
This property is required. String This property is required. String- session
Timeout This property is required. Number - user
Pool Arn This property is required. String - user
Pool Client Id This property is required. String - user
Pool Domain This property is required. String
GetListenerDefaultActionAuthenticateOidc
- Authentication
Request Extra Params This property is required. Dictionary<string, string> This property is required. string- Client
Id This property is required. string - Client
Secret This property is required. string - Issuer
This property is required. string - On
Unauthenticated Request This property is required. string - Scope
This property is required. string This property is required. string- Session
Timeout This property is required. int - Token
Endpoint This property is required. string - User
Info Endpoint This property is required. string
- Authentication
Request Extra Params This property is required. map[string]string This property is required. string- Client
Id This property is required. string - Client
Secret This property is required. string - Issuer
This property is required. string - On
Unauthenticated Request This property is required. string - Scope
This property is required. string This property is required. string- Session
Timeout This property is required. int - Token
Endpoint This property is required. string - User
Info Endpoint This property is required. string
- authentication
Request Extra Params This property is required. Map<String,String> This property is required. String- client
Id This property is required. String - client
Secret This property is required. String - issuer
This property is required. String - on
Unauthenticated Request This property is required. String - scope
This property is required. String This property is required. String- session
Timeout This property is required. Integer - token
Endpoint This property is required. String - user
Info Endpoint This property is required. String
- authentication
Request Extra Params This property is required. {[key: string]: string} This property is required. string- client
Id This property is required. string - client
Secret This property is required. string - issuer
This property is required. string - on
Unauthenticated Request This property is required. string - scope
This property is required. string This property is required. string- session
Timeout This property is required. number - token
Endpoint This property is required. string - user
Info Endpoint This property is required. string
- authentication_
request_ extra_ params This property is required. Mapping[str, str] This property is required. str- client_
id This property is required. str - client_
secret This property is required. str - issuer
This property is required. str - on_
unauthenticated_ request This property is required. str - scope
This property is required. str This property is required. str- session_
timeout This property is required. int - token_
endpoint This property is required. str - user_
info_ endpoint This property is required. str
- authentication
Request Extra Params This property is required. Map<String> This property is required. String- client
Id This property is required. String - client
Secret This property is required. String - issuer
This property is required. String - on
Unauthenticated Request This property is required. String - scope
This property is required. String This property is required. String- session
Timeout This property is required. Number - token
Endpoint This property is required. String - user
Info Endpoint This property is required. String
GetListenerDefaultActionFixedResponse
- Content
Type This property is required. string - Message
Body This property is required. string - Status
Code This property is required. string
- Content
Type This property is required. string - Message
Body This property is required. string - Status
Code This property is required. string
- content
Type This property is required. String - message
Body This property is required. String - status
Code This property is required. String
- content
Type This property is required. string - message
Body This property is required. string - status
Code This property is required. string
- content_
type This property is required. str - message_
body This property is required. str - status_
code This property is required. str
- content
Type This property is required. String - message
Body This property is required. String - status
Code This property is required. String
GetListenerDefaultActionForward
- Stickinesses
This property is required. List<GetListener Default Action Forward Stickiness> - Target
Groups This property is required. List<GetListener Default Action Forward Target Group>
- Stickinesses
This property is required. []GetListener Default Action Forward Stickiness - Target
Groups This property is required. []GetListener Default Action Forward Target Group
- stickinesses
This property is required. List<GetListener Default Action Forward Stickiness> - target
Groups This property is required. List<GetListener Default Action Forward Target Group>
- stickinesses
This property is required. GetListener Default Action Forward Stickiness[] - target
Groups This property is required. GetListener Default Action Forward Target Group[]
- stickinesses
This property is required. Sequence[GetListener Default Action Forward Stickiness] - target_
groups This property is required. Sequence[GetListener Default Action Forward Target Group]
- stickinesses
This property is required. List<Property Map> - target
Groups This property is required. List<Property Map>
GetListenerDefaultActionForwardStickiness
GetListenerDefaultActionForwardTargetGroup
GetListenerDefaultActionRedirect
GetListenerMutualAuthentication
- Advertise
Trust Store Ca Names This property is required. string - Ignore
Client Certificate Expiry This property is required. bool - Mode
This property is required. string - Trust
Store Arn This property is required. string
- Advertise
Trust Store Ca Names This property is required. string - Ignore
Client Certificate Expiry This property is required. bool - Mode
This property is required. string - Trust
Store Arn This property is required. string
- advertise
Trust Store Ca Names This property is required. String - ignore
Client Certificate Expiry This property is required. Boolean - mode
This property is required. String - trust
Store Arn This property is required. String
- advertise
Trust Store Ca Names This property is required. string - ignore
Client Certificate Expiry This property is required. boolean - mode
This property is required. string - trust
Store Arn This property is required. string
- advertise_
trust_ store_ ca_ names This property is required. str - ignore_
client_ certificate_ expiry This property is required. bool - mode
This property is required. str - trust_
store_ arn This property is required. str
- advertise
Trust Store Ca Names This property is required. String - ignore
Client Certificate Expiry This property is required. Boolean - mode
This property is required. String - trust
Store Arn This property is required. String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.