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