Show / Hide Table of Contents

Class ListenerRule

Provides a Load Balancer Listener Rule resource.

Note: aws.alb.ListenerRule is known as aws.lb.ListenerRule. The functionality is identical.

Example Usage

using Pulumi;
using Aws = Pulumi.Aws;

class MyStack : Stack
{
public MyStack()
{
    var frontEndLoadBalancer = new Aws.LB.LoadBalancer("frontEndLoadBalancer", new Aws.LB.LoadBalancerArgs
    {
    });
    var frontEndListener = new Aws.LB.Listener("frontEndListener", new Aws.LB.ListenerArgs
    {
    });
    var @static = new Aws.LB.ListenerRule("static", new Aws.LB.ListenerRuleArgs
    {
        Actions = 
        {
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                TargetGroupArn = aws_lb_target_group.Static.Arn,
                Type = "forward",
            },
        },
        Conditions = 
        {
            new Aws.LB.Inputs.ListenerRuleConditionArgs
            {
                PathPattern = new Aws.LB.Inputs.ListenerRuleConditionPathPatternArgs
                {
                    Values = 
                    {
                        "/static/*",
                    },
                },
            },
            new Aws.LB.Inputs.ListenerRuleConditionArgs
            {
                HostHeader = new Aws.LB.Inputs.ListenerRuleConditionHostHeaderArgs
                {
                    Values = 
                    {
                        "example.com",
                    },
                },
            },
        },
        ListenerArn = frontEndListener.Arn,
        Priority = 100,
    });
    var hostBasedRouting = new Aws.LB.ListenerRule("hostBasedRouting", new Aws.LB.ListenerRuleArgs
    {
        Actions = 
        {
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                TargetGroupArn = aws_lb_target_group.Static.Arn,
                Type = "forward",
            },
        },
        Conditions = 
        {
            new Aws.LB.Inputs.ListenerRuleConditionArgs
            {
                HostHeader = new Aws.LB.Inputs.ListenerRuleConditionHostHeaderArgs
                {
                    Values = 
                    {
                        "my-service.*.mydomain.io",
                    },
                },
            },
        },
        ListenerArn = frontEndListener.Arn,
        Priority = 99,
    });
    var redirectHttpToHttps = new Aws.LB.ListenerRule("redirectHttpToHttps", new Aws.LB.ListenerRuleArgs
    {
        Actions = 
        {
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                Redirect = new Aws.LB.Inputs.ListenerRuleActionRedirectArgs
                {
                    Port = "443",
                    Protocol = "HTTPS",
                    StatusCode = "HTTP_301",
                },
                Type = "redirect",
            },
        },
        Conditions = 
        {
            new Aws.LB.Inputs.ListenerRuleConditionArgs
            {
                HttpHeader = new Aws.LB.Inputs.ListenerRuleConditionHttpHeaderArgs
                {
                    HttpHeaderName = "X-Forwarded-For",
                    Values = 
                    {
                        "192.168.1.*",
                    },
                },
            },
        },
        ListenerArn = frontEndListener.Arn,
    });
    var healthCheck = new Aws.LB.ListenerRule("healthCheck", new Aws.LB.ListenerRuleArgs
    {
        Actions = 
        {
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                FixedResponse = new Aws.LB.Inputs.ListenerRuleActionFixedResponseArgs
                {
                    ContentType = "text/plain",
                    MessageBody = "HEALTHY",
                    StatusCode = "200",
                },
                Type = "fixed-response",
            },
        },
        Conditions = 
        {
            new Aws.LB.Inputs.ListenerRuleConditionArgs
            {
                QueryString = 
                {

                    {
                        { "key", "health" },
                        { "value", "check" },
                    },

                    {
                        { "value", "bar" },
                    },
                },
            },
        },
        ListenerArn = frontEndListener.Arn,
    });
    var pool = new Aws.Cognito.UserPool("pool", new Aws.Cognito.UserPoolArgs
    {
    });
    var client = new Aws.Cognito.UserPoolClient("client", new Aws.Cognito.UserPoolClientArgs
    {
    });
    var domain = new Aws.Cognito.UserPoolDomain("domain", new Aws.Cognito.UserPoolDomainArgs
    {
    });
    var admin = new Aws.LB.ListenerRule("admin", new Aws.LB.ListenerRuleArgs
    {
        Actions = 
        {
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                AuthenticateOidc = new Aws.LB.Inputs.ListenerRuleActionAuthenticateOidcArgs
                {
                    AuthorizationEndpoint = "https://example.com/authorization_endpoint",
                    ClientId = "client_id",
                    ClientSecret = "client_secret",
                    Issuer = "https://example.com",
                    TokenEndpoint = "https://example.com/token_endpoint",
                    UserInfoEndpoint = "https://example.com/user_info_endpoint",
                },
                Type = "authenticate-oidc",
            },
            new Aws.LB.Inputs.ListenerRuleActionArgs
            {
                TargetGroupArn = aws_lb_target_group.Static.Arn,
                Type = "forward",
            },
        },
        ListenerArn = frontEndListener.Arn,
    });
}

}
Inheritance
System.Object
Resource
CustomResource
ListenerRule
Inherited Members
CustomResource.Id
Resource.GetResourceType()
Resource.GetResourceName()
Resource.Urn
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Pulumi.Aws.ApplicationLoadBalancing
Assembly: Pulumi.Aws.dll
Syntax
[Obsolete("aws.applicationloadbalancing.ListenerRule has been deprecated in favor of aws.alb.ListenerRule")]
public class ListenerRule : CustomResource

