Skip to content

Commit b73ad0d

Browse files
committed
Fix deletion for appliance_traffic_shaping_vpn_exclusions
Do a PUT with all fields ("custom" and "majorApplications") set to `[]`.
1 parent 0bc6850 commit b73ad0d

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ attributes:
2222
type: List
2323
description: Custom VPN exclusion rules. Pass an empty array to clear existing rules.
2424
ordered_list: true
25+
destroy_value: '[]interface{}{}'
2526
attributes:
2627
- model_name: destination
2728
type: String
@@ -40,6 +41,7 @@ attributes:
4041
- model_name: majorApplications
4142
type: List
4243
description: Major Application based VPN exclusion rules. Pass an empty array to clear existing rules.
44+
destroy_value: '[]interface{}{}'
4345
attributes:
4446
- model_name: id
4547
type: String

internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,8 @@ func (data *ApplianceTrafficShapingVPNExclusions) fromBodyUnknowns(ctx context.C
252252

253253
func (data ApplianceTrafficShapingVPNExclusions) toDestroyBody(ctx context.Context) string {
254254
body := ""
255+
body, _ = sjson.Set(body, "custom", []interface{}{})
256+
body, _ = sjson.Set(body, "majorApplications", []interface{}{})
255257
return body
256258
}
257259

internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,12 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Delete(ctx context.Contex
275275
}
276276

277277
tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString()))
278+
body := state.toDestroyBody(ctx)
279+
res, err := r.client.Put(state.getPath(), body)
280+
if err != nil {
281+
resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String()))
282+
return
283+
}
278284

279285
tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString()))
280286

0 commit comments

Comments
 (0)