Fix error handling.
AWS returns IncorrectState not DependencyViolation when a VPN gateway is still attached to a VPC.
This commit is contained in:
parent
d253fff4e5
commit
c172fd3736
|
@ -128,7 +128,7 @@ func resourceAwsVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2err, ok := err.(*aws.APIError)
|
ec2err, ok := err.(aws.APIError)
|
||||||
if !ok {
|
if !ok {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ func resourceAwsVpnGatewayDelete(d *schema.ResourceData, meta interface{}) error
|
||||||
switch ec2err.Code {
|
switch ec2err.Code {
|
||||||
case "InvalidVpnGatewayID.NotFound":
|
case "InvalidVpnGatewayID.NotFound":
|
||||||
return nil
|
return nil
|
||||||
case "DependencyViolation":
|
case "IncorrectState":
|
||||||
return err // retry
|
return err // retry
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ func resourceAwsVpnGatewayDetach(d *schema.ResourceData, meta interface{}) error
|
||||||
VPCID: aws.String(d.Get("vpc_id").(string)),
|
VPCID: aws.String(d.Get("vpc_id").(string)),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ec2err, ok := err.(*aws.APIError)
|
ec2err, ok := err.(aws.APIError)
|
||||||
if ok {
|
if ok {
|
||||||
if ec2err.Code == "InvalidVpnGatewayID.NotFound" {
|
if ec2err.Code == "InvalidVpnGatewayID.NotFound" {
|
||||||
err = nil
|
err = nil
|
||||||
|
|
Loading…
Reference in New Issue