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
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" } } },