diff --git a/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go b/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go index 21c93d33d..732b41622 100644 --- a/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go +++ b/builtin/providers/openstack/resource_openstack_fw_firewall_v1.go @@ -105,17 +105,9 @@ func resourceFWFirewallV1Read(d *schema.ResourceData, meta interface{}) error { } firewall, err := firewalls.Get(networkingClient, d.Id()).Extract() - if err != nil { - httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) - if !ok { - return err - } - if httpError.Actual == 404 { - d.SetId("") - return nil - } - return err + if err != nil { + return CheckDeleted(d, err, "LB pool") } if t, exists := d.GetOk("name"); exists && t != "" { diff --git a/builtin/providers/openstack/resource_openstack_fw_policy_v1.go b/builtin/providers/openstack/resource_openstack_fw_policy_v1.go index e9fc1645b..7837e5a43 100644 --- a/builtin/providers/openstack/resource_openstack_fw_policy_v1.go +++ b/builtin/providers/openstack/resource_openstack_fw_policy_v1.go @@ -119,15 +119,7 @@ func resourceFWPolicyV1Read(d *schema.ResourceData, meta interface{}) error { policy, err := policies.Get(networkingClient, d.Id()).Extract() if err != nil { - httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) - if !ok { - return err - } - if httpError.Actual == 404 { - d.SetId("") - return nil - } - return err + return CheckDeleted(d, err, "LB pool") } if t, exists := d.GetOk("name"); exists && t != "" { diff --git a/builtin/providers/openstack/resource_openstack_fw_rule_v1.go b/builtin/providers/openstack/resource_openstack_fw_rule_v1.go index bd418e9b8..607d02b21 100644 --- a/builtin/providers/openstack/resource_openstack_fw_rule_v1.go +++ b/builtin/providers/openstack/resource_openstack_fw_rule_v1.go @@ -5,7 +5,6 @@ import ( "log" "github.com/hashicorp/terraform/helper/schema" - "github.com/rackspace/gophercloud" "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/policies" "github.com/rackspace/gophercloud/openstack/networking/v2/extensions/fwaas/rules" ) @@ -126,15 +125,7 @@ func resourceFWRuleV1Read(d *schema.ResourceData, meta interface{}) error { rule, err := rules.Get(networkingClient, d.Id()).Extract() if err != nil { - httpError, ok := err.(*gophercloud.UnexpectedResponseCodeError) - if !ok { - return err - } - if httpError.Actual == 404 { - d.SetId("") - return nil - } - return err + return CheckDeleted(d, err, "LB pool") } d.Set("protocol", rule.Protocol)