Constructors

View Source

ListenerRule(String, ListenerRuleArgs, CustomResourceOptions)

Create a ListenerRule resource with the given unique name, arguments, and options.

Declaration
public ListenerRule(string name, ListenerRuleArgs args, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resource

ListenerRuleArgs args

The arguments used to populate this resource's properties

CustomResourceOptions options

A bag of options that control this resource's behavior

Properties

View Source

Actions

An Action block. Action blocks are documented below.

Declaration
public Output<ImmutableArray<ListenerRuleAction>> Actions { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ListenerRuleAction>>
View Source

Arn

The ARN of the rule (matches id)

Declaration
public Output<string> Arn { get; }
Property Value
Type Description
Output<System.String>
View Source

Conditions

A Condition block. Multiple condition blocks of different types can be set and all must be satisfied for the rule to match. Condition blocks are documented below.

Declaration
public Output<ImmutableArray<ListenerRuleCondition>> Conditions { get; }
Property Value
Type Description
Output<System.Collections.Immutable.ImmutableArray<ListenerRuleCondition>>
View Source

ListenerArn

The ARN of the listener to which to attach the rule.

Declaration
public Output<string> ListenerArn { get; }
Property Value
Type Description
Output<System.String>
View Source

Priority

The priority for the rule between 1 and 50000. Leaving it unset will automatically set the rule with next available priority after currently existing highest rule. A listener can't have multiple rules with the same priority.

Declaration
public Output<int> Priority { get; }
Property Value
Type Description
Output<System.Int32>

Methods

View Source

Get(String, Input<String>, ListenerRuleState, CustomResourceOptions)

Get an existing ListenerRule resource's state with the given name, ID, and optional extra properties used to qualify the lookup.

Declaration
public static ListenerRule Get(string name, Input<string> id, ListenerRuleState state = null, CustomResourceOptions options = null)
Parameters
Type Name Description
System.String name

The unique name of the resulting resource.

Input<System.String> id

The unique provider ID of the resource to lookup.

ListenerRuleState state

Any extra arguments used during the lookup.

CustomResourceOptions options

A bag of options that control this resource's behavior

Returns
Type Description
ListenerRule
  • View Source
Back to top Copyright 2016-2020, Pulumi Corporation.