Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: fourTheorem/slic-watch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.3.1-rc4
Choose a base ref
...
head repository: fourTheorem/slic-watch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Nov 12, 2024

  1. fix(alb): allow actions with no TargetGroup

    eoinsha committed Nov 12, 2024
    Copy the full SHA
    3963629 View commit details
  2. Merge pull request #123 from fourTheorem/fix/allow-alb-no-tg-ref

    fix(alb): allow actions with no TargetGroup
    eoinsha authored Nov 12, 2024
    Copy the full SHA
    d532930 View commit details
Showing with 25 additions and 1 deletion.
  1. +1 −1 core/alarms/alb-target-group.ts
  2. +24 −0 core/alarms/tests/alb-target-group.test.ts
2 changes: 1 addition & 1 deletion core/alarms/alb-target-group.ts
Original file line number Diff line number Diff line change
@@ -55,7 +55,7 @@ export function findLoadBalancersForTargetGroup (targetGroupLogicalId: string, c
for (const [listenerRuleLogicalId, listenerRule] of Object.entries(listenerRuleResources)) {
for (const action of listenerRule.Properties?.Actions ?? []) {
const targetGroupArn = action.TargetGroupArn
if (targetGroupArn.Ref === targetGroupLogicalId) {
if (typeof targetGroupArn === 'object' && targetGroupArn.Ref === targetGroupLogicalId) {
allListenerRules[listenerRuleLogicalId] = listenerRule
break
}
24 changes: 24 additions & 0 deletions core/alarms/tests/alb-target-group.test.ts
Original file line number Diff line number Diff line change
@@ -79,6 +79,7 @@ test('findLoadBalancersForTargetGroup', (t) => {
t.equal(loadBalancerLogicalIds.length, 0)
t.end()
})

test('finds load balancers through listener rule target groups', (t) => {
const compiledTemplate = {
Resources: {
@@ -189,6 +190,29 @@ test('findLoadBalancersForTargetGroup', (t) => {
t.end()
})

test('handles actions without a target group', (t) => {
const compiledTemplate = {
Resources: {
listenerRuleA: {
Type: 'AWS::ElasticLoadBalancingV2::ListenerRule',
Properties: {
Actions: [{ AuthenticateOidcConfig: {} }],
ListenerArn: { Ref: 'listener' }
}
},
listener: {
Type: 'AWS::ElasticLoadBalancingV2::Listener',
Properties: {
LoadBalancerArn: 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188'
}
}
}
}
const loadBalancerLogicalIds = findLoadBalancersForTargetGroup('tgA', compiledTemplate)
t.equal(loadBalancerLogicalIds.length, 0)
t.end()
})

test('ALB Target Group alarms are created', (t) => {
const testConfig = createTestConfig(
defaultConfig.alarms,