provider/aws: `aws_customer_gateway` refreshing from state on deleted (#7482)

state

Fixes #7136
This commit is contained in:
Paul Stack 2016-07-05 16:34:06 +01:00 committed by GitHub
parent b36c6fceb0
commit d60594695f
1 changed files with 6 additions and 0 deletions

View File

@ -148,6 +148,12 @@ func resourceAwsCustomerGatewayRead(d *schema.ResourceData, meta interface{}) er
return fmt.Errorf("[ERROR] Error finding CustomerGateway: %s", d.Id())
}
if *resp.CustomerGateways[0].State == "deleted" {
log.Printf("[INFO] Customer Gateway is in `deleted` state: %s", d.Id())
d.SetId("")
return nil
}
customerGateway := resp.CustomerGateways[0]
d.Set("ip_address", customerGateway.IpAddress)
d.Set("type", customerGateway.Type)