@@ -232,18 +232,28 @@ func (i *AWSInfrastructure) CreateInfrastructure() AWSInfrastructure {
232
232
}
233
233
time .Sleep (1 * time .Second )
234
234
}
235
+ i .CreateInternetGateway ()
235
236
}
236
- i .CreateInternetGateway ()
237
237
i .AllocateAddress ()
238
238
i .CreateNatGateway ("public" )
239
- WaitForNatGatewayState (i .Context , * i .NatGateway .NatGatewayId , 180 , "available" )
239
+ if i .NatGateway != nil && i .NatGateway .NatGatewayId != nil {
240
+ WaitForNatGatewayState (i .Context , * i .NatGateway .NatGatewayId , 180 , "available" )
241
+ }
240
242
if len (i .Subnets ) == 2 {
241
243
i .CreateRouteTable ("public" )
242
244
i .CreateRouteTable ("private" )
243
- CreateRoute (i .Context , * i .State .PublicRouteTableID , "0.0.0.0/0" , nil , i .InternetGateway .InternetGatewayId , nil )
244
- CreateRoute (i .Context , * i .State .PrivateRouteTableID , "0.0.0.0/0" , i .NatGateway .NatGatewayId , nil , nil )
245
- i .GetRouteTable (* i .State .PublicRouteTableID )
246
- i .GetRouteTable (* i .State .PrivateRouteTableID )
245
+ if i .InternetGateway != nil && i .InternetGateway .InternetGatewayId != nil {
246
+ CreateRoute (i .Context , * i .State .PublicRouteTableID , "0.0.0.0/0" , nil , i .InternetGateway .InternetGatewayId , nil )
247
+ }
248
+ if i .NatGateway != nil && i .NatGateway .NatGatewayId != nil {
249
+ CreateRoute (i .Context , * i .State .PrivateRouteTableID , "0.0.0.0/0" , i .NatGateway .NatGatewayId , nil , nil )
250
+ }
251
+ if i .State .PublicRouteTableID != nil {
252
+ i .GetRouteTable (* i .State .PublicRouteTableID )
253
+ }
254
+ if i .State .PrivateRouteTableID != nil {
255
+ i .GetRouteTable (* i .State .PrivateRouteTableID )
256
+ }
247
257
}
248
258
return * i
249
259
}
0 commit comments