Skip to content

Commit

Permalink
Move pre_delete code closer to the request (GoogleCloudPlatform#10143)
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson authored Mar 8, 2024
1 parent 331569f commit b3dd247
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mmv1/templates/terraform/resource.erb
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,6 @@ func resource<%= object.resource_name -%>Delete(d *schema.ResourceData, meta int
<%# If the deletion of the object requires sending a request body, the custom code will set 'obj' -%>
var obj map[string]interface{}
<%= lines(compile(pwd + '/' + object.custom_code.pre_delete)) if object.custom_code.pre_delete -%>
<% if object.nested_query&.modify_by_patch -%>
<%# Keep this after mutex - patch request data relies on current resource state %>
obj, err = resource<%= object.resource_name -%>PatchDeleteEncoder(d, meta, obj)
Expand All @@ -1057,6 +1056,8 @@ func resource<%= object.resource_name -%>Delete(d *schema.ResourceData, meta int
billingProject = bp
}
<%= lines(compile(pwd + '/' + object.custom_code.pre_delete)) if object.custom_code.pre_delete -%>
log.Printf("[DEBUG] Deleting <%= object.name -%> %q", d.Id())
res, err := transport_tpg.SendRequest(transport_tpg.SendRequestOptions{
Config: config,
Expand Down

0 comments on commit b3dd247

Please sign in to comment.