diff --git a/bootstrap_cfn/config.py b/bootstrap_cfn/config.py index 42273fc..1ac2647 100644 --- a/bootstrap_cfn/config.py +++ b/bootstrap_cfn/config.py @@ -535,7 +535,7 @@ def rds(self, template): AutoMinorVersionUpgrade=False, VPCSecurityGroups=[GetAtt(database_sg, "GroupId")], DBSubnetGroupName=Ref(rds_subnet_group), - DependsOn=database_sg.title + DependsOn=["AttachGateway", database_sg.title], ) resources.append(rds_instance) @@ -738,7 +738,8 @@ def elb(self, template): Enabled=True, Timeout=120, ), - Policies=elb_policies + Policies=elb_policies, + DependsOn=["AttachGateway"], ) if "health_check" in elb: load_balancer.HealthCheck = HealthCheck(**elb['health_check']) @@ -1112,6 +1113,7 @@ def ec2(self): LaunchConfigurationName=Ref(launch_config), HealthCheckGracePeriod=health_check_grace_period, HealthCheckType=health_check_type, + DependsOn=["AttachGateway"], ) resources.append(scaling_group) diff --git a/tests/tests.py b/tests/tests.py index 9c5dbbd..460bea9 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -312,7 +312,7 @@ def test_rds(self): db_subnet.SubnetIds = [Ref('SubnetA'), Ref('SubnetB'), Ref('SubnetC')] db_subnet.DBSubnetGroupDescription = 'VPC Subnets' - db_instance = rds.DBInstance('RDSInstance', DependsOn=db_sg.title) + db_instance = rds.DBInstance('RDSInstance', DependsOn=["AttachGateway", db_sg.title]) db_instance.MultiAZ = False db_instance.MasterUsername = 'testuser' db_instance.MasterUserPassword = 'testpassword' @@ -457,7 +457,8 @@ def test_elb(self): PolicyType='SSLNegotiationPolicyType', PolicyName='PinDownSSLNegotiationPolicy201505' ) - ] + ], + DependsOn=["AttachGateway"], ) pt1 = PolicyType( @@ -566,6 +567,7 @@ def test_elb(self): PolicyName='PinDownSSLNegotiationPolicy201505' ) ], + DependsOn=["AttachGateway"], ) known_load_balancer_resources = [lb, lb2] known_policy_type_resources = [pt1, pt2] @@ -986,6 +988,7 @@ def test_elb_with_ssl(self): PolicyName='PinDownSSLNegotiationPolicy201505' ) ], + DependsOn=["AttachGateway"], ) Policydockerregistryservice = PolicyType( @@ -1110,6 +1113,7 @@ def test_elb_with_healthcheck(self): PolicyName='PinDownSSLNegotiationPolicy201505' ) ], + DependsOn=["AttachGateway"], ) Policydockerregistryservice = PolicyType( @@ -1213,6 +1217,7 @@ def test_elb_with_reserved_chars(self): PolicyName='PinDownSSLNegotiationPolicy201505' ) ], + DependsOn=["AttachGateway"], ) DNSdevdockerregistryservice = RecordSetGroup( @@ -1321,7 +1326,8 @@ def test_ec2(self): LaunchConfigurationName=Ref("BaseHostLaunchConfig"), AvailabilityZones=GetAZs(""), HealthCheckGracePeriod=300, - HealthCheckType='EC2' + HealthCheckType='EC2', + DependsOn=["AttachGateway"], ) BaseHostSG = SecurityGroup(