Merge pull request #8689 from erutherford/master
adding missing failed states for the NAT Gateways
This commit is contained in:
commit
91ade752a0
|
@ -101,7 +101,14 @@ func resourceAwsNatGatewayRead(d *schema.ResourceData, meta interface{}) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if ngRaw == nil || strings.ToLower(state) == "deleted" {
|
|
||||||
|
status := map[string]bool{
|
||||||
|
"deleted": true,
|
||||||
|
"deleting": true,
|
||||||
|
"failed": true,
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, ok := status[strings.ToLower(state)]; ngRaw == nil || ok {
|
||||||
log.Printf("[INFO] Removing %s from Terraform state as it is not found or in the deleted state.", d.Id())
|
log.Printf("[INFO] Removing %s from Terraform state as it is not found or in the deleted state.", d.Id())
|
||||||
d.SetId("")
|
d.SetId("")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -44,7 +44,12 @@ func testAccCheckNatGatewayDestroy(s *terraform.State) error {
|
||||||
NatGatewayIds: []*string{aws.String(rs.Primary.ID)},
|
NatGatewayIds: []*string{aws.String(rs.Primary.ID)},
|
||||||
})
|
})
|
||||||
if err == nil {
|
if err == nil {
|
||||||
if len(resp.NatGateways) > 0 && strings.ToLower(*resp.NatGateways[0].State) != "deleted" {
|
status := map[string]bool{
|
||||||
|
"deleted": true,
|
||||||
|
"deleting": true,
|
||||||
|
"failed": true,
|
||||||
|
}
|
||||||
|
if _, ok := status[strings.ToLower(*resp.NatGateways[0].State)]; len(resp.NatGateways) > 0 && !ok {
|
||||||
return fmt.Errorf("still exists")
|
return fmt.Errorf("still exists")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue