File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -165,9 +165,14 @@ func (i *AWSInfrastructure) AllocateAddress() AWSInfrastructure {
165
165
return * i
166
166
}
167
167
168
- if addr , _ := GetAddress (i .Context , * aa .AllocationId ); addr != nil {
169
- i .ElasticIP = addr
168
+ t := 0
169
+ addr , _ := GetAddress (i .Context , * aa .AllocationId )
170
+ for addr == nil || t < 180 {
171
+ time .Sleep (1 * time .Second )
172
+ addr , _ = GetAddress (i .Context , * aa .AllocationId )
173
+ t ++
170
174
}
175
+ i .ElasticIP = addr
171
176
return * i
172
177
}
173
178
@@ -236,9 +241,11 @@ func (i *AWSInfrastructure) CreateInfrastructure() AWSInfrastructure {
236
241
i .CreateInternetGateway ()
237
242
}
238
243
i .AllocateAddress ()
239
- i .CreateNatGateway ("public" )
240
- if i .NatGateway != nil && i .NatGateway .NatGatewayId != nil {
241
- WaitForNatGatewayState (i .Context , * i .NatGateway .NatGatewayId , 180 , "available" )
244
+ if i .ElasticIP != nil && i .ElasticIP .AllocationId != nil {
245
+ i .CreateNatGateway ("public" )
246
+ if i .NatGateway != nil && i .NatGateway .NatGatewayId != nil {
247
+ WaitForNatGatewayState (i .Context , * i .NatGateway .NatGatewayId , 180 , "available" )
248
+ }
242
249
}
243
250
if len (i .Subnets ) == 2 {
244
251
i .CreateRouteTable ("public" )
You can’t perform that action at this time.
0 commit comments