Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
Adds VPC Gateway Attachment dependency to ELB
Browse files Browse the repository at this point in the history
If the ELB is internet facing, it requires a VPCGatewayAttachment so
that it can retrieve a public IP from the Internet Gateway. This change
adds a DependsOn dependency for every ELB with scheme internet-facing
so that when the stack gets deleted the ELB gets deleted before the
VPCGatewayAttachment resources.
  • Loading branch information
filipposc5 committed Jul 1, 2016
1 parent ba6ecdc commit db62f5e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bootstrap_cfn/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,17 @@ def elb(self, template):
),
Policies=elb_policies
)

if elb['scheme'] == 'internet-facing':
vpc_gw_att = [
r.title
for r in self._find_resources(
template, "AWS::EC2::VPCGatewayAttachment")]
# if a VPCGatewayAttachment exists in template make the ELB depend on it
# because ELB is public/internet facing and needs Internet Gateway
if vpc_gw_att:
load_balancer.DependsOn = vpc_gw_att

if "health_check" in elb:
load_balancer.HealthCheck = HealthCheck(**elb['health_check'])

Expand Down

0 comments on commit db62f5e

Please sign in to comment.