Error with "AWS::ElasticLoadBalancingV2::ListenerRule"

0

I am trying to attach a listener rule to the listener using CFT. Here is my code

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "The template for application load balancer.",
  "Parameters": {
    "targetGroupArn": {
      "Type": "String"
    },
    "albListenerArn": {
      "Type": "String"
    },
    "priority": {
      "Type": "Number"
    }
  },
  "Resources": {
    "listenerRule": {
      "Type": "AWS::ElasticLoadBalancingV2::ListenerRule",
      "Properties": {
        "Actions": [
          {
            "TargetGroupArn": {
              "Ref": "targetGroupArn"
            },
            "Type": "forward"
          }
        ],
        "Conditions": [
          {
            "Field": "path-pattern",
            "PathPatternConfig": {
              "Values": [
                "/test/*"
              ]
            }
          }
        ],
        "ListenerArn": {
          "Ref": "albListenerArn"
        },
        "Priority": {
          "Ref": "priority"
        }
      }
    }
  },
  "Outputs": {
    "arn": {
      "Description": "The ARN of the listenerRule.",
      "Value": {
        "Ref": "listenerRule"
      }
    },
    "IsDefault": {
      "Description": "Indicates whether this is the default rule.",
      "Value": {
        "Fn::GetAtt": [
          "listenerRule",
          "IsDefault"
        ]
      }
    }
  }
}

Error which I am receiving is Resource handler returned message: "Invalid request provided: AWS::ElasticLoadBalancingV2::ListenerRule Validation exception" (RequestToken: d2fc5cc4-3sdsdsda6b-8b46ad61dde, HandlerErrorCode: InvalidRequest)

Please help with this

asked 6 months ago384 views
1 Answer
0

Template looks ok but as this is not including the loadbalancer and potentially other rules there are, it can be there is some conflicting rules already present at the loadbalancer. Have you verified there isn't already a rule with same priority that you are using?

profile picture
EXPERT
Kallu
answered 6 months ago
  • Currently there is only default one and there is no other policy. This is the template for alb.

    { "AWSTemplateFormatVersion": "2010-09-09", "Description": "The template for application load balancer.", "Parameters": { "securityGroupIDs": { "Type": "CommaDelimitedList" }, "subnetIDs": { "Type": "CommaDelimitedList" }, "loadBalancerName": { "Type": "String" }, "targetGroupArn": { "Type": "String" } }, "Resources": { "loadBalancer": { "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", "Properties": { "IpAddressType" : "ipv4", "Type": "application", "Name": { "Ref": "loadBalancerName" }, "SecurityGroups": { "Ref": "securityGroupIDs" }, "Subnets": { "Ref": "subnetIDs" }, "Scheme": "internal" } }, "listener": { "Type": "AWS::ElasticLoadBalancingV2::Listener", "Properties": { "DefaultActions": [ { "Type": "forward", "TargetGroupArn": { "Ref": "targetGroupArn" } } ], "LoadBalancerArn": { "Ref": "loadBalancer" }, "Port": 80, "Protocol": "HTTP" } } },

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions