From 4b47d2656fdb651ba7ea85a1cb3dd6042f067081 Mon Sep 17 00:00:00 2001 From: The Magician Date: Tue, 12 May 2020 14:40:15 -0400 Subject: [PATCH] report bucket name when not empty while deleting (#3501) (#6355) Signed-off-by: Modular Magician --- .changelog/3501.txt | 3 +++ google/resource_storage_bucket.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changelog/3501.txt diff --git a/.changelog/3501.txt b/.changelog/3501.txt new file mode 100644 index 00000000000..9754bf4e7ca --- /dev/null +++ b/.changelog/3501.txt @@ -0,0 +1,3 @@ +```release-note:enhancement +storage: added `google_storage_bucket` bucket name to the error message when the bucket can't be deleted because it's not empty +``` diff --git a/google/resource_storage_bucket.go b/google/resource_storage_bucket.go index 7cd63c830d5..bf9e8e29550 100644 --- a/google/resource_storage_bucket.go +++ b/google/resource_storage_bucket.go @@ -645,7 +645,7 @@ func resourceStorageBucketDelete(d *schema.ResourceData, meta interface{}) error } if !d.Get("force_destroy").(bool) { - deleteErr := errors.New("Error trying to delete a bucket containing objects without `force_destroy` set to true") + deleteErr := fmt.Errorf("Error trying to delete bucket %s containing objects without `force_destroy` set to true", bucket) log.Printf("Error! %s : %s\n\n", bucket, deleteErr) return deleteErr }