From 50ee426b7258f5d0f2338483706757b606036c5c Mon Sep 17 00:00:00 2001 From: Paddy Date: Thu, 16 Feb 2017 02:36:03 -0800 Subject: [PATCH] Check for errors when deleting project metadata. Our delete operation for google_compute_project_metadata didn't check an error when making the call to delete metadata, which led to a panic in our tests. This is also probably indicative of why our tests failed/metadata got left dangling. --- builtin/providers/google/resource_compute_project_metadata.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/builtin/providers/google/resource_compute_project_metadata.go b/builtin/providers/google/resource_compute_project_metadata.go index ea8a51281..6b867e1ad 100644 --- a/builtin/providers/google/resource_compute_project_metadata.go +++ b/builtin/providers/google/resource_compute_project_metadata.go @@ -192,6 +192,10 @@ func resourceComputeProjectMetadataDelete(d *schema.ResourceData, meta interface op, err := config.clientCompute.Projects.SetCommonInstanceMetadata(projectID, md).Do() + if err != nil { + return fmt.Errorf("Error removing metadata from project %s: %s", projectID, err) + } + log.Printf("[DEBUG] SetCommonMetadata: %d (%s)", op.Id, op.SelfLink) err = computeOperationWaitGlobal(config, op, project.Name, "SetCommonMetadata")