diff --git a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl index b2eb939c523c..c1ec2ba712d3 100644 --- a/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl +++ b/mmv1/templates/terraform/custom_check_destroy/firestore_field.go.tmpl @@ -23,6 +23,10 @@ if err != nil { // We do not return the error in this case - destroy was successful return nil } + if e.Code == 404 && regexp.MustCompile(`Project .* or database .* does not exist`).MatchString(e.Message) { + // The project or database does not exist, which means the resource is destroyed. + return nil + } // Return err in all other cases return err diff --git a/mmv1/templates/terraform/samples/base_configs/test_file.go.tmpl b/mmv1/templates/terraform/samples/base_configs/test_file.go.tmpl index 86a7d2524c6b..9cca626dea12 100644 --- a/mmv1/templates/terraform/samples/base_configs/test_file.go.tmpl +++ b/mmv1/templates/terraform/samples/base_configs/test_file.go.tmpl @@ -28,6 +28,7 @@ package {{ $.Res.PackageName }}_test import ( "fmt" "log" + "regexp" "strconv" "strings" "testing" @@ -59,6 +60,7 @@ import ( var ( _ = fmt.Sprintf _ = log.Print + _ = regexp.MatchString _ = strconv.Atoi _ = strings.Trim _ = time.Now