From fed666a5b67d75c11ff2799eeb7f8fa39259c133 Mon Sep 17 00:00:00 2001 From: James Nugent Date: Mon, 21 Mar 2016 14:25:11 +0000 Subject: [PATCH] provider/digitalocean: Check for nil response This applies the same fix to `digitalocean_ssh_key` as #5588 applies to droplets. Fixes #5402. The report there gives weight to my theory that this occurs when there are transport issues. --- builtin/providers/digitalocean/resource_digitalocean_ssh_key.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go b/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go index 79614f5999..094df96dd5 100644 --- a/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go +++ b/builtin/providers/digitalocean/resource_digitalocean_ssh_key.go @@ -74,7 +74,7 @@ func resourceDigitalOceanSSHKeyRead(d *schema.ResourceData, meta interface{}) er if err != nil { // If the key is somehow already destroyed, mark as // successfully gone - if resp.StatusCode == 404 { + if resp != nil && resp.StatusCode == 404 { d.SetId("") return nil }