provider/aws: retry VGW connection a bit due to eventual consistency
This commit is contained in:
parent
f2ddb53c8f
commit
5d12c79d90
|
@ -210,11 +210,26 @@ func resourceAwsRouteTableUpdate(d *schema.ResourceData, meta interface{}) error
|
||||||
for _, vgw := range add {
|
for _, vgw := range add {
|
||||||
id := vgw.(string)
|
id := vgw.(string)
|
||||||
|
|
||||||
log.Printf("[INFO] Enabling VGW propagation for %s: %s", d.Id(), id)
|
var err error
|
||||||
_, err := conn.EnableVGWRoutePropagation(&ec2.EnableVGWRoutePropagationInput{
|
for i := 0; i < 5; i++ {
|
||||||
RouteTableID: aws.String(d.Id()),
|
log.Printf("[INFO] Enabling VGW propagation for %s: %s", d.Id(), id)
|
||||||
GatewayID: aws.String(id),
|
_, err = conn.EnableVGWRoutePropagation(&ec2.EnableVGWRoutePropagationInput{
|
||||||
})
|
RouteTableID: aws.String(d.Id()),
|
||||||
|
GatewayID: aws.String(id),
|
||||||
|
})
|
||||||
|
if err == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we get a Gateway.NotAttached, it is usually some
|
||||||
|
// eventually consistency stuff. So we have to just wait a
|
||||||
|
// bit...
|
||||||
|
ec2err, ok := err.(aws.APIError)
|
||||||
|
if ok && ec2err.Code == "Gateway.NotAttached" {
|
||||||
|
time.Sleep(20 * time.Second)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue