provider/aws: Retry EIP association (#7186)
This commit is contained in:
parent
5fdcf5d16a
commit
24bcac42be
|
@ -208,8 +208,20 @@ func resourceAwsEipUpdate(d *schema.ResourceData, meta interface{}) error {
|
|||
}
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] EIP associate configuration: %#v (domain: %v)", assocOpts, domain)
|
||||
_, err := ec2conn.AssociateAddress(assocOpts)
|
||||
log.Printf("[DEBUG] EIP associate configuration: %s (domain: %s)", assocOpts, domain)
|
||||
|
||||
err := resource.Retry(1*time.Minute, func() *resource.RetryError {
|
||||
_, err := ec2conn.AssociateAddress(assocOpts)
|
||||
if err != nil {
|
||||
if awsErr, ok := err.(awserr.Error); ok {
|
||||
if awsErr.Code() == "InvalidAllocationID.NotFound" {
|
||||
return resource.RetryableError(awsErr)
|
||||
}
|
||||
}
|
||||
return resource.NonRetryableError(err)
|
||||
}
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
// Prevent saving instance if association failed
|
||||
// e.g. missing internet gateway in VPC
|
||||
|
|
Loading…
Reference in New Issue