Skip to content

Commit

Permalink
Don't add method condition for ANY
Browse files Browse the repository at this point in the history
  • Loading branch information
gordon-klotho committed Feb 14, 2023
1 parent 28ca217 commit 177462d
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions pkg/infra/pulumi_aws/iac/load_balancing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,23 @@ export class LoadBalancerPlugin {
})
}

const listenConditions: pulumi.Unwrap<ListenerRuleArgs['conditions']> = [
{
pathPattern: {
values: [
this.subPathParametersForWildcard(route.path),
`${this.subPathParametersForWildcard(route.path)}/`,
],
},
},
]
if (route.verb.toUpperCase() != 'ANY') {
listenConditions.push({
httpRequestMethod: {
values: [route.verb.toUpperCase()],
},
})
}
this.createListenerRule(this.lib.name, route.execUnitName + route.path + route.verb, {
listenerArn: listener!.arn,
actions: [
Expand All @@ -138,21 +155,7 @@ export class LoadBalancerPlugin {
targetGroupArn: targetGroup.arn,
},
],
conditions: [
{
pathPattern: {
values: [
this.subPathParametersForWildcard(route.path),
`${this.subPathParametersForWildcard(route.path)}/`,
],
},
},
{
httpRequestMethod: {
values: [route.verb.toUpperCase()],
},
},
],
conditions: listenConditions,
})
}
return alb.dnsName
Expand Down

0 comments on commit 177462d

Please sign in to comment.