Skip to content

Commit 4f4c97f

Browse files
authored
Merge pull request #7 from theonestack/feature/alb-target
adds alb as a target group option
2 parents 190c062 + a669e79 commit 4f4c97f

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

network-loadbalancer.cfhighlander.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
ComponentParam 'SubnetIds', type: 'CommaDelimitedList'
1818
ComponentParam 'SecurityGroupIds', type: 'CommaDelimitedList'
1919
ComponentParam 'VPCId', type: 'AWS::EC2::VPC::Id'
20+
2021
end
2122

2223
end

network-loadbalancer.cfndsl.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,13 @@
6161
Targets (params['target_ips'].map {|ip| { 'Id' => ip['ip'], 'Port' => ip['port'], 'AvailabilityZone' => ip['az']? ip['az'] : nil }.compact})
6262
end
6363

64+
if params.has_key?('type') and params['type'] == 'alb' and params.has_key? 'alb_arn'
65+
Targets [{
66+
Id: params['alb_arn'],
67+
Port: params['port']
68+
}]
69+
end
70+
6471
if params.has_key?('attributes')
6572
TargetGroupAttributes params['attributes'].map { |key,value| { Key: key, Value: value } }
6673
end

tests/alb_target.test.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
test_metadata:
2+
type: config
3+
name: alb_target
4+
description: test specifying an ALB as a target
5+
6+
loadbalancer_scheme: public
7+
8+
loadbalancer_tags:
9+
Name: alb-proxy
10+
11+
records:
12+
- albproxy
13+
14+
targetgroups:
15+
alb:
16+
protocol: tcp
17+
port: 443
18+
type: alb
19+
tags:
20+
Name: ALB-TG
21+
healthcheck:
22+
HealthCheckPort: "traffic-port"
23+
protocol: TCP
24+
alb_arn:
25+
Ref: ALBArn
26+
27+
listeners:
28+
alb:
29+
port: 443
30+
protocol: tcp
31+
targetgroup: alb

0 commit comments

Comments
 (0)