From 564c9e79a0fd5d3716ae85b230ef481ce2e9bcc9 Mon Sep 17 00:00:00 2001 From: danischm Date: Sun, 14 Sep 2025 11:46:46 +0200 Subject: [PATCH 1/7] Initial commit --- ...pliance_firewall_multicast_forwarding.yaml | 2 +- ...liance_traffic_shaping_vpn_exclusions.yaml | 1 + .../wireless_air_marshal_settings.yaml | 2 +- .../wireless_location_scanning.yaml | 2 +- gen/definitions/wireless_zigbee.yaml | 2 +- gen/templates/resource.go | 27 ++++++++++- gen/yamlconfig/main.go | 6 +++ ...appliance_firewall_multicast_forwarding.go | 13 +----- ...ppliance_traffic_shaping_vpn_exclusions.go | 13 +----- ...ource_meraki_wireless_location_scanning.go | 13 +----- .../helpers/{flag.go => private_state.go} | 41 +++++++++++++++++ ...eraki_appliance_cellular_firewall_rules.go | 19 ++++++-- ...ce_connectivity_monitoring_destinations.go | 19 ++++++-- ...urce_meraki_appliance_content_filtering.go | 21 ++++++++- ...appliance_firewall_multicast_forwarding.go | 44 ++++++++++-------- ...urce_meraki_appliance_firewall_settings.go | 21 ++++++++- ...rce_meraki_appliance_firewalled_service.go | 21 ++++++++- ...pliance_inbound_cellular_firewall_rules.go | 19 ++++++-- ...meraki_appliance_inbound_firewall_rules.go | 19 ++++++-- ...urce_meraki_appliance_l3_firewall_rules.go | 19 ++++++-- ...urce_meraki_appliance_l7_firewall_rules.go | 19 ++++++-- ...ki_appliance_network_security_intrusion.go | 21 ++++++++- ..._meraki_appliance_one_to_many_nat_rules.go | 19 ++++++-- ...e_meraki_appliance_one_to_one_nat_rules.go | 19 ++++++-- ...pliance_organization_security_intrusion.go | 19 ++++++-- .../resource_meraki_appliance_port.go | 21 ++++++++- ..._meraki_appliance_port_forwarding_rules.go | 19 ++++++-- ...esource_meraki_appliance_radio_settings.go | 21 ++++++++- ...eraki_appliance_sdwan_internet_policies.go | 19 ++++++-- ...ource_meraki_appliance_security_malware.go | 21 ++++++++- .../resource_meraki_appliance_settings.go | 21 ++++++++- .../resource_meraki_appliance_single_lan.go | 21 ++++++++- ...ource_meraki_appliance_site_to_site_vpn.go | 21 ++++++++- .../resource_meraki_appliance_ssid.go | 21 ++++++++- ..._meraki_appliance_third_party_vpn_peers.go | 19 ++++++-- ...source_meraki_appliance_traffic_shaping.go | 21 ++++++++- ..._meraki_appliance_traffic_shaping_rules.go | 19 ++++++-- ...liance_traffic_shaping_uplink_bandwidth.go | 21 ++++++++- ...liance_traffic_shaping_uplink_selection.go | 10 +++- ...ppliance_traffic_shaping_vpn_exclusions.go | 44 ++++++++++-------- ...ource_meraki_appliance_uplinks_settings.go | 21 ++++++++- .../resource_meraki_appliance_vlan_dhcp.go | 11 +++++ ...esource_meraki_appliance_vlans_settings.go | 21 ++++++++- .../resource_meraki_appliance_vpn_bgp.go | 21 ++++++++- ...rce_meraki_appliance_vpn_firewall_rules.go | 19 ++++++-- ...iance_vpn_site_to_site_ipsec_peers_slas.go | 19 ++++++-- .../resource_meraki_appliance_warm_spare.go | 21 ++++++++- ...resource_meraki_camera_custom_analytics.go | 21 ++++++++- ..._meraki_camera_device_wireless_profiles.go | 21 ++++++++- ...esource_meraki_camera_quality_retention.go | 21 ++++++++- .../provider/resource_meraki_camera_sense.go | 21 ++++++++- .../resource_meraki_camera_video_settings.go | 21 ++++++++- ...ay_connectivity_monitoring_destinations.go | 19 ++++++-- .../resource_meraki_cellular_gateway_dhcp.go | 21 ++++++++- .../resource_meraki_cellular_gateway_lan.go | 19 ++++++-- ..._cellular_gateway_port_forwarding_rules.go | 19 ++++++-- ...rce_meraki_cellular_gateway_subnet_pool.go | 21 ++++++++- ...resource_meraki_cellular_gateway_uplink.go | 21 ++++++++- internal/provider/resource_meraki_device.go | 21 ++++++++- .../resource_meraki_device_cellular_sims.go | 21 ++++++++- ...urce_meraki_device_management_interface.go | 21 ++++++++- ...resource_meraki_network_alerts_settings.go | 21 ++++++++- .../resource_meraki_network_client_policy.go | 21 ++++++++- ...work_client_splash_authorization_status.go | 21 ++++++++- ...source_meraki_network_firmware_upgrades.go | 21 ++++++++- .../resource_meraki_network_netflow.go | 21 ++++++++- .../resource_meraki_network_settings.go | 21 ++++++++- .../provider/resource_meraki_network_snmp.go | 21 ++++++++- .../resource_meraki_network_syslog_servers.go | 19 ++++++-- ...esource_meraki_network_traffic_analysis.go | 21 ++++++++- ...i_organization_adaptive_policy_settings.go | 21 ++++++++- ...ganization_branding_policies_priorities.go | 21 ++++++++- .../resource_meraki_organization_license.go | 21 ++++++++- ...urce_meraki_organization_login_security.go | 21 ++++++++- .../resource_meraki_organization_saml.go | 21 ++++++++- .../resource_meraki_organization_snmp.go | 21 ++++++++- .../resource_meraki_sensor_mqtt_broker.go | 19 ++++++-- .../resource_meraki_sensor_relationships.go | 21 ++++++++- ...urce_meraki_switch_access_control_lists.go | 19 ++++++-- ...i_switch_alternate_management_interface.go | 21 ++++++++- ...source_meraki_switch_dhcp_server_policy.go | 21 ++++++++- ...urce_meraki_switch_dscp_to_cos_mappings.go | 19 ++++++-- .../provider/resource_meraki_switch_mtu.go | 21 ++++++++- .../provider/resource_meraki_switch_port.go | 19 ++++++-- .../resource_meraki_switch_qos_rule_order.go | 21 ++++++++- ...ce_meraki_switch_routing_interface_dhcp.go | 21 ++++++++- ...esource_meraki_switch_routing_multicast.go | 21 ++++++++- .../resource_meraki_switch_routing_ospf.go | 21 ++++++++- .../resource_meraki_switch_settings.go | 21 ++++++++- ...aki_switch_stack_routing_interface_dhcp.go | 21 ++++++++- .../resource_meraki_switch_storm_control.go | 21 ++++++++- .../provider/resource_meraki_switch_stp.go | 21 ++++++++- .../resource_meraki_switch_warm_spare.go | 21 ++++++++- ...ce_meraki_wireless_air_marshal_settings.go | 33 +++++++++++-- ...wireless_alternate_management_interface.go | 21 ++++++++- .../resource_meraki_wireless_billing.go | 21 ++++++++- ...raki_wireless_device_bluetooth_settings.go | 21 ++++++++- ..._wireless_device_electronic_shelf_label.go | 21 ++++++++- ...ource_meraki_wireless_location_scanning.go | 46 ++++++++++++------- ...aki_wireless_network_bluetooth_settings.go | 21 ++++++++- ...wireless_network_electronic_shelf_label.go | 21 ++++++++- ...resource_meraki_wireless_radio_settings.go | 21 ++++++++- .../resource_meraki_wireless_settings.go | 21 ++++++++- .../provider/resource_meraki_wireless_ssid.go | 19 ++++++-- ...meraki_wireless_ssid_bonjour_forwarding.go | 21 ++++++++- ...ireless_ssid_device_type_group_policies.go | 21 ++++++++- ...ource_meraki_wireless_ssid_eap_override.go | 21 ++++++++- ...esource_meraki_wireless_ssid_hotspot_20.go | 21 ++++++++- ..._meraki_wireless_ssid_l3_firewall_rules.go | 19 ++++++-- ..._meraki_wireless_ssid_l7_firewall_rules.go | 19 ++++++-- ...resource_meraki_wireless_ssid_schedules.go | 21 ++++++++- ...ce_meraki_wireless_ssid_splash_settings.go | 21 ++++++++- ...aki_wireless_ssid_traffic_shaping_rules.go | 19 ++++++-- .../resource_meraki_wireless_ssid_vpn.go | 21 ++++++++- .../resource_meraki_wireless_zigbee.go | 33 +++++++++++-- .../resource_meraki_wireless_zigbee_device.go | 21 ++++++++- ...source_meraki_wireless_zigbee_door_lock.go | 21 ++++++++- 117 files changed, 2113 insertions(+), 255 deletions(-) rename internal/provider/helpers/{flag.go => private_state.go} (57%) diff --git a/gen/definitions/appliance_firewall_multicast_forwarding.yaml b/gen/definitions/appliance_firewall_multicast_forwarding.yaml index 9d3ce558..f8d1b979 100644 --- a/gen/definitions/appliance_firewall_multicast_forwarding.yaml +++ b/gen/definitions/appliance_firewall_multicast_forwarding.yaml @@ -1,4 +1,4 @@ -# Customize Read() function to handle org level GET request +# Customize Create(), Read() function to handle org level GET request name: Appliance Firewall Multicast Forwarding spec_endpoint: /networks/{networkId}/appliance/firewall/multicastForwarding rest_endpoint: /networks/%v/appliance/firewall/multicastForwarding diff --git a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml index e82e7553..cabbeda7 100644 --- a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml +++ b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml @@ -1,3 +1,4 @@ +# Customize Create(), Read() to support org level endpoint name: Appliance Traffic Shaping VPN Exclusions spec_endpoint: /networks/{networkId}/appliance/trafficShaping/vpnExclusions rest_endpoint: /networks/%v/appliance/trafficShaping/vpnExclusions diff --git a/gen/definitions/wireless_air_marshal_settings.yaml b/gen/definitions/wireless_air_marshal_settings.yaml index e5dee055..9a381d82 100644 --- a/gen/definitions/wireless_air_marshal_settings.yaml +++ b/gen/definitions/wireless_air_marshal_settings.yaml @@ -1,4 +1,4 @@ -# Customize Read() to support org level endpoint +# Customize Create(), Read() to support org level endpoint name: Wireless Air Marshal Settings spec_endpoint: /networks/{networkId}/wireless/airMarshal/settings rest_endpoint: /networks/%v/wireless/airMarshal/settings diff --git a/gen/definitions/wireless_location_scanning.yaml b/gen/definitions/wireless_location_scanning.yaml index ae3b93b7..fa165738 100644 --- a/gen/definitions/wireless_location_scanning.yaml +++ b/gen/definitions/wireless_location_scanning.yaml @@ -1,4 +1,4 @@ -# Customize Read() function to handle org level GET request +# Customize Create(), Read() function to handle org level GET request name: Wireless Location Scanning spec_endpoint: /networks/{networkId}/wireless/location/scanning rest_endpoint: /networks/%v/wireless/location/scanning diff --git a/gen/definitions/wireless_zigbee.yaml b/gen/definitions/wireless_zigbee.yaml index d0bdf641..ea7623ae 100644 --- a/gen/definitions/wireless_zigbee.yaml +++ b/gen/definitions/wireless_zigbee.yaml @@ -1,4 +1,4 @@ -# Customize Read() to support org level endpoint +# Customize Create(), Read() to support org level endpoint # Test currently fails with "500 Internal Error", might require specific AP name: Wireless Zigbee spec_endpoint: /networks/{networkId}/wireless/zigbee diff --git a/gen/templates/resource.go b/gen/templates/resource.go index ed5e89c9..f7763e4c 100644 --- a/gen/templates/resource.go +++ b/gen/templates/resource.go @@ -410,7 +410,7 @@ func (r *{{camelCase .Name}}Resource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *{{camelCase .Name}}Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan {{camelCase .Name}} + var plan{{if isSingleton .}}, initialState{{end}} {{camelCase .Name}} // Read plan diags := req.Plan.Get(ctx, &plan) @@ -420,6 +420,17 @@ func (r *{{camelCase .Name}}Resource) Create(ctx context.Context, req resource.C tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + {{- if isSingleton .}} + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, {{camelCase .Name}}{}), resp.Private, &resp.Diagnostics) + {{- end}} + // Create object body := plan.toBody(ctx, {{camelCase .Name}}{}) @@ -568,7 +579,19 @@ func (r *{{camelCase .Name}}Resource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - {{- if hasDestroyValues .Attributes}} + {{- if isSingleton .}} + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } + {{- else if hasDestroyValues .Attributes}} body := state.toDestroyBody(ctx) res, err := r.client.Put(state.getPath(), body) if err != nil { diff --git a/gen/yamlconfig/main.go b/gen/yamlconfig/main.go index eb0da3c8..dade738f 100644 --- a/gen/yamlconfig/main.go +++ b/gen/yamlconfig/main.go @@ -534,6 +534,11 @@ func GetBulkItemIdTfName(config YamlConfig) string { return "id" } +// IsSingleton returns true if the resource is a singleton +func IsSingleton(config YamlConfig) bool { + return config.PutCreate && config.NoDelete +} + // Map of templating functions var Functions = template.FuncMap{ "toGoName": ToGoName, @@ -571,6 +576,7 @@ var Functions = template.FuncMap{ "hasOrganizationId": HasOrganizationId, "getBulkItemId": GetBulkItemId, "getBulkItemIdTfName": GetBulkItemIdTfName, + "isSingleton": IsSingleton, } var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)") diff --git a/internal/provider/data_source_meraki_appliance_firewall_multicast_forwarding.go b/internal/provider/data_source_meraki_appliance_firewall_multicast_forwarding.go index 2a3a363f..785146ed 100644 --- a/internal/provider/data_source_meraki_appliance_firewall_multicast_forwarding.go +++ b/internal/provider/data_source_meraki_appliance_firewall_multicast_forwarding.go @@ -28,7 +28,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -122,22 +121,14 @@ func (d *ApplianceFirewallMulticastForwardingDataSource) Read(ctx context.Contex } orgId := res.Get("organizationId").String() - rulesPath := fmt.Sprintf("/organizations/%v/appliance/firewall/multicastForwarding/byNetwork", orgId) + rulesPath := fmt.Sprintf("/organizations/%v/appliance/firewall/multicastForwarding/byNetwork?networkIds[]=%v", orgId, config.NetworkId.ValueString()) res, err = d.client.Get(rulesPath) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve multicast forwarding (GET), got error: %s, %s", err, res.String())) return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if config.NetworkId.ValueString() == v.Get("network.id").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} config.fromBody(ctx, res) config.Id = config.NetworkId diff --git a/internal/provider/data_source_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/data_source_meraki_appliance_traffic_shaping_vpn_exclusions.go index b358bdc8..53184fc2 100644 --- a/internal/provider/data_source_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/data_source_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -27,7 +27,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -136,22 +135,14 @@ func (d *ApplianceTrafficShapingVPNExclusionsDataSource) Read(ctx context.Contex } orgId := res.Get("organizationId").String() - rulesPath := fmt.Sprintf("/organizations/%v/appliance/trafficShaping/vpnExclusions/byNetwork", orgId) + rulesPath := fmt.Sprintf("/organizations/%v/appliance/trafficShaping/vpnExclusions/byNetwork?networkIds[]=%v", orgId, config.NetworkId.ValueString()) res, err = d.client.Get(rulesPath) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve vpn exceptions (GET), got error: %s, %s", err, res.String())) return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if config.NetworkId.ValueString() == v.Get("networkId").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} config.Id = config.NetworkId diff --git a/internal/provider/data_source_meraki_wireless_location_scanning.go b/internal/provider/data_source_meraki_wireless_location_scanning.go index 4a742059..b113f0e7 100644 --- a/internal/provider/data_source_meraki_wireless_location_scanning.go +++ b/internal/provider/data_source_meraki_wireless_location_scanning.go @@ -27,7 +27,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -108,22 +107,14 @@ func (d *WirelessLocationScanningDataSource) Read(ctx context.Context, req datas } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork", orgId) + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, config.NetworkId.ValueString()) res, err = d.client.Get(getPath) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve wireless location scanning (GET), got error: %s, %s", err, res.String())) return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if config.NetworkId.ValueString() == v.Get("networkId").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} config.fromBody(ctx, res) config.Id = config.NetworkId diff --git a/internal/provider/helpers/flag.go b/internal/provider/helpers/private_state.go similarity index 57% rename from internal/provider/helpers/flag.go rename to internal/provider/helpers/private_state.go index a57631c3..9e4ab58b 100644 --- a/internal/provider/helpers/flag.go +++ b/internal/provider/helpers/private_state.go @@ -33,6 +33,29 @@ func SetFlagImporting(ctx context.Context, importing bool, sk SetKeyer, respDiag respDiags.Append(diags...) } +func GetJsonInitialState(ctx context.Context, req resource.DeleteRequest) (string, diag.Diagnostics) { + v, diags := req.Private.GetKey(ctx, "initial_state") + if diags.HasError() { + return "", diags + } + + return string(v), diags +} + +// SetJsonInitialState checks the respDiags and if they are error-free it sets the `initial_state` as a private JSON value inside +// SetKeyer. It appends its own results to respDiags. +// +// The caller must include in respDiags the result of state modification in the first place, to ensure consistency. +// The SetKeyer is something like resp.Private. +func SetJsonInitialState(ctx context.Context, jsonValue string, sk SetKeyer, respDiags *diag.Diagnostics) { + if respDiags.HasError() { + return + } + + diags := sk.SetKey(ctx, "initial_state", []byte(jsonValue)) + respDiags.Append(diags...) +} + func IsFlag(ctx context.Context, req resource.ReadRequest, flagName string) (bool, diag.Diagnostics) { v, diags := req.Private.GetKey(ctx, flagName) @@ -53,6 +76,24 @@ func SetFlag(ctx context.Context, flagName string, value bool, sk SetKeyer, resp respDiags.Append(diags...) } +func GetJson(ctx context.Context, req resource.DeleteRequest, keyName string) (string, diag.Diagnostics) { + v, diags := req.Private.GetKey(ctx, keyName) + if diags.HasError() { + return "", diags + } + + return string(v), diags +} + +func SetJson(ctx context.Context, keyName string, jsonValue string, sk SetKeyer, respDiags *diag.Diagnostics) { + if respDiags.HasError() { + return + } + + diags := sk.SetKey(ctx, keyName, []byte(jsonValue)) + respDiags.Append(diags...) +} + // SetKeyer is something like ReadResponse.Private or ImportStateResponse.Private. type SetKeyer interface { SetKey(ctx context.Context, key string, value []byte) diag.Diagnostics diff --git a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go index 34d7b0e7..f5319213 100644 --- a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go @@ -140,7 +140,7 @@ func (r *ApplianceCellularFirewallRulesResource) Configure(_ context.Context, re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceCellularFirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceCellularFirewallRules + var plan, initialState ApplianceCellularFirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -149,6 +149,14 @@ func (r *ApplianceCellularFirewallRulesResource) Create(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceCellularFirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceCellularFirewallRules{}) @@ -259,8 +267,13 @@ func (r *ApplianceCellularFirewallRulesResource) Delete(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go index 2ec3386f..0c3be6c0 100644 --- a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go @@ -112,7 +112,7 @@ func (r *ApplianceConnectivityMonitoringDestinationsResource) Configure(_ contex // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceConnectivityMonitoringDestinationsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceConnectivityMonitoringDestinations + var plan, initialState ApplianceConnectivityMonitoringDestinations // Read plan diags := req.Plan.Get(ctx, &plan) @@ -121,6 +121,14 @@ func (r *ApplianceConnectivityMonitoringDestinationsResource) Create(ctx context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceConnectivityMonitoringDestinations{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceConnectivityMonitoringDestinations{}) @@ -231,8 +239,13 @@ func (r *ApplianceConnectivityMonitoringDestinationsResource) Delete(ctx context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_content_filtering.go b/internal/provider/resource_meraki_appliance_content_filtering.go index b5323f8d..bf21af03 100644 --- a/internal/provider/resource_meraki_appliance_content_filtering.go +++ b/internal/provider/resource_meraki_appliance_content_filtering.go @@ -117,7 +117,7 @@ func (r *ApplianceContentFilteringResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceContentFilteringResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceContentFiltering + var plan, initialState ApplianceContentFiltering // Read plan diags := req.Plan.Get(ctx, &plan) @@ -126,6 +126,14 @@ func (r *ApplianceContentFilteringResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceContentFiltering{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceContentFiltering{}) @@ -236,6 +244,17 @@ func (r *ApplianceContentFilteringResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go index d7c93bea..be02d834 100644 --- a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go +++ b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go @@ -32,7 +32,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -112,10 +111,8 @@ func (r *ApplianceFirewallMulticastForwardingResource) Configure(_ context.Conte // End of section. //template:end model -// Section below is generated&owned by "gen/generator.go". //template:begin create - func (r *ApplianceFirewallMulticastForwardingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceFirewallMulticastForwarding + var plan, initialState ApplianceFirewallMulticastForwarding // Read plan diags := req.Plan.Get(ctx, &plan) @@ -124,6 +121,22 @@ func (r *ApplianceFirewallMulticastForwardingResource) Create(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + networkPath := fmt.Sprintf("/networks/%v", plan.NetworkId.ValueString()) + nres, err := r.client.Get(networkPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve network (GET), got error: %s, %s", err, nres.String())) + return + } + orgId := nres.Get("organizationId").String() + getPath := fmt.Sprintf("/organizations/%v/appliance/firewall/multicastForwarding/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + gres, err := r.client.Get(getPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve multicast forwarding (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceFirewallMulticastForwarding{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceFirewallMulticastForwarding{}) @@ -143,8 +156,6 @@ func (r *ApplianceFirewallMulticastForwardingResource) Create(ctx context.Contex helpers.SetFlagImporting(ctx, false, resp.Private, &resp.Diagnostics) } -// End of section. //template:end create - func (r *ApplianceFirewallMulticastForwardingResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state ApplianceFirewallMulticastForwarding @@ -167,7 +178,7 @@ func (r *ApplianceFirewallMulticastForwardingResource) Read(ctx context.Context, } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/appliance/firewall/multicastForwarding/byNetwork", orgId) + getPath := fmt.Sprintf("/organizations/%v/appliance/firewall/multicastForwarding/byNetwork?networkIds[]=%v", orgId, state.NetworkId.ValueString()) res, err = r.client.Get(getPath) if err != nil && (strings.Contains(err.Error(), "StatusCode 404") || strings.Contains(err.Error(), "StatusCode 400")) { resp.State.RemoveResource(ctx) @@ -177,15 +188,7 @@ func (r *ApplianceFirewallMulticastForwardingResource) Read(ctx context.Context, return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if state.Id.ValueString() == v.Get("network.id").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} imp, diags := helpers.IsFlagImporting(ctx, req) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { @@ -253,8 +256,13 @@ func (r *ApplianceFirewallMulticastForwardingResource) Delete(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_firewall_settings.go b/internal/provider/resource_meraki_appliance_firewall_settings.go index 593ca54c..2b3b65cb 100644 --- a/internal/provider/resource_meraki_appliance_firewall_settings.go +++ b/internal/provider/resource_meraki_appliance_firewall_settings.go @@ -101,7 +101,7 @@ func (r *ApplianceFirewallSettingsResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceFirewallSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceFirewallSettings + var plan, initialState ApplianceFirewallSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -110,6 +110,14 @@ func (r *ApplianceFirewallSettingsResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceFirewallSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceFirewallSettings{}) @@ -220,6 +228,17 @@ func (r *ApplianceFirewallSettingsResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_firewalled_service.go b/internal/provider/resource_meraki_appliance_firewalled_service.go index 84185e43..7eb11854 100644 --- a/internal/provider/resource_meraki_appliance_firewalled_service.go +++ b/internal/provider/resource_meraki_appliance_firewalled_service.go @@ -117,7 +117,7 @@ func (r *ApplianceFirewalledServiceResource) Configure(_ context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceFirewalledServiceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceFirewalledService + var plan, initialState ApplianceFirewalledService // Read plan diags := req.Plan.Get(ctx, &plan) @@ -126,6 +126,14 @@ func (r *ApplianceFirewalledServiceResource) Create(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceFirewalledService{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceFirewalledService{}) @@ -236,6 +244,17 @@ func (r *ApplianceFirewalledServiceResource) Delete(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go index cba4b5ec..0bc5d08a 100644 --- a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go @@ -140,7 +140,7 @@ func (r *ApplianceInboundCellularFirewallRulesResource) Configure(_ context.Cont // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceInboundCellularFirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceInboundCellularFirewallRules + var plan, initialState ApplianceInboundCellularFirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -149,6 +149,14 @@ func (r *ApplianceInboundCellularFirewallRulesResource) Create(ctx context.Conte } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceInboundCellularFirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceInboundCellularFirewallRules{}) @@ -259,8 +267,13 @@ func (r *ApplianceInboundCellularFirewallRulesResource) Delete(ctx context.Conte } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go index 303b403b..df8c59d8 100644 --- a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go @@ -144,7 +144,7 @@ func (r *ApplianceInboundFirewallRulesResource) Configure(_ context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceInboundFirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceInboundFirewallRules + var plan, initialState ApplianceInboundFirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -153,6 +153,14 @@ func (r *ApplianceInboundFirewallRulesResource) Create(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceInboundFirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceInboundFirewallRules{}) @@ -263,8 +271,13 @@ func (r *ApplianceInboundFirewallRulesResource) Delete(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go index 7c43e0b2..ff50b3b6 100644 --- a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go @@ -144,7 +144,7 @@ func (r *ApplianceL3FirewallRulesResource) Configure(_ context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceL3FirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceL3FirewallRules + var plan, initialState ApplianceL3FirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -153,6 +153,14 @@ func (r *ApplianceL3FirewallRulesResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceL3FirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceL3FirewallRules{}) @@ -263,8 +271,13 @@ func (r *ApplianceL3FirewallRulesResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go index 7f9f1df3..ca5e3ec8 100644 --- a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go @@ -126,7 +126,7 @@ func (r *ApplianceL7FirewallRulesResource) Configure(_ context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceL7FirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceL7FirewallRules + var plan, initialState ApplianceL7FirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -135,6 +135,14 @@ func (r *ApplianceL7FirewallRulesResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceL7FirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceL7FirewallRules{}) @@ -245,8 +253,13 @@ func (r *ApplianceL7FirewallRulesResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_network_security_intrusion.go b/internal/provider/resource_meraki_appliance_network_security_intrusion.go index 5134faae..6838ae7c 100644 --- a/internal/provider/resource_meraki_appliance_network_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_network_security_intrusion.go @@ -123,7 +123,7 @@ func (r *ApplianceNetworkSecurityIntrusionResource) Configure(_ context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceNetworkSecurityIntrusionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceNetworkSecurityIntrusion + var plan, initialState ApplianceNetworkSecurityIntrusion // Read plan diags := req.Plan.Get(ctx, &plan) @@ -132,6 +132,14 @@ func (r *ApplianceNetworkSecurityIntrusionResource) Create(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceNetworkSecurityIntrusion{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceNetworkSecurityIntrusion{}) @@ -242,6 +250,17 @@ func (r *ApplianceNetworkSecurityIntrusionResource) Delete(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go index 1e0c1bc8..b6cc0853 100644 --- a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go @@ -150,7 +150,7 @@ func (r *ApplianceOneToManyNATRulesResource) Configure(_ context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceOneToManyNATRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceOneToManyNATRules + var plan, initialState ApplianceOneToManyNATRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -159,6 +159,14 @@ func (r *ApplianceOneToManyNATRulesResource) Create(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceOneToManyNATRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceOneToManyNATRules{}) @@ -269,8 +277,13 @@ func (r *ApplianceOneToManyNATRulesResource) Delete(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go index 3b35ab0e..79bd8e9d 100644 --- a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go @@ -147,7 +147,7 @@ func (r *ApplianceOneToOneNATRulesResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceOneToOneNATRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceOneToOneNATRules + var plan, initialState ApplianceOneToOneNATRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -156,6 +156,14 @@ func (r *ApplianceOneToOneNATRulesResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceOneToOneNATRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceOneToOneNATRules{}) @@ -266,8 +274,13 @@ func (r *ApplianceOneToOneNATRulesResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go index 43d6c5ab..6146c068 100644 --- a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go @@ -108,7 +108,7 @@ func (r *ApplianceOrganizationSecurityIntrusionResource) Configure(_ context.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceOrganizationSecurityIntrusionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceOrganizationSecurityIntrusion + var plan, initialState ApplianceOrganizationSecurityIntrusion // Read plan diags := req.Plan.Get(ctx, &plan) @@ -117,6 +117,14 @@ func (r *ApplianceOrganizationSecurityIntrusionResource) Create(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceOrganizationSecurityIntrusion{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceOrganizationSecurityIntrusion{}) @@ -227,8 +235,13 @@ func (r *ApplianceOrganizationSecurityIntrusionResource) Delete(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_port.go b/internal/provider/resource_meraki_appliance_port.go index 7c4d447e..5e777354 100644 --- a/internal/provider/resource_meraki_appliance_port.go +++ b/internal/provider/resource_meraki_appliance_port.go @@ -123,7 +123,7 @@ func (r *AppliancePortResource) Configure(_ context.Context, req resource.Config // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *AppliancePortResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan AppliancePort + var plan, initialState AppliancePort // Read plan diags := req.Plan.Get(ctx, &plan) @@ -132,6 +132,14 @@ func (r *AppliancePortResource) Create(ctx context.Context, req resource.CreateR } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, AppliancePort{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, AppliancePort{}) @@ -242,6 +250,17 @@ func (r *AppliancePortResource) Delete(ctx context.Context, req resource.DeleteR } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go index 1515f1ad..2fab84d5 100644 --- a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go @@ -138,7 +138,7 @@ func (r *AppliancePortForwardingRulesResource) Configure(_ context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *AppliancePortForwardingRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan AppliancePortForwardingRules + var plan, initialState AppliancePortForwardingRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -147,6 +147,14 @@ func (r *AppliancePortForwardingRulesResource) Create(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, AppliancePortForwardingRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, AppliancePortForwardingRules{}) @@ -257,8 +265,13 @@ func (r *AppliancePortForwardingRulesResource) Delete(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_radio_settings.go b/internal/provider/resource_meraki_appliance_radio_settings.go index d14596f2..86890aed 100644 --- a/internal/provider/resource_meraki_appliance_radio_settings.go +++ b/internal/provider/resource_meraki_appliance_radio_settings.go @@ -116,7 +116,7 @@ func (r *ApplianceRadioSettingsResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceRadioSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceRadioSettings + var plan, initialState ApplianceRadioSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -125,6 +125,14 @@ func (r *ApplianceRadioSettingsResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceRadioSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceRadioSettings{}) @@ -235,6 +243,17 @@ func (r *ApplianceRadioSettingsResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go index 37e5e45b..0b27e2e7 100644 --- a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go @@ -197,7 +197,7 @@ func (r *ApplianceSDWANInternetPoliciesResource) Configure(_ context.Context, re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSDWANInternetPoliciesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSDWANInternetPolicies + var plan, initialState ApplianceSDWANInternetPolicies // Read plan diags := req.Plan.Get(ctx, &plan) @@ -206,6 +206,14 @@ func (r *ApplianceSDWANInternetPoliciesResource) Create(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSDWANInternetPolicies{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSDWANInternetPolicies{}) @@ -296,8 +304,13 @@ func (r *ApplianceSDWANInternetPoliciesResource) Delete(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_security_malware.go b/internal/provider/resource_meraki_appliance_security_malware.go index 7d97a789..f71664bf 100644 --- a/internal/provider/resource_meraki_appliance_security_malware.go +++ b/internal/provider/resource_meraki_appliance_security_malware.go @@ -133,7 +133,7 @@ func (r *ApplianceSecurityMalwareResource) Configure(_ context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSecurityMalwareResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSecurityMalware + var plan, initialState ApplianceSecurityMalware // Read plan diags := req.Plan.Get(ctx, &plan) @@ -142,6 +142,14 @@ func (r *ApplianceSecurityMalwareResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSecurityMalware{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSecurityMalware{}) @@ -252,6 +260,17 @@ func (r *ApplianceSecurityMalwareResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_settings.go b/internal/provider/resource_meraki_appliance_settings.go index 7de89858..67566d4c 100644 --- a/internal/provider/resource_meraki_appliance_settings.go +++ b/internal/provider/resource_meraki_appliance_settings.go @@ -116,7 +116,7 @@ func (r *ApplianceSettingsResource) Configure(_ context.Context, req resource.Co // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSettings + var plan, initialState ApplianceSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -125,6 +125,14 @@ func (r *ApplianceSettingsResource) Create(ctx context.Context, req resource.Cre } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSettings{}) @@ -235,6 +243,17 @@ func (r *ApplianceSettingsResource) Delete(ctx context.Context, req resource.Del } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_single_lan.go b/internal/provider/resource_meraki_appliance_single_lan.go index 17d80ef5..d48dadcb 100644 --- a/internal/provider/resource_meraki_appliance_single_lan.go +++ b/internal/provider/resource_meraki_appliance_single_lan.go @@ -143,7 +143,7 @@ func (r *ApplianceSingleLANResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSingleLANResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSingleLAN + var plan, initialState ApplianceSingleLAN // Read plan diags := req.Plan.Get(ctx, &plan) @@ -152,6 +152,14 @@ func (r *ApplianceSingleLANResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSingleLAN{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSingleLAN{}) @@ -262,6 +270,17 @@ func (r *ApplianceSingleLANResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go index 3dfbbf8b..664e97a9 100644 --- a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go +++ b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go @@ -145,7 +145,7 @@ func (r *ApplianceSiteToSiteVPNResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSiteToSiteVPNResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSiteToSiteVPN + var plan, initialState ApplianceSiteToSiteVPN // Read plan diags := req.Plan.Get(ctx, &plan) @@ -154,6 +154,14 @@ func (r *ApplianceSiteToSiteVPNResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSiteToSiteVPN{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSiteToSiteVPN{}) @@ -264,6 +272,17 @@ func (r *ApplianceSiteToSiteVPNResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_ssid.go b/internal/provider/resource_meraki_appliance_ssid.go index bc824331..44b258fe 100644 --- a/internal/provider/resource_meraki_appliance_ssid.go +++ b/internal/provider/resource_meraki_appliance_ssid.go @@ -174,7 +174,7 @@ func (r *ApplianceSSIDResource) Configure(_ context.Context, req resource.Config // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSSIDResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceSSID + var plan, initialState ApplianceSSID // Read plan diags := req.Plan.Get(ctx, &plan) @@ -183,6 +183,14 @@ func (r *ApplianceSSIDResource) Create(ctx context.Context, req resource.CreateR } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSSID{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSSID{}) @@ -293,6 +301,17 @@ func (r *ApplianceSSIDResource) Delete(ctx context.Context, req resource.DeleteR } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go index fb001b69..98c2fabf 100644 --- a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go +++ b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go @@ -261,7 +261,7 @@ func (r *ApplianceThirdPartyVPNPeersResource) Configure(_ context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceThirdPartyVPNPeersResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceThirdPartyVPNPeers + var plan, initialState ApplianceThirdPartyVPNPeers // Read plan diags := req.Plan.Get(ctx, &plan) @@ -270,6 +270,14 @@ func (r *ApplianceThirdPartyVPNPeersResource) Create(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceThirdPartyVPNPeers{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceThirdPartyVPNPeers{}) @@ -380,8 +388,13 @@ func (r *ApplianceThirdPartyVPNPeersResource) Delete(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping.go b/internal/provider/resource_meraki_appliance_traffic_shaping.go index 362d5472..25f733e9 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping.go @@ -100,7 +100,7 @@ func (r *ApplianceTrafficShapingResource) Configure(_ context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceTrafficShapingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceTrafficShaping + var plan, initialState ApplianceTrafficShaping // Read plan diags := req.Plan.Get(ctx, &plan) @@ -109,6 +109,14 @@ func (r *ApplianceTrafficShapingResource) Create(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceTrafficShaping{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceTrafficShaping{}) @@ -219,6 +227,17 @@ func (r *ApplianceTrafficShapingResource) Delete(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go index 84fafee6..8dfaa276 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go @@ -145,7 +145,7 @@ func (r *ApplianceTrafficShapingRulesResource) Configure(_ context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceTrafficShapingRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceTrafficShapingRules + var plan, initialState ApplianceTrafficShapingRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -154,6 +154,14 @@ func (r *ApplianceTrafficShapingRulesResource) Create(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceTrafficShapingRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceTrafficShapingRules{}) @@ -264,8 +272,13 @@ func (r *ApplianceTrafficShapingRulesResource) Delete(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go index 7433fc14..ba015b70 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go @@ -116,7 +116,7 @@ func (r *ApplianceTrafficShapingUplinkBandwidthResource) Configure(_ context.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceTrafficShapingUplinkBandwidthResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceTrafficShapingUplinkBandwidth + var plan, initialState ApplianceTrafficShapingUplinkBandwidth // Read plan diags := req.Plan.Get(ctx, &plan) @@ -125,6 +125,14 @@ func (r *ApplianceTrafficShapingUplinkBandwidthResource) Create(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceTrafficShapingUplinkBandwidth{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceTrafficShapingUplinkBandwidth{}) @@ -235,6 +243,17 @@ func (r *ApplianceTrafficShapingUplinkBandwidthResource) Delete(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go index 8c1013a5..378a0745 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go @@ -275,7 +275,7 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Configure(_ context.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceTrafficShapingUplinkSelectionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceTrafficShapingUplinkSelection + var plan, initialState ApplianceTrafficShapingUplinkSelection // Read plan diags := req.Plan.Get(ctx, &plan) @@ -284,6 +284,14 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Create(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceTrafficShapingUplinkSelection{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceTrafficShapingUplinkSelection{}) diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go index bfee2440..1998d9a2 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -33,7 +33,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -134,10 +133,8 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Configure(_ context.Conte // End of section. //template:end model -// Section below is generated&owned by "gen/generator.go". //template:begin create - func (r *ApplianceTrafficShapingVPNExclusionsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceTrafficShapingVPNExclusions + var plan, initialState ApplianceTrafficShapingVPNExclusions // Read plan diags := req.Plan.Get(ctx, &plan) @@ -146,6 +143,22 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Create(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + networkPath := fmt.Sprintf("/networks/%v", plan.NetworkId.ValueString()) + nres, err := r.client.Get(networkPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve network (GET), got error: %s, %s", err, nres.String())) + return + } + orgId := nres.Get("organizationId").String() + getPath := fmt.Sprintf("/organizations/%v/appliance/trafficShaping/vpnExclusions/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + gres, err := r.client.Get(getPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve vpn exceptions (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceTrafficShapingVPNExclusions{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceTrafficShapingVPNExclusions{}) @@ -165,8 +178,6 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Create(ctx context.Contex helpers.SetFlagImporting(ctx, false, resp.Private, &resp.Diagnostics) } -// End of section. //template:end create - func (r *ApplianceTrafficShapingVPNExclusionsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state ApplianceTrafficShapingVPNExclusions @@ -189,7 +200,7 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Read(ctx context.Context, } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/appliance/trafficShaping/vpnExclusions/byNetwork", orgId) + getPath := fmt.Sprintf("/organizations/%v/appliance/trafficShaping/vpnExclusions/byNetwork?networkIds[]=%v", orgId, state.NetworkId.ValueString()) res, err = r.client.Get(getPath) if err != nil && (strings.Contains(err.Error(), "StatusCode 404") || strings.Contains(err.Error(), "StatusCode 400")) { resp.State.RemoveResource(ctx) @@ -199,15 +210,7 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Read(ctx context.Context, return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if state.Id.ValueString() == v.Get("networkId").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} imp, diags := helpers.IsFlagImporting(ctx, req) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { @@ -275,8 +278,13 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Delete(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_uplinks_settings.go b/internal/provider/resource_meraki_appliance_uplinks_settings.go index 8ad4a735..d6c74fde 100644 --- a/internal/provider/resource_meraki_appliance_uplinks_settings.go +++ b/internal/provider/resource_meraki_appliance_uplinks_settings.go @@ -231,7 +231,7 @@ func (r *ApplianceUplinksSettingsResource) Configure(_ context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceUplinksSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceUplinksSettings + var plan, initialState ApplianceUplinksSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -240,6 +240,14 @@ func (r *ApplianceUplinksSettingsResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceUplinksSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceUplinksSettings{}) @@ -350,6 +358,17 @@ func (r *ApplianceUplinksSettingsResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_vlan_dhcp.go b/internal/provider/resource_meraki_appliance_vlan_dhcp.go index 2c05bf94..bc97f245 100644 --- a/internal/provider/resource_meraki_appliance_vlan_dhcp.go +++ b/internal/provider/resource_meraki_appliance_vlan_dhcp.go @@ -290,6 +290,17 @@ func (r *ApplianceVLANDHCPResource) Delete(ctx context.Context, req resource.Del } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_vlans_settings.go b/internal/provider/resource_meraki_appliance_vlans_settings.go index a32dae67..47caa762 100644 --- a/internal/provider/resource_meraki_appliance_vlans_settings.go +++ b/internal/provider/resource_meraki_appliance_vlans_settings.go @@ -96,7 +96,7 @@ func (r *ApplianceVLANsSettingsResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceVLANsSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceVLANsSettings + var plan, initialState ApplianceVLANsSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -105,6 +105,14 @@ func (r *ApplianceVLANsSettingsResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceVLANsSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceVLANsSettings{}) @@ -215,6 +223,17 @@ func (r *ApplianceVLANsSettingsResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_vpn_bgp.go b/internal/provider/resource_meraki_appliance_vpn_bgp.go index ac6f8f28..5d27eb40 100644 --- a/internal/provider/resource_meraki_appliance_vpn_bgp.go +++ b/internal/provider/resource_meraki_appliance_vpn_bgp.go @@ -170,7 +170,7 @@ func (r *ApplianceVPNBGPResource) Configure(_ context.Context, req resource.Conf // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceVPNBGPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceVPNBGP + var plan, initialState ApplianceVPNBGP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -179,6 +179,14 @@ func (r *ApplianceVPNBGPResource) Create(ctx context.Context, req resource.Creat } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceVPNBGP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceVPNBGP{}) @@ -289,6 +297,17 @@ func (r *ApplianceVPNBGPResource) Delete(ctx context.Context, req resource.Delet } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go index a45cbd7e..906c57bf 100644 --- a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go @@ -144,7 +144,7 @@ func (r *ApplianceVPNFirewallRulesResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceVPNFirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceVPNFirewallRules + var plan, initialState ApplianceVPNFirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -153,6 +153,14 @@ func (r *ApplianceVPNFirewallRulesResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceVPNFirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceVPNFirewallRules{}) @@ -263,8 +271,13 @@ func (r *ApplianceVPNFirewallRulesResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go index 7d49bc2f..40fb3ed0 100644 --- a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go +++ b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go @@ -108,7 +108,7 @@ func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Configure(_ context.Conte // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceVPNSiteToSiteIPsecPeersSLAs + var plan, initialState ApplianceVPNSiteToSiteIPsecPeersSLAs // Read plan diags := req.Plan.Get(ctx, &plan) @@ -117,6 +117,14 @@ func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Create(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceVPNSiteToSiteIPsecPeersSLAs{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceVPNSiteToSiteIPsecPeersSLAs{}) @@ -227,8 +235,13 @@ func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Delete(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_warm_spare.go b/internal/provider/resource_meraki_appliance_warm_spare.go index 4ac94760..422c65d0 100644 --- a/internal/provider/resource_meraki_appliance_warm_spare.go +++ b/internal/provider/resource_meraki_appliance_warm_spare.go @@ -112,7 +112,7 @@ func (r *ApplianceWarmSpareResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceWarmSpareResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan ApplianceWarmSpare + var plan, initialState ApplianceWarmSpare // Read plan diags := req.Plan.Get(ctx, &plan) @@ -121,6 +121,14 @@ func (r *ApplianceWarmSpareResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceWarmSpare{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceWarmSpare{}) @@ -231,6 +239,17 @@ func (r *ApplianceWarmSpareResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_camera_custom_analytics.go b/internal/provider/resource_meraki_camera_custom_analytics.go index fa8b219d..11d5278d 100644 --- a/internal/provider/resource_meraki_camera_custom_analytics.go +++ b/internal/provider/resource_meraki_camera_custom_analytics.go @@ -116,7 +116,7 @@ func (r *CameraCustomAnalyticsResource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CameraCustomAnalyticsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CameraCustomAnalytics + var plan, initialState CameraCustomAnalytics // Read plan diags := req.Plan.Get(ctx, &plan) @@ -125,6 +125,14 @@ func (r *CameraCustomAnalyticsResource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CameraCustomAnalytics{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CameraCustomAnalytics{}) @@ -235,6 +243,17 @@ func (r *CameraCustomAnalyticsResource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_camera_device_wireless_profiles.go b/internal/provider/resource_meraki_camera_device_wireless_profiles.go index d041fb58..e7b8872b 100644 --- a/internal/provider/resource_meraki_camera_device_wireless_profiles.go +++ b/internal/provider/resource_meraki_camera_device_wireless_profiles.go @@ -104,7 +104,7 @@ func (r *CameraDeviceWirelessProfilesResource) Configure(_ context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CameraDeviceWirelessProfilesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CameraDeviceWirelessProfiles + var plan, initialState CameraDeviceWirelessProfiles // Read plan diags := req.Plan.Get(ctx, &plan) @@ -113,6 +113,14 @@ func (r *CameraDeviceWirelessProfilesResource) Create(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CameraDeviceWirelessProfiles{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CameraDeviceWirelessProfiles{}) @@ -223,6 +231,17 @@ func (r *CameraDeviceWirelessProfilesResource) Delete(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_camera_quality_retention.go b/internal/provider/resource_meraki_camera_quality_retention.go index d89469f1..ab7e23f0 100644 --- a/internal/provider/resource_meraki_camera_quality_retention.go +++ b/internal/provider/resource_meraki_camera_quality_retention.go @@ -128,7 +128,7 @@ func (r *CameraQualityRetentionResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CameraQualityRetentionResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CameraQualityRetention + var plan, initialState CameraQualityRetention // Read plan diags := req.Plan.Get(ctx, &plan) @@ -137,6 +137,14 @@ func (r *CameraQualityRetentionResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CameraQualityRetention{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CameraQualityRetention{}) @@ -247,6 +255,17 @@ func (r *CameraQualityRetentionResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_camera_sense.go b/internal/provider/resource_meraki_camera_sense.go index 3aa8286f..23231589 100644 --- a/internal/provider/resource_meraki_camera_sense.go +++ b/internal/provider/resource_meraki_camera_sense.go @@ -108,7 +108,7 @@ func (r *CameraSenseResource) Configure(_ context.Context, req resource.Configur // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CameraSenseResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CameraSense + var plan, initialState CameraSense // Read plan diags := req.Plan.Get(ctx, &plan) @@ -117,6 +117,14 @@ func (r *CameraSenseResource) Create(ctx context.Context, req resource.CreateReq } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CameraSense{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CameraSense{}) @@ -227,6 +235,17 @@ func (r *CameraSenseResource) Delete(ctx context.Context, req resource.DeleteReq } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_camera_video_settings.go b/internal/provider/resource_meraki_camera_video_settings.go index d542ef97..323a0eef 100644 --- a/internal/provider/resource_meraki_camera_video_settings.go +++ b/internal/provider/resource_meraki_camera_video_settings.go @@ -96,7 +96,7 @@ func (r *CameraVideoSettingsResource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CameraVideoSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CameraVideoSettings + var plan, initialState CameraVideoSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -105,6 +105,14 @@ func (r *CameraVideoSettingsResource) Create(ctx context.Context, req resource.C } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CameraVideoSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CameraVideoSettings{}) @@ -215,6 +223,17 @@ func (r *CameraVideoSettingsResource) Delete(ctx context.Context, req resource.D } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go index cd9edaae..1fbb2505 100644 --- a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go @@ -112,7 +112,7 @@ func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Configure(_ // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewayConnectivityMonitoringDestinations + var plan, initialState CellularGatewayConnectivityMonitoringDestinations // Read plan diags := req.Plan.Get(ctx, &plan) @@ -121,6 +121,14 @@ func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Create(ctx c } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewayConnectivityMonitoringDestinations{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewayConnectivityMonitoringDestinations{}) @@ -231,8 +239,13 @@ func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Delete(ctx c } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_cellular_gateway_dhcp.go b/internal/provider/resource_meraki_cellular_gateway_dhcp.go index b890f387..3c2607e2 100644 --- a/internal/provider/resource_meraki_cellular_gateway_dhcp.go +++ b/internal/provider/resource_meraki_cellular_gateway_dhcp.go @@ -106,7 +106,7 @@ func (r *CellularGatewayDHCPResource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewayDHCPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewayDHCP + var plan, initialState CellularGatewayDHCP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -115,6 +115,14 @@ func (r *CellularGatewayDHCPResource) Create(ctx context.Context, req resource.C } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewayDHCP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewayDHCP{}) @@ -225,6 +233,17 @@ func (r *CellularGatewayDHCPResource) Delete(ctx context.Context, req resource.D } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_cellular_gateway_lan.go b/internal/provider/resource_meraki_cellular_gateway_lan.go index d1fab8b0..2d2b9d2b 100644 --- a/internal/provider/resource_meraki_cellular_gateway_lan.go +++ b/internal/provider/resource_meraki_cellular_gateway_lan.go @@ -132,7 +132,7 @@ func (r *CellularGatewayLANResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewayLANResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewayLAN + var plan, initialState CellularGatewayLAN // Read plan diags := req.Plan.Get(ctx, &plan) @@ -141,6 +141,14 @@ func (r *CellularGatewayLANResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewayLAN{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewayLAN{}) @@ -251,8 +259,13 @@ func (r *CellularGatewayLANResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go index 5cca7284..9c15cc21 100644 --- a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go @@ -130,7 +130,7 @@ func (r *CellularGatewayPortForwardingRulesResource) Configure(_ context.Context // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewayPortForwardingRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewayPortForwardingRules + var plan, initialState CellularGatewayPortForwardingRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -139,6 +139,14 @@ func (r *CellularGatewayPortForwardingRulesResource) Create(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewayPortForwardingRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewayPortForwardingRules{}) @@ -249,8 +257,13 @@ func (r *CellularGatewayPortForwardingRulesResource) Delete(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go index 83af1f9d..f82a8c09 100644 --- a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go +++ b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go @@ -100,7 +100,7 @@ func (r *CellularGatewaySubnetPoolResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewaySubnetPoolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewaySubnetPool + var plan, initialState CellularGatewaySubnetPool // Read plan diags := req.Plan.Get(ctx, &plan) @@ -109,6 +109,14 @@ func (r *CellularGatewaySubnetPoolResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewaySubnetPool{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewaySubnetPool{}) @@ -219,6 +227,17 @@ func (r *CellularGatewaySubnetPoolResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_cellular_gateway_uplink.go b/internal/provider/resource_meraki_cellular_gateway_uplink.go index ad6c6cc8..2c448bdd 100644 --- a/internal/provider/resource_meraki_cellular_gateway_uplink.go +++ b/internal/provider/resource_meraki_cellular_gateway_uplink.go @@ -100,7 +100,7 @@ func (r *CellularGatewayUplinkResource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *CellularGatewayUplinkResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan CellularGatewayUplink + var plan, initialState CellularGatewayUplink // Read plan diags := req.Plan.Get(ctx, &plan) @@ -109,6 +109,14 @@ func (r *CellularGatewayUplinkResource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, CellularGatewayUplink{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, CellularGatewayUplink{}) @@ -219,6 +227,17 @@ func (r *CellularGatewayUplinkResource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_device.go b/internal/provider/resource_meraki_device.go index 38413e08..a4c2e000 100644 --- a/internal/provider/resource_meraki_device.go +++ b/internal/provider/resource_meraki_device.go @@ -130,7 +130,7 @@ func (r *DeviceResource) Configure(_ context.Context, req resource.ConfigureRequ // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *DeviceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan Device + var plan, initialState Device // Read plan diags := req.Plan.Get(ctx, &plan) @@ -139,6 +139,14 @@ func (r *DeviceResource) Create(ctx context.Context, req resource.CreateRequest, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, Device{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, Device{}) @@ -249,6 +257,17 @@ func (r *DeviceResource) Delete(ctx context.Context, req resource.DeleteRequest, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_device_cellular_sims.go b/internal/provider/resource_meraki_device_cellular_sims.go index d6236611..ae21600a 100644 --- a/internal/provider/resource_meraki_device_cellular_sims.go +++ b/internal/provider/resource_meraki_device_cellular_sims.go @@ -160,7 +160,7 @@ func (r *DeviceCellularSIMsResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *DeviceCellularSIMsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan DeviceCellularSIMs + var plan, initialState DeviceCellularSIMs // Read plan diags := req.Plan.Get(ctx, &plan) @@ -169,6 +169,14 @@ func (r *DeviceCellularSIMsResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, DeviceCellularSIMs{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, DeviceCellularSIMs{}) @@ -279,6 +287,17 @@ func (r *DeviceCellularSIMsResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_device_management_interface.go b/internal/provider/resource_meraki_device_management_interface.go index 621f446c..1017d03a 100644 --- a/internal/provider/resource_meraki_device_management_interface.go +++ b/internal/provider/resource_meraki_device_management_interface.go @@ -159,7 +159,7 @@ func (r *DeviceManagementInterfaceResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *DeviceManagementInterfaceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan DeviceManagementInterface + var plan, initialState DeviceManagementInterface // Read plan diags := req.Plan.Get(ctx, &plan) @@ -168,6 +168,14 @@ func (r *DeviceManagementInterfaceResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, DeviceManagementInterface{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, DeviceManagementInterface{}) @@ -278,6 +286,17 @@ func (r *DeviceManagementInterfaceResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_alerts_settings.go b/internal/provider/resource_meraki_network_alerts_settings.go index c4e4306b..66903ac0 100644 --- a/internal/provider/resource_meraki_network_alerts_settings.go +++ b/internal/provider/resource_meraki_network_alerts_settings.go @@ -240,7 +240,7 @@ func (r *NetworkAlertsSettingsResource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkAlertsSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkAlertsSettings + var plan, initialState NetworkAlertsSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -249,6 +249,14 @@ func (r *NetworkAlertsSettingsResource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkAlertsSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkAlertsSettings{}) @@ -359,6 +367,17 @@ func (r *NetworkAlertsSettingsResource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_client_policy.go b/internal/provider/resource_meraki_network_client_policy.go index 82643138..963db255 100644 --- a/internal/provider/resource_meraki_network_client_policy.go +++ b/internal/provider/resource_meraki_network_client_policy.go @@ -107,7 +107,7 @@ func (r *NetworkClientPolicyResource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkClientPolicyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkClientPolicy + var plan, initialState NetworkClientPolicy // Read plan diags := req.Plan.Get(ctx, &plan) @@ -116,6 +116,14 @@ func (r *NetworkClientPolicyResource) Create(ctx context.Context, req resource.C } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkClientPolicy{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkClientPolicy{}) @@ -226,6 +234,17 @@ func (r *NetworkClientPolicyResource) Delete(ctx context.Context, req resource.D } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_client_splash_authorization_status.go b/internal/provider/resource_meraki_network_client_splash_authorization_status.go index c874786a..84ee55e6 100644 --- a/internal/provider/resource_meraki_network_client_splash_authorization_status.go +++ b/internal/provider/resource_meraki_network_client_splash_authorization_status.go @@ -159,7 +159,7 @@ func (r *NetworkClientSplashAuthorizationStatusResource) Configure(_ context.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkClientSplashAuthorizationStatusResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkClientSplashAuthorizationStatus + var plan, initialState NetworkClientSplashAuthorizationStatus // Read plan diags := req.Plan.Get(ctx, &plan) @@ -168,6 +168,14 @@ func (r *NetworkClientSplashAuthorizationStatusResource) Create(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkClientSplashAuthorizationStatus{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkClientSplashAuthorizationStatus{}) @@ -278,6 +286,17 @@ func (r *NetworkClientSplashAuthorizationStatusResource) Delete(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_firmware_upgrades.go b/internal/provider/resource_meraki_network_firmware_upgrades.go index 3745d838..ab4c8a9c 100644 --- a/internal/provider/resource_meraki_network_firmware_upgrades.go +++ b/internal/provider/resource_meraki_network_firmware_upgrades.go @@ -220,7 +220,7 @@ func (r *NetworkFirmwareUpgradesResource) Configure(_ context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkFirmwareUpgradesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkFirmwareUpgrades + var plan, initialState NetworkFirmwareUpgrades // Read plan diags := req.Plan.Get(ctx, &plan) @@ -229,6 +229,14 @@ func (r *NetworkFirmwareUpgradesResource) Create(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkFirmwareUpgrades{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkFirmwareUpgrades{}) @@ -339,6 +347,17 @@ func (r *NetworkFirmwareUpgradesResource) Delete(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_netflow.go b/internal/provider/resource_meraki_network_netflow.go index 4875b1cb..4d97149c 100644 --- a/internal/provider/resource_meraki_network_netflow.go +++ b/internal/provider/resource_meraki_network_netflow.go @@ -112,7 +112,7 @@ func (r *NetworkNetflowResource) Configure(_ context.Context, req resource.Confi // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkNetflowResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkNetflow + var plan, initialState NetworkNetflow // Read plan diags := req.Plan.Get(ctx, &plan) @@ -121,6 +121,14 @@ func (r *NetworkNetflowResource) Create(ctx context.Context, req resource.Create } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkNetflow{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkNetflow{}) @@ -231,6 +239,17 @@ func (r *NetworkNetflowResource) Delete(ctx context.Context, req resource.Delete } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_settings.go b/internal/provider/resource_meraki_network_settings.go index 7a39af2b..c51a1250 100644 --- a/internal/provider/resource_meraki_network_settings.go +++ b/internal/provider/resource_meraki_network_settings.go @@ -120,7 +120,7 @@ func (r *NetworkSettingsResource) Configure(_ context.Context, req resource.Conf // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkSettings + var plan, initialState NetworkSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -129,6 +129,14 @@ func (r *NetworkSettingsResource) Create(ctx context.Context, req resource.Creat } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkSettings{}) @@ -239,6 +247,17 @@ func (r *NetworkSettingsResource) Delete(ctx context.Context, req resource.Delet } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_snmp.go b/internal/provider/resource_meraki_network_snmp.go index 80030877..a0a4d586 100644 --- a/internal/provider/resource_meraki_network_snmp.go +++ b/internal/provider/resource_meraki_network_snmp.go @@ -121,7 +121,7 @@ func (r *NetworkSNMPResource) Configure(_ context.Context, req resource.Configur // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkSNMPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkSNMP + var plan, initialState NetworkSNMP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -130,6 +130,14 @@ func (r *NetworkSNMPResource) Create(ctx context.Context, req resource.CreateReq } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkSNMP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkSNMP{}) @@ -240,6 +248,17 @@ func (r *NetworkSNMPResource) Delete(ctx context.Context, req resource.DeleteReq } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_network_syslog_servers.go b/internal/provider/resource_meraki_network_syslog_servers.go index 7dab6467..0fc0ee1f 100644 --- a/internal/provider/resource_meraki_network_syslog_servers.go +++ b/internal/provider/resource_meraki_network_syslog_servers.go @@ -114,7 +114,7 @@ func (r *NetworkSyslogServersResource) Configure(_ context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkSyslogServersResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkSyslogServers + var plan, initialState NetworkSyslogServers // Read plan diags := req.Plan.Get(ctx, &plan) @@ -123,6 +123,14 @@ func (r *NetworkSyslogServersResource) Create(ctx context.Context, req resource. } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkSyslogServers{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkSyslogServers{}) @@ -233,8 +241,13 @@ func (r *NetworkSyslogServersResource) Delete(ctx context.Context, req resource. } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_network_traffic_analysis.go b/internal/provider/resource_meraki_network_traffic_analysis.go index 65740033..4e63694d 100644 --- a/internal/provider/resource_meraki_network_traffic_analysis.go +++ b/internal/provider/resource_meraki_network_traffic_analysis.go @@ -124,7 +124,7 @@ func (r *NetworkTrafficAnalysisResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *NetworkTrafficAnalysisResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan NetworkTrafficAnalysis + var plan, initialState NetworkTrafficAnalysis // Read plan diags := req.Plan.Get(ctx, &plan) @@ -133,6 +133,14 @@ func (r *NetworkTrafficAnalysisResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, NetworkTrafficAnalysis{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, NetworkTrafficAnalysis{}) @@ -243,6 +251,17 @@ func (r *NetworkTrafficAnalysisResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go index fc794150..7e7c7031 100644 --- a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go +++ b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go @@ -98,7 +98,7 @@ func (r *OrganizationAdaptivePolicySettingsResource) Configure(_ context.Context // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationAdaptivePolicySettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationAdaptivePolicySettings + var plan, initialState OrganizationAdaptivePolicySettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -107,6 +107,14 @@ func (r *OrganizationAdaptivePolicySettingsResource) Create(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationAdaptivePolicySettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationAdaptivePolicySettings{}) @@ -217,6 +225,17 @@ func (r *OrganizationAdaptivePolicySettingsResource) Delete(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_branding_policies_priorities.go b/internal/provider/resource_meraki_organization_branding_policies_priorities.go index f4222dde..0c730717 100644 --- a/internal/provider/resource_meraki_organization_branding_policies_priorities.go +++ b/internal/provider/resource_meraki_organization_branding_policies_priorities.go @@ -98,7 +98,7 @@ func (r *OrganizationBrandingPoliciesPrioritiesResource) Configure(_ context.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationBrandingPoliciesPrioritiesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationBrandingPoliciesPriorities + var plan, initialState OrganizationBrandingPoliciesPriorities // Read plan diags := req.Plan.Get(ctx, &plan) @@ -107,6 +107,14 @@ func (r *OrganizationBrandingPoliciesPrioritiesResource) Create(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationBrandingPoliciesPriorities{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationBrandingPoliciesPriorities{}) @@ -217,6 +225,17 @@ func (r *OrganizationBrandingPoliciesPrioritiesResource) Delete(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_license.go b/internal/provider/resource_meraki_organization_license.go index 340f01b7..0d1843fb 100644 --- a/internal/provider/resource_meraki_organization_license.go +++ b/internal/provider/resource_meraki_organization_license.go @@ -103,7 +103,7 @@ func (r *OrganizationLicenseResource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationLicenseResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationLicense + var plan, initialState OrganizationLicense // Read plan diags := req.Plan.Get(ctx, &plan) @@ -112,6 +112,14 @@ func (r *OrganizationLicenseResource) Create(ctx context.Context, req resource.C } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationLicense{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationLicense{}) @@ -222,6 +230,17 @@ func (r *OrganizationLicenseResource) Delete(ctx context.Context, req resource.D } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_login_security.go b/internal/provider/resource_meraki_organization_login_security.go index a77d4be1..96fd2337 100644 --- a/internal/provider/resource_meraki_organization_login_security.go +++ b/internal/provider/resource_meraki_organization_login_security.go @@ -160,7 +160,7 @@ func (r *OrganizationLoginSecurityResource) Configure(_ context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationLoginSecurityResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationLoginSecurity + var plan, initialState OrganizationLoginSecurity // Read plan diags := req.Plan.Get(ctx, &plan) @@ -169,6 +169,14 @@ func (r *OrganizationLoginSecurityResource) Create(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationLoginSecurity{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationLoginSecurity{}) @@ -279,6 +287,17 @@ func (r *OrganizationLoginSecurityResource) Delete(ctx context.Context, req reso } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_saml.go b/internal/provider/resource_meraki_organization_saml.go index 68e8e220..f9a65cf6 100644 --- a/internal/provider/resource_meraki_organization_saml.go +++ b/internal/provider/resource_meraki_organization_saml.go @@ -96,7 +96,7 @@ func (r *OrganizationSAMLResource) Configure(_ context.Context, req resource.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationSAMLResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationSAML + var plan, initialState OrganizationSAML // Read plan diags := req.Plan.Get(ctx, &plan) @@ -105,6 +105,14 @@ func (r *OrganizationSAMLResource) Create(ctx context.Context, req resource.Crea } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationSAML{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationSAML{}) @@ -215,6 +223,17 @@ func (r *OrganizationSAMLResource) Delete(ctx context.Context, req resource.Dele } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_organization_snmp.go b/internal/provider/resource_meraki_organization_snmp.go index 782b5438..d3af3a0f 100644 --- a/internal/provider/resource_meraki_organization_snmp.go +++ b/internal/provider/resource_meraki_organization_snmp.go @@ -130,7 +130,7 @@ func (r *OrganizationSNMPResource) Configure(_ context.Context, req resource.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *OrganizationSNMPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan OrganizationSNMP + var plan, initialState OrganizationSNMP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -139,6 +139,14 @@ func (r *OrganizationSNMPResource) Create(ctx context.Context, req resource.Crea } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, OrganizationSNMP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, OrganizationSNMP{}) @@ -249,6 +257,17 @@ func (r *OrganizationSNMPResource) Delete(ctx context.Context, req resource.Dele } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_sensor_mqtt_broker.go b/internal/provider/resource_meraki_sensor_mqtt_broker.go index af5562ec..38a5bb14 100644 --- a/internal/provider/resource_meraki_sensor_mqtt_broker.go +++ b/internal/provider/resource_meraki_sensor_mqtt_broker.go @@ -103,7 +103,7 @@ func (r *SensorMQTTBrokerResource) Configure(_ context.Context, req resource.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SensorMQTTBrokerResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SensorMQTTBroker + var plan, initialState SensorMQTTBroker // Read plan diags := req.Plan.Get(ctx, &plan) @@ -112,6 +112,14 @@ func (r *SensorMQTTBrokerResource) Create(ctx context.Context, req resource.Crea } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SensorMQTTBroker{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SensorMQTTBroker{}) @@ -222,8 +230,13 @@ func (r *SensorMQTTBrokerResource) Delete(ctx context.Context, req resource.Dele } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_sensor_relationships.go b/internal/provider/resource_meraki_sensor_relationships.go index c50c5940..2099e8c4 100644 --- a/internal/provider/resource_meraki_sensor_relationships.go +++ b/internal/provider/resource_meraki_sensor_relationships.go @@ -104,7 +104,7 @@ func (r *SensorRelationshipsResource) Configure(_ context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SensorRelationshipsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SensorRelationships + var plan, initialState SensorRelationships // Read plan diags := req.Plan.Get(ctx, &plan) @@ -113,6 +113,14 @@ func (r *SensorRelationshipsResource) Create(ctx context.Context, req resource.C } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SensorRelationships{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SensorRelationships{}) @@ -223,6 +231,17 @@ func (r *SensorRelationshipsResource) Delete(ctx context.Context, req resource.D } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_access_control_lists.go b/internal/provider/resource_meraki_switch_access_control_lists.go index 8215d311..bc0d51aa 100644 --- a/internal/provider/resource_meraki_switch_access_control_lists.go +++ b/internal/provider/resource_meraki_switch_access_control_lists.go @@ -147,7 +147,7 @@ func (r *SwitchAccessControlListsResource) Configure(_ context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchAccessControlListsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchAccessControlLists + var plan, initialState SwitchAccessControlLists // Read plan diags := req.Plan.Get(ctx, &plan) @@ -156,6 +156,14 @@ func (r *SwitchAccessControlListsResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchAccessControlLists{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchAccessControlLists{}) @@ -266,8 +274,13 @@ func (r *SwitchAccessControlListsResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_switch_alternate_management_interface.go b/internal/provider/resource_meraki_switch_alternate_management_interface.go index 21451053..e96ffb67 100644 --- a/internal/provider/resource_meraki_switch_alternate_management_interface.go +++ b/internal/provider/resource_meraki_switch_alternate_management_interface.go @@ -130,7 +130,7 @@ func (r *SwitchAlternateManagementInterfaceResource) Configure(_ context.Context // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchAlternateManagementInterfaceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchAlternateManagementInterface + var plan, initialState SwitchAlternateManagementInterface // Read plan diags := req.Plan.Get(ctx, &plan) @@ -139,6 +139,14 @@ func (r *SwitchAlternateManagementInterfaceResource) Create(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchAlternateManagementInterface{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchAlternateManagementInterface{}) @@ -249,6 +257,17 @@ func (r *SwitchAlternateManagementInterfaceResource) Delete(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_dhcp_server_policy.go b/internal/provider/resource_meraki_switch_dhcp_server_policy.go index f4118cfe..7e805c56 100644 --- a/internal/provider/resource_meraki_switch_dhcp_server_policy.go +++ b/internal/provider/resource_meraki_switch_dhcp_server_policy.go @@ -120,7 +120,7 @@ func (r *SwitchDHCPServerPolicyResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchDHCPServerPolicyResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchDHCPServerPolicy + var plan, initialState SwitchDHCPServerPolicy // Read plan diags := req.Plan.Get(ctx, &plan) @@ -129,6 +129,14 @@ func (r *SwitchDHCPServerPolicyResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchDHCPServerPolicy{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchDHCPServerPolicy{}) @@ -239,6 +247,17 @@ func (r *SwitchDHCPServerPolicyResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go index 9e45aa75..c2a00e97 100644 --- a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go +++ b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go @@ -112,7 +112,7 @@ func (r *SwitchDSCPToCoSMappingsResource) Configure(_ context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchDSCPToCoSMappingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchDSCPToCoSMappings + var plan, initialState SwitchDSCPToCoSMappings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -121,6 +121,14 @@ func (r *SwitchDSCPToCoSMappingsResource) Create(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchDSCPToCoSMappings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchDSCPToCoSMappings{}) @@ -231,8 +239,13 @@ func (r *SwitchDSCPToCoSMappingsResource) Delete(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_switch_mtu.go b/internal/provider/resource_meraki_switch_mtu.go index 74d02205..359cb948 100644 --- a/internal/provider/resource_meraki_switch_mtu.go +++ b/internal/provider/resource_meraki_switch_mtu.go @@ -119,7 +119,7 @@ func (r *SwitchMTUResource) Configure(_ context.Context, req resource.ConfigureR // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchMTUResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchMTU + var plan, initialState SwitchMTU // Read plan diags := req.Plan.Get(ctx, &plan) @@ -128,6 +128,14 @@ func (r *SwitchMTUResource) Create(ctx context.Context, req resource.CreateReque } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchMTU{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchMTU{}) @@ -238,6 +246,17 @@ func (r *SwitchMTUResource) Delete(ctx context.Context, req resource.DeleteReque } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_port.go b/internal/provider/resource_meraki_switch_port.go index 73209f3f..bfae422f 100644 --- a/internal/provider/resource_meraki_switch_port.go +++ b/internal/provider/resource_meraki_switch_port.go @@ -233,7 +233,7 @@ func (r *SwitchPortResource) Configure(_ context.Context, req resource.Configure // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchPortResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchPort + var plan, initialState SwitchPort // Read plan diags := req.Plan.Get(ctx, &plan) @@ -242,6 +242,14 @@ func (r *SwitchPortResource) Create(ctx context.Context, req resource.CreateRequ } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchPort{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchPort{}) @@ -352,8 +360,13 @@ func (r *SwitchPortResource) Delete(ctx context.Context, req resource.DeleteRequ } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_switch_qos_rule_order.go b/internal/provider/resource_meraki_switch_qos_rule_order.go index 50af5e9d..089d3375 100644 --- a/internal/provider/resource_meraki_switch_qos_rule_order.go +++ b/internal/provider/resource_meraki_switch_qos_rule_order.go @@ -98,7 +98,7 @@ func (r *SwitchQoSRuleOrderResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchQoSRuleOrderResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchQoSRuleOrder + var plan, initialState SwitchQoSRuleOrder // Read plan diags := req.Plan.Get(ctx, &plan) @@ -107,6 +107,14 @@ func (r *SwitchQoSRuleOrderResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchQoSRuleOrder{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchQoSRuleOrder{}) @@ -217,6 +225,17 @@ func (r *SwitchQoSRuleOrderResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go index bd58b2e1..66ed4042 100644 --- a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go @@ -208,7 +208,7 @@ func (r *SwitchRoutingInterfaceDHCPResource) Configure(_ context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchRoutingInterfaceDHCPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchRoutingInterfaceDHCP + var plan, initialState SwitchRoutingInterfaceDHCP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -217,6 +217,14 @@ func (r *SwitchRoutingInterfaceDHCPResource) Create(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchRoutingInterfaceDHCP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchRoutingInterfaceDHCP{}) @@ -327,6 +335,17 @@ func (r *SwitchRoutingInterfaceDHCPResource) Delete(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_routing_multicast.go b/internal/provider/resource_meraki_switch_routing_multicast.go index 05b311f0..7315a05d 100644 --- a/internal/provider/resource_meraki_switch_routing_multicast.go +++ b/internal/provider/resource_meraki_switch_routing_multicast.go @@ -132,7 +132,7 @@ func (r *SwitchRoutingMulticastResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchRoutingMulticastResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchRoutingMulticast + var plan, initialState SwitchRoutingMulticast // Read plan diags := req.Plan.Get(ctx, &plan) @@ -141,6 +141,14 @@ func (r *SwitchRoutingMulticastResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchRoutingMulticast{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchRoutingMulticast{}) @@ -251,6 +259,17 @@ func (r *SwitchRoutingMulticastResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_routing_ospf.go b/internal/provider/resource_meraki_switch_routing_ospf.go index aa5fc095..07b92794 100644 --- a/internal/provider/resource_meraki_switch_routing_ospf.go +++ b/internal/provider/resource_meraki_switch_routing_ospf.go @@ -176,7 +176,7 @@ func (r *SwitchRoutingOSPFResource) Configure(_ context.Context, req resource.Co // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchRoutingOSPFResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchRoutingOSPF + var plan, initialState SwitchRoutingOSPF // Read plan diags := req.Plan.Get(ctx, &plan) @@ -185,6 +185,14 @@ func (r *SwitchRoutingOSPFResource) Create(ctx context.Context, req resource.Cre } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchRoutingOSPF{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchRoutingOSPF{}) @@ -295,6 +303,17 @@ func (r *SwitchRoutingOSPFResource) Delete(ctx context.Context, req resource.Del } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_settings.go b/internal/provider/resource_meraki_switch_settings.go index 681e7420..a621831a 100644 --- a/internal/provider/resource_meraki_switch_settings.go +++ b/internal/provider/resource_meraki_switch_settings.go @@ -129,7 +129,7 @@ func (r *SwitchSettingsResource) Configure(_ context.Context, req resource.Confi // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchSettings + var plan, initialState SwitchSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -138,6 +138,14 @@ func (r *SwitchSettingsResource) Create(ctx context.Context, req resource.Create } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchSettings{}) @@ -248,6 +256,17 @@ func (r *SwitchSettingsResource) Delete(ctx context.Context, req resource.Delete } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go index 871b53bf..d9f2dda2 100644 --- a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go @@ -215,7 +215,7 @@ func (r *SwitchStackRoutingInterfaceDHCPResource) Configure(_ context.Context, r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchStackRoutingInterfaceDHCPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchStackRoutingInterfaceDHCP + var plan, initialState SwitchStackRoutingInterfaceDHCP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -224,6 +224,14 @@ func (r *SwitchStackRoutingInterfaceDHCPResource) Create(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchStackRoutingInterfaceDHCP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchStackRoutingInterfaceDHCP{}) @@ -334,6 +342,17 @@ func (r *SwitchStackRoutingInterfaceDHCPResource) Delete(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_storm_control.go b/internal/provider/resource_meraki_switch_storm_control.go index 575dec05..8118af3f 100644 --- a/internal/provider/resource_meraki_switch_storm_control.go +++ b/internal/provider/resource_meraki_switch_storm_control.go @@ -110,7 +110,7 @@ func (r *SwitchStormControlResource) Configure(_ context.Context, req resource.C // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchStormControlResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchStormControl + var plan, initialState SwitchStormControl // Read plan diags := req.Plan.Get(ctx, &plan) @@ -119,6 +119,14 @@ func (r *SwitchStormControlResource) Create(ctx context.Context, req resource.Cr } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchStormControl{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchStormControl{}) @@ -229,6 +237,17 @@ func (r *SwitchStormControlResource) Delete(ctx context.Context, req resource.De } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_stp.go b/internal/provider/resource_meraki_switch_stp.go index d4fbab17..6d327b57 100644 --- a/internal/provider/resource_meraki_switch_stp.go +++ b/internal/provider/resource_meraki_switch_stp.go @@ -124,7 +124,7 @@ func (r *SwitchSTPResource) Configure(_ context.Context, req resource.ConfigureR // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchSTPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchSTP + var plan, initialState SwitchSTP // Read plan diags := req.Plan.Get(ctx, &plan) @@ -133,6 +133,14 @@ func (r *SwitchSTPResource) Create(ctx context.Context, req resource.CreateReque } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchSTP{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchSTP{}) @@ -243,6 +251,17 @@ func (r *SwitchSTPResource) Delete(ctx context.Context, req resource.DeleteReque } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_switch_warm_spare.go b/internal/provider/resource_meraki_switch_warm_spare.go index dc6e310d..cb10c187 100644 --- a/internal/provider/resource_meraki_switch_warm_spare.go +++ b/internal/provider/resource_meraki_switch_warm_spare.go @@ -100,7 +100,7 @@ func (r *SwitchWarmSpareResource) Configure(_ context.Context, req resource.Conf // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *SwitchWarmSpareResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan SwitchWarmSpare + var plan, initialState SwitchWarmSpare // Read plan diags := req.Plan.Get(ctx, &plan) @@ -109,6 +109,14 @@ func (r *SwitchWarmSpareResource) Create(ctx context.Context, req resource.Creat } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, SwitchWarmSpare{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, SwitchWarmSpare{}) @@ -219,6 +227,17 @@ func (r *SwitchWarmSpareResource) Delete(ctx context.Context, req resource.Delet } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_air_marshal_settings.go b/internal/provider/resource_meraki_wireless_air_marshal_settings.go index 883389ad..921bbe67 100644 --- a/internal/provider/resource_meraki_wireless_air_marshal_settings.go +++ b/internal/provider/resource_meraki_wireless_air_marshal_settings.go @@ -98,10 +98,8 @@ func (r *WirelessAirMarshalSettingsResource) Configure(_ context.Context, req re // End of section. //template:end model -// Section below is generated&owned by "gen/generator.go". //template:begin create - func (r *WirelessAirMarshalSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessAirMarshalSettings + var plan, initialState WirelessAirMarshalSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -110,6 +108,22 @@ func (r *WirelessAirMarshalSettingsResource) Create(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + networkPath := fmt.Sprintf("/networks/%v", plan.NetworkId.ValueString()) + nres, err := r.client.Get(networkPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve network (GET), got error: %s, %s", err, nres.String())) + return + } + orgId := nres.Get("organizationId").String() + settingsPath := fmt.Sprintf("/organizations/%v/wireless/airMarshal/settings/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + gres, err := r.client.Get(settingsPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve rules (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessAirMarshalSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessAirMarshalSettings{}) @@ -129,8 +143,6 @@ func (r *WirelessAirMarshalSettingsResource) Create(ctx context.Context, req res helpers.SetFlagImporting(ctx, false, resp.Private, &resp.Diagnostics) } -// End of section. //template:end create - func (r *WirelessAirMarshalSettingsResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state WirelessAirMarshalSettings @@ -231,6 +243,17 @@ func (r *WirelessAirMarshalSettingsResource) Delete(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_alternate_management_interface.go b/internal/provider/resource_meraki_wireless_alternate_management_interface.go index 268dca95..a3518bd2 100644 --- a/internal/provider/resource_meraki_wireless_alternate_management_interface.go +++ b/internal/provider/resource_meraki_wireless_alternate_management_interface.go @@ -138,7 +138,7 @@ func (r *WirelessAlternateManagementInterfaceResource) Configure(_ context.Conte // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessAlternateManagementInterfaceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessAlternateManagementInterface + var plan, initialState WirelessAlternateManagementInterface // Read plan diags := req.Plan.Get(ctx, &plan) @@ -147,6 +147,14 @@ func (r *WirelessAlternateManagementInterfaceResource) Create(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessAlternateManagementInterface{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessAlternateManagementInterface{}) @@ -257,6 +265,17 @@ func (r *WirelessAlternateManagementInterfaceResource) Delete(ctx context.Contex } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_billing.go b/internal/provider/resource_meraki_wireless_billing.go index ed9ec60f..b0ac0f64 100644 --- a/internal/provider/resource_meraki_wireless_billing.go +++ b/internal/provider/resource_meraki_wireless_billing.go @@ -125,7 +125,7 @@ func (r *WirelessBillingResource) Configure(_ context.Context, req resource.Conf // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessBillingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessBilling + var plan, initialState WirelessBilling // Read plan diags := req.Plan.Get(ctx, &plan) @@ -134,6 +134,14 @@ func (r *WirelessBillingResource) Create(ctx context.Context, req resource.Creat } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessBilling{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessBilling{}) @@ -244,6 +252,17 @@ func (r *WirelessBillingResource) Delete(ctx context.Context, req resource.Delet } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go index 4a13efd3..dd824373 100644 --- a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go @@ -104,7 +104,7 @@ func (r *WirelessDeviceBluetoothSettingsResource) Configure(_ context.Context, r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessDeviceBluetoothSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessDeviceBluetoothSettings + var plan, initialState WirelessDeviceBluetoothSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -113,6 +113,14 @@ func (r *WirelessDeviceBluetoothSettingsResource) Create(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessDeviceBluetoothSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessDeviceBluetoothSettings{}) @@ -223,6 +231,17 @@ func (r *WirelessDeviceBluetoothSettingsResource) Delete(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go index 191f2389..39ada76d 100644 --- a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go @@ -100,7 +100,7 @@ func (r *WirelessDeviceElectronicShelfLabelResource) Configure(_ context.Context // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessDeviceElectronicShelfLabelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessDeviceElectronicShelfLabel + var plan, initialState WirelessDeviceElectronicShelfLabel // Read plan diags := req.Plan.Get(ctx, &plan) @@ -109,6 +109,14 @@ func (r *WirelessDeviceElectronicShelfLabelResource) Create(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessDeviceElectronicShelfLabel{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessDeviceElectronicShelfLabel{}) @@ -219,6 +227,17 @@ func (r *WirelessDeviceElectronicShelfLabelResource) Delete(ctx context.Context, } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_location_scanning.go b/internal/provider/resource_meraki_wireless_location_scanning.go index d0cce03b..34b15d56 100644 --- a/internal/provider/resource_meraki_wireless_location_scanning.go +++ b/internal/provider/resource_meraki_wireless_location_scanning.go @@ -31,7 +31,6 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" - "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -98,10 +97,8 @@ func (r *WirelessLocationScanningResource) Configure(_ context.Context, req reso // End of section. //template:end model -// Section below is generated&owned by "gen/generator.go". //template:begin create - func (r *WirelessLocationScanningResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessLocationScanning + var plan, initialState WirelessLocationScanning // Read plan diags := req.Plan.Get(ctx, &plan) @@ -110,6 +107,22 @@ func (r *WirelessLocationScanningResource) Create(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + networkPath := fmt.Sprintf("/networks/%v", plan.NetworkId.ValueString()) + nres, err := r.client.Get(networkPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve network (GET), got error: %s, %s", err, nres.String())) + return + } + orgId := nres.Get("organizationId").String() + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + gres, err := r.client.Get(getPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve wireless location scanning (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessLocationScanning{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessLocationScanning{}) @@ -129,8 +142,6 @@ func (r *WirelessLocationScanningResource) Create(ctx context.Context, req resou helpers.SetFlagImporting(ctx, false, resp.Private, &resp.Diagnostics) } -// End of section. //template:end create - func (r *WirelessLocationScanningResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state WirelessLocationScanning @@ -153,7 +164,7 @@ func (r *WirelessLocationScanningResource) Read(ctx context.Context, req resourc } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork", orgId) + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, state.NetworkId.ValueString()) res, err = r.client.Get(getPath) if err != nil && (strings.Contains(err.Error(), "StatusCode 404") || strings.Contains(err.Error(), "StatusCode 400")) { resp.State.RemoveResource(ctx) @@ -163,15 +174,7 @@ func (r *WirelessLocationScanningResource) Read(ctx context.Context, req resourc return } - if len(res.Get("items").Array()) > 0 { - res.Get("items").ForEach(func(k, v gjson.Result) bool { - if state.Id.ValueString() == v.Get("networkId").String() { - res = meraki.Res{Result: v} - return false - } - return true - }) - } + res = meraki.Res{Result: res.Get("items.0")} imp, diags := helpers.IsFlagImporting(ctx, req) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { @@ -239,6 +242,17 @@ func (r *WirelessLocationScanningResource) Delete(ctx context.Context, req resou } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go index e6cee7d4..17c9e2c4 100644 --- a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go @@ -121,7 +121,7 @@ func (r *WirelessNetworkBluetoothSettingsResource) Configure(_ context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessNetworkBluetoothSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessNetworkBluetoothSettings + var plan, initialState WirelessNetworkBluetoothSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -130,6 +130,14 @@ func (r *WirelessNetworkBluetoothSettingsResource) Create(ctx context.Context, r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessNetworkBluetoothSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessNetworkBluetoothSettings{}) @@ -240,6 +248,17 @@ func (r *WirelessNetworkBluetoothSettingsResource) Delete(ctx context.Context, r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go index 73ceba85..09f93400 100644 --- a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go @@ -109,7 +109,7 @@ func (r *WirelessNetworkElectronicShelfLabelResource) Configure(_ context.Contex // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessNetworkElectronicShelfLabelResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessNetworkElectronicShelfLabel + var plan, initialState WirelessNetworkElectronicShelfLabel // Read plan diags := req.Plan.Get(ctx, &plan) @@ -118,6 +118,14 @@ func (r *WirelessNetworkElectronicShelfLabelResource) Create(ctx context.Context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessNetworkElectronicShelfLabel{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessNetworkElectronicShelfLabel{}) @@ -228,6 +236,17 @@ func (r *WirelessNetworkElectronicShelfLabelResource) Delete(ctx context.Context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_radio_settings.go b/internal/provider/resource_meraki_wireless_radio_settings.go index 593d9767..b59354d5 100644 --- a/internal/provider/resource_meraki_wireless_radio_settings.go +++ b/internal/provider/resource_meraki_wireless_radio_settings.go @@ -116,7 +116,7 @@ func (r *WirelessRadioSettingsResource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessRadioSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessRadioSettings + var plan, initialState WirelessRadioSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -125,6 +125,14 @@ func (r *WirelessRadioSettingsResource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessRadioSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessRadioSettings{}) @@ -235,6 +243,17 @@ func (r *WirelessRadioSettingsResource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_settings.go b/internal/provider/resource_meraki_wireless_settings.go index db249bbe..af3c543c 100644 --- a/internal/provider/resource_meraki_wireless_settings.go +++ b/internal/provider/resource_meraki_wireless_settings.go @@ -125,7 +125,7 @@ func (r *WirelessSettingsResource) Configure(_ context.Context, req resource.Con // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSettings + var plan, initialState WirelessSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -134,6 +134,14 @@ func (r *WirelessSettingsResource) Create(ctx context.Context, req resource.Crea } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSettings{}) @@ -244,6 +252,17 @@ func (r *WirelessSettingsResource) Delete(ctx context.Context, req resource.Dele } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid.go b/internal/provider/resource_meraki_wireless_ssid.go index a85c7d54..c8a5d1f7 100644 --- a/internal/provider/resource_meraki_wireless_ssid.go +++ b/internal/provider/resource_meraki_wireless_ssid.go @@ -581,7 +581,7 @@ func (r *WirelessSSIDResource) Configure(_ context.Context, req resource.Configu // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSID + var plan, initialState WirelessSSID // Read plan diags := req.Plan.Get(ctx, &plan) @@ -590,6 +590,14 @@ func (r *WirelessSSIDResource) Create(ctx context.Context, req resource.CreateRe } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSID{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSID{}) @@ -700,8 +708,13 @@ func (r *WirelessSSIDResource) Delete(ctx context.Context, req resource.DeleteRe } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go index 7fd5f370..85d050ae 100644 --- a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go +++ b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go @@ -129,7 +129,7 @@ func (r *WirelessSSIDBonjourForwardingResource) Configure(_ context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDBonjourForwardingResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDBonjourForwarding + var plan, initialState WirelessSSIDBonjourForwarding // Read plan diags := req.Plan.Get(ctx, &plan) @@ -138,6 +138,14 @@ func (r *WirelessSSIDBonjourForwardingResource) Create(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDBonjourForwarding{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDBonjourForwarding{}) @@ -248,6 +256,17 @@ func (r *WirelessSSIDBonjourForwardingResource) Delete(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go index d7989513..cecfe743 100644 --- a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go +++ b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go @@ -131,7 +131,7 @@ func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Configure(_ context.Contex // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDDeviceTypeGroupPolicies + var plan, initialState WirelessSSIDDeviceTypeGroupPolicies // Read plan diags := req.Plan.Get(ctx, &plan) @@ -140,6 +140,14 @@ func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Create(ctx context.Context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDDeviceTypeGroupPolicies{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDDeviceTypeGroupPolicies{}) @@ -250,6 +258,17 @@ func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Delete(ctx context.Context } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_eap_override.go b/internal/provider/resource_meraki_wireless_ssid_eap_override.go index 58207ff0..fac5cc54 100644 --- a/internal/provider/resource_meraki_wireless_ssid_eap_override.go +++ b/internal/provider/resource_meraki_wireless_ssid_eap_override.go @@ -123,7 +123,7 @@ func (r *WirelessSSIDEAPOverrideResource) Configure(_ context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDEAPOverrideResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDEAPOverride + var plan, initialState WirelessSSIDEAPOverride // Read plan diags := req.Plan.Get(ctx, &plan) @@ -132,6 +132,14 @@ func (r *WirelessSSIDEAPOverrideResource) Create(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDEAPOverride{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDEAPOverride{}) @@ -242,6 +250,17 @@ func (r *WirelessSSIDEAPOverrideResource) Delete(ctx context.Context, req resour } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go index ebbc4661..6040ae66 100644 --- a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go +++ b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go @@ -205,7 +205,7 @@ func (r *WirelessSSIDHotspot20Resource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDHotspot20Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDHotspot20 + var plan, initialState WirelessSSIDHotspot20 // Read plan diags := req.Plan.Get(ctx, &plan) @@ -214,6 +214,14 @@ func (r *WirelessSSIDHotspot20Resource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDHotspot20{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDHotspot20{}) @@ -324,6 +332,17 @@ func (r *WirelessSSIDHotspot20Resource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go index 75bc8ada..1b4bef04 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go @@ -146,7 +146,7 @@ func (r *WirelessSSIDL3FirewallRulesResource) Configure(_ context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDL3FirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDL3FirewallRules + var plan, initialState WirelessSSIDL3FirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -155,6 +155,14 @@ func (r *WirelessSSIDL3FirewallRulesResource) Create(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDL3FirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDL3FirewallRules{}) @@ -265,8 +273,13 @@ func (r *WirelessSSIDL3FirewallRulesResource) Delete(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go index 43f3a0f5..c9d4f00c 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go @@ -127,7 +127,7 @@ func (r *WirelessSSIDL7FirewallRulesResource) Configure(_ context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDL7FirewallRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDL7FirewallRules + var plan, initialState WirelessSSIDL7FirewallRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -136,6 +136,14 @@ func (r *WirelessSSIDL7FirewallRulesResource) Create(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDL7FirewallRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDL7FirewallRules{}) @@ -246,8 +254,13 @@ func (r *WirelessSSIDL7FirewallRulesResource) Delete(ctx context.Context, req re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_wireless_ssid_schedules.go b/internal/provider/resource_meraki_wireless_ssid_schedules.go index dc7d042b..541b3dd4 100644 --- a/internal/provider/resource_meraki_wireless_ssid_schedules.go +++ b/internal/provider/resource_meraki_wireless_ssid_schedules.go @@ -143,7 +143,7 @@ func (r *WirelessSSIDSchedulesResource) Configure(_ context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDSchedulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDSchedules + var plan, initialState WirelessSSIDSchedules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -152,6 +152,14 @@ func (r *WirelessSSIDSchedulesResource) Create(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDSchedules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDSchedules{}) @@ -262,6 +270,17 @@ func (r *WirelessSSIDSchedulesResource) Delete(ctx context.Context, req resource } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go index d63fb09c..91ae4792 100644 --- a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go +++ b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go @@ -253,7 +253,7 @@ func (r *WirelessSSIDSplashSettingsResource) Configure(_ context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDSplashSettingsResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDSplashSettings + var plan, initialState WirelessSSIDSplashSettings // Read plan diags := req.Plan.Get(ctx, &plan) @@ -262,6 +262,14 @@ func (r *WirelessSSIDSplashSettingsResource) Create(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDSplashSettings{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDSplashSettings{}) @@ -372,6 +380,17 @@ func (r *WirelessSSIDSplashSettingsResource) Delete(ctx context.Context, req res } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go index 280b4ac4..1db875fb 100644 --- a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go @@ -156,7 +156,7 @@ func (r *WirelessSSIDTrafficShapingRulesResource) Configure(_ context.Context, r // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDTrafficShapingRulesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDTrafficShapingRules + var plan, initialState WirelessSSIDTrafficShapingRules // Read plan diags := req.Plan.Get(ctx, &plan) @@ -165,6 +165,14 @@ func (r *WirelessSSIDTrafficShapingRulesResource) Create(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDTrafficShapingRules{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDTrafficShapingRules{}) @@ -275,8 +283,13 @@ func (r *WirelessSSIDTrafficShapingRulesResource) Delete(ctx context.Context, re } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) - res, err := r.client.Put(state.getPath(), body) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_wireless_ssid_vpn.go b/internal/provider/resource_meraki_wireless_ssid_vpn.go index f373ac2d..01c8f6ba 100644 --- a/internal/provider/resource_meraki_wireless_ssid_vpn.go +++ b/internal/provider/resource_meraki_wireless_ssid_vpn.go @@ -156,7 +156,7 @@ func (r *WirelessSSIDVPNResource) Configure(_ context.Context, req resource.Conf // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessSSIDVPNResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessSSIDVPN + var plan, initialState WirelessSSIDVPN // Read plan diags := req.Plan.Get(ctx, &plan) @@ -165,6 +165,14 @@ func (r *WirelessSSIDVPNResource) Create(ctx context.Context, req resource.Creat } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessSSIDVPN{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessSSIDVPN{}) @@ -275,6 +283,17 @@ func (r *WirelessSSIDVPNResource) Delete(ctx context.Context, req resource.Delet } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_zigbee.go b/internal/provider/resource_meraki_wireless_zigbee.go index 0a0f1b72..f597c16e 100644 --- a/internal/provider/resource_meraki_wireless_zigbee.go +++ b/internal/provider/resource_meraki_wireless_zigbee.go @@ -122,10 +122,8 @@ func (r *WirelessZigbeeResource) Configure(_ context.Context, req resource.Confi // End of section. //template:end model -// Section below is generated&owned by "gen/generator.go". //template:begin create - func (r *WirelessZigbeeResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessZigbee + var plan, initialState WirelessZigbee // Read plan diags := req.Plan.Get(ctx, &plan) @@ -134,6 +132,22 @@ func (r *WirelessZigbeeResource) Create(ctx context.Context, req resource.Create } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + networkPath := fmt.Sprintf("/networks/%v", plan.NetworkId.ValueString()) + nres, err := r.client.Get(networkPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve network (GET), got error: %s, %s", err, nres.String())) + return + } + orgId := nres.Get("organizationId").String() + settingsPath := fmt.Sprintf("/organizations/%v/wireless/zigbee/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + gres, err := r.client.Get(settingsPath) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve zigbee settings (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessZigbee{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessZigbee{}) @@ -153,8 +167,6 @@ func (r *WirelessZigbeeResource) Create(ctx context.Context, req resource.Create helpers.SetFlagImporting(ctx, false, resp.Private, &resp.Diagnostics) } -// End of section. //template:end create - func (r *WirelessZigbeeResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { var state WirelessZigbee @@ -255,6 +267,17 @@ func (r *WirelessZigbeeResource) Delete(ctx context.Context, req resource.Delete } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_zigbee_device.go b/internal/provider/resource_meraki_wireless_zigbee_device.go index 9ff93fd4..5b1a9a4a 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_device.go +++ b/internal/provider/resource_meraki_wireless_zigbee_device.go @@ -107,7 +107,7 @@ func (r *WirelessZigbeeDeviceResource) Configure(_ context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessZigbeeDeviceResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessZigbeeDevice + var plan, initialState WirelessZigbeeDevice // Read plan diags := req.Plan.Get(ctx, &plan) @@ -116,6 +116,14 @@ func (r *WirelessZigbeeDeviceResource) Create(ctx context.Context, req resource. } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessZigbeeDevice{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessZigbeeDevice{}) @@ -226,6 +234,17 @@ func (r *WirelessZigbeeDeviceResource) Delete(ctx context.Context, req resource. } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go index 3050cded..254830c7 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go +++ b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go @@ -103,7 +103,7 @@ func (r *WirelessZigbeeDoorLockResource) Configure(_ context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *WirelessZigbeeDoorLockResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan WirelessZigbeeDoorLock + var plan, initialState WirelessZigbeeDoorLock // Read plan diags := req.Plan.Get(ctx, &plan) @@ -112,6 +112,14 @@ func (r *WirelessZigbeeDoorLockResource) Create(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) + // If the resource is a singleton, we need to read and save the initial state + gres, err := r.client.Get(plan.getPath()) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) + return + } + initialState.fromBody(ctx, gres) + helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessZigbeeDoorLock{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, WirelessZigbeeDoorLock{}) @@ -222,6 +230,17 @@ func (r *WirelessZigbeeDoorLockResource) Delete(ctx context.Context, req resourc } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + res, err := r.client.Put(state.getPath(), jsonInitialState) + if err != nil { + resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + return + } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) From cf7f41ffffac7d7e3a1d1bb56fdaf40a6445c3fe Mon Sep 17 00:00:00 2001 From: danischm Date: Mon, 15 Sep 2025 16:52:38 +0200 Subject: [PATCH 2/7] Update destroy values and fix corner cases --- .../wireless_ssid_eap_override.md | 4 +- docs/resources/wireless_ssid_eap_override.md | 4 +- .../appliance_cellular_firewall_rules.yaml | 1 - ..._connectivity_monitoring_destinations.yaml | 8 ---- ...pliance_firewall_multicast_forwarding.yaml | 1 - ...iance_inbound_cellular_firewall_rules.yaml | 1 - .../appliance_inbound_firewall_rules.yaml | 1 - .../appliance_l3_firewall_rules.yaml | 1 - .../appliance_l7_firewall_rules.yaml | 1 - .../appliance_one_to_many_nat_rules.yaml | 1 - .../appliance_one_to_one_nat_rules.yaml | 1 - ...iance_organization_security_intrusion.yaml | 1 - .../appliance_port_forwarding_rules.yaml | 1 - .../appliance_sdwan_internet_policies.yaml | 1 - .../appliance_third_party_vpn_peers.yaml | 1 - .../appliance_traffic_shaping_rules.yaml | 1 - ...ance_traffic_shaping_uplink_selection.yaml | 1 - ...liance_traffic_shaping_vpn_exclusions.yaml | 2 - .../appliance_vpn_firewall_rules.yaml | 1 - ...nce_vpn_site_to_site_ipsec_peers_slas.yaml | 1 - .../camera_device_wireless_profiles.yaml | 1 + ..._connectivity_monitoring_destinations.yaml | 8 ---- gen/definitions/cellular_gateway_lan.yaml | 2 - ...ellular_gateway_port_forwarding_rules.yaml | 1 - gen/definitions/cellular_gateway_uplink.yaml | 2 + gen/definitions/network_syslog_servers.yaml | 1 - .../organization_adaptive_policy.yaml | 2 + .../switch_access_control_lists.yaml | 1 - .../switch_dscp_to_cos_mappings.yaml | 1 - gen/definitions/switch_port.yaml | 4 +- gen/definitions/wireless_ssid.yaml | 17 --------- .../wireless_ssid_eap_override.yaml | 8 +++- .../wireless_ssid_l3_firewall_rules.yaml | 1 - .../wireless_ssid_l7_firewall_rules.yaml | 1 - .../wireless_ssid_traffic_shaping_rules.yaml | 1 - gen/templates/bulk/model_resource.go | 6 +-- gen/templates/bulk/resource.go | 4 +- gen/templates/model.go | 7 ++-- gen/templates/resource.go | 3 +- ...aki_organization_adaptive_policies_test.go | 3 ++ ...eraki_organization_adaptive_policy_test.go | 3 ++ ...ource_meraki_wireless_location_scanning.go | 13 ++++++- ...ource_meraki_wireless_ssid_eap_override.go | 2 +- ..._meraki_wireless_ssid_eap_override_test.go | 5 +++ ...eraki_appliance_cellular_firewall_rules.go | 8 ++-- ...ce_connectivity_monitoring_destinations.go | 14 ++----- ...odel_meraki_appliance_content_filtering.go | 7 ++-- ...odel_meraki_appliance_dns_local_profile.go | 7 ++-- ...appliance_dns_local_profile_assignments.go | 7 ++-- ...model_meraki_appliance_dns_local_record.go | 7 ++-- ...odel_meraki_appliance_dns_split_profile.go | 7 ++-- ...appliance_dns_split_profile_assignments.go | 7 ++-- ...appliance_firewall_multicast_forwarding.go | 8 ++-- ...odel_meraki_appliance_firewall_settings.go | 7 ++-- ...del_meraki_appliance_firewalled_service.go | 7 ++-- ...pliance_inbound_cellular_firewall_rules.go | 8 ++-- ...meraki_appliance_inbound_firewall_rules.go | 8 ++-- ...odel_meraki_appliance_l3_firewall_rules.go | 8 ++-- ...odel_meraki_appliance_l7_firewall_rules.go | 8 ++-- ...ki_appliance_network_security_intrusion.go | 7 ++-- ..._meraki_appliance_one_to_many_nat_rules.go | 8 ++-- ...l_meraki_appliance_one_to_one_nat_rules.go | 8 ++-- ...pliance_organization_security_intrusion.go | 8 ++-- .../provider/model_meraki_appliance_port.go | 7 ++-- ..._meraki_appliance_port_forwarding_rules.go | 8 ++-- ...eraki_appliance_prefix_delegated_static.go | 7 ++-- .../model_meraki_appliance_radio_settings.go | 7 ++-- .../model_meraki_appliance_rf_profile.go | 7 ++-- ...eraki_appliance_sdwan_internet_policies.go | 8 ++-- ...model_meraki_appliance_security_malware.go | 7 ++-- .../model_meraki_appliance_settings.go | 7 ++-- .../model_meraki_appliance_single_lan.go | 7 ++-- ...model_meraki_appliance_site_to_site_vpn.go | 7 ++-- .../provider/model_meraki_appliance_ssid.go | 7 ++-- .../model_meraki_appliance_static_route.go | 7 ++-- ..._meraki_appliance_third_party_vpn_peers.go | 8 ++-- .../model_meraki_appliance_traffic_shaping.go | 7 ++-- ...raffic_shaping_custom_performance_class.go | 7 ++-- ..._meraki_appliance_traffic_shaping_rules.go | 8 ++-- ...liance_traffic_shaping_uplink_bandwidth.go | 7 ++-- ...liance_traffic_shaping_uplink_selection.go | 8 ++-- ...ppliance_traffic_shaping_vpn_exclusions.go | 9 ++--- ...model_meraki_appliance_uplinks_settings.go | 7 ++-- .../provider/model_meraki_appliance_vlan.go | 7 ++-- .../model_meraki_appliance_vlan_dhcp.go | 7 ++-- .../model_meraki_appliance_vlans_settings.go | 7 ++-- ...raki_appliance_vmx_authentication_token.go | 7 ++-- .../model_meraki_appliance_vpn_bgp.go | 7 ++-- ...del_meraki_appliance_vpn_firewall_rules.go | 8 ++-- ...iance_vpn_site_to_site_ipsec_peers_slas.go | 8 ++-- .../model_meraki_appliance_warm_spare.go | 7 ++-- .../model_meraki_camera_custom_analytics.go | 7 ++-- ..._meraki_camera_device_wireless_profiles.go | 7 ++-- .../model_meraki_camera_quality_retention.go | 7 ++-- ...meraki_camera_quality_retention_profile.go | 7 ++-- internal/provider/model_meraki_camera_role.go | 7 ++-- .../provider/model_meraki_camera_sense.go | 7 ++-- .../model_meraki_camera_video_settings.go | 7 ++-- .../model_meraki_camera_wireless_profile.go | 7 ++-- ...ay_connectivity_monitoring_destinations.go | 14 ++----- .../model_meraki_cellular_gateway_dhcp.go | 7 ++-- .../model_meraki_cellular_gateway_lan.go | 9 ++--- ..._cellular_gateway_port_forwarding_rules.go | 8 ++-- ...del_meraki_cellular_gateway_subnet_pool.go | 7 ++-- .../model_meraki_cellular_gateway_uplink.go | 9 +++-- internal/provider/model_meraki_device.go | 7 ++-- .../model_meraki_device_cellular_sims.go | 7 ++-- ...odel_meraki_device_management_interface.go | 7 ++-- ...l_meraki_insight_monitored_media_server.go | 7 ++-- internal/provider/model_meraki_network.go | 7 ++-- .../model_meraki_network_alerts_settings.go | 7 ++-- .../model_meraki_network_client_policy.go | 7 ++-- ...work_client_splash_authorization_status.go | 7 ++-- .../model_meraki_network_device_claim.go | 7 ++-- .../model_meraki_network_device_claim_vmx.go | 7 ++-- .../model_meraki_network_firmware_upgrades.go | 7 ++-- .../model_meraki_network_floor_plan.go | 7 ++-- .../model_meraki_network_group_policy.go | 7 ++-- .../model_meraki_network_meraki_auth_user.go | 7 ++-- .../model_meraki_network_mqtt_broker.go | 7 ++-- .../provider/model_meraki_network_netflow.go | 7 ++-- .../provider/model_meraki_network_settings.go | 7 ++-- .../provider/model_meraki_network_snmp.go | 7 ++-- .../model_meraki_network_syslog_servers.go | 8 ++-- .../model_meraki_network_traffic_analysis.go | 7 ++-- .../model_meraki_network_vlan_profile.go | 7 ++-- ...odel_meraki_network_webhook_http_server.go | 7 ++-- ...meraki_network_webhook_payload_template.go | 7 ++-- .../provider/model_meraki_organization.go | 7 ++-- ...del_meraki_organization_adaptive_policy.go | 7 ++-- ...meraki_organization_adaptive_policy_acl.go | 7 ++-- ...raki_organization_adaptive_policy_group.go | 7 ++-- ...i_organization_adaptive_policy_settings.go | 7 ++-- .../model_meraki_organization_admin.go | 7 ++-- ...odel_meraki_organization_alerts_profile.go | 7 ++-- ..._meraki_organization_auth_radius_server.go | 7 ++-- ...ganization_branding_policies_priorities.go | 7 ++-- ...del_meraki_organization_branding_policy.go | 7 ++-- ...del_meraki_organization_config_template.go | 7 ++-- ...ganization_early_access_features_opt_in.go | 7 ++-- ...zation_extensions_thousand_eyes_network.go | 7 ++-- ...del_meraki_organization_inventory_claim.go | 7 ++-- .../model_meraki_organization_license.go | 7 ++-- ...odel_meraki_organization_login_security.go | 7 ++-- ...model_meraki_organization_policy_object.go | 7 ++-- ...meraki_organization_policy_object_group.go | 7 ++-- .../model_meraki_organization_saml.go | 7 ++-- .../model_meraki_organization_saml_idp.go | 7 ++-- .../model_meraki_organization_saml_role.go | 7 ++-- .../model_meraki_organization_snmp.go | 7 ++-- .../model_meraki_sensor_alerts_profile.go | 7 ++-- .../model_meraki_sensor_mqtt_broker.go | 7 ++-- .../model_meraki_sensor_relationships.go | 7 ++-- .../provider/model_meraki_sm_admin_role.go | 7 ++-- .../provider/model_meraki_sm_target_group.go | 7 ++-- ...odel_meraki_switch_access_control_lists.go | 8 ++-- .../model_meraki_switch_access_policy.go | 7 ++-- ...i_switch_alternate_management_interface.go | 7 ++-- .../model_meraki_switch_dhcp_server_policy.go | 7 ++-- ...er_policy_arp_inspection_trusted_server.go | 7 ++-- ...odel_meraki_switch_dscp_to_cos_mappings.go | 8 ++-- .../model_meraki_switch_link_aggregation.go | 7 ++-- internal/provider/model_meraki_switch_mtu.go | 7 ++-- ...eraki_switch_organization_ports_profile.go | 7 ++-- ..._organization_ports_profiles_automation.go | 7 ++-- internal/provider/model_meraki_switch_port.go | 3 +- .../model_meraki_switch_port_schedule.go | 7 ++-- .../provider/model_meraki_switch_qos_rule.go | 7 ++-- .../model_meraki_switch_qos_rule_order.go | 7 ++-- .../model_meraki_switch_routing_interface.go | 7 ++-- ...el_meraki_switch_routing_interface_dhcp.go | 7 ++-- .../model_meraki_switch_routing_multicast.go | 7 ++-- ...itch_routing_multicast_rendezvous_point.go | 7 ++-- .../model_meraki_switch_routing_ospf.go | 7 ++-- ...odel_meraki_switch_routing_static_route.go | 7 ++-- .../provider/model_meraki_switch_settings.go | 7 ++-- .../provider/model_meraki_switch_stack.go | 7 ++-- ...l_meraki_switch_stack_routing_interface.go | 7 ++-- ...aki_switch_stack_routing_interface_dhcp.go | 7 ++-- ...eraki_switch_stack_routing_static_route.go | 7 ++-- .../model_meraki_switch_storm_control.go | 7 ++-- internal/provider/model_meraki_switch_stp.go | 7 ++-- .../model_meraki_switch_warm_spare.go | 7 ++-- .../model_meraki_wireless_air_marshal_rule.go | 7 ++-- ...el_meraki_wireless_air_marshal_settings.go | 7 ++-- ...wireless_alternate_management_interface.go | 7 ++-- .../provider/model_meraki_wireless_billing.go | 7 ++-- ...raki_wireless_device_bluetooth_settings.go | 7 ++-- ..._wireless_device_electronic_shelf_label.go | 7 ++-- ...l_meraki_wireless_ethernet_port_profile.go | 7 ++-- ...i_wireless_ethernet_port_profile_assign.go | 7 ++-- ..._wireless_ethernet_port_profile_default.go | 7 ++-- ...model_meraki_wireless_location_scanning.go | 7 ++-- ...aki_wireless_location_scanning_receiver.go | 7 ++-- ...aki_wireless_network_bluetooth_settings.go | 7 ++-- ...wireless_network_electronic_shelf_label.go | 7 ++-- .../model_meraki_wireless_radio_settings.go | 7 ++-- .../model_meraki_wireless_rf_profile.go | 7 ++-- .../model_meraki_wireless_settings.go | 7 ++-- .../provider/model_meraki_wireless_ssid.go | 24 ++---------- ...meraki_wireless_ssid_bonjour_forwarding.go | 7 ++-- ...ireless_ssid_device_type_group_policies.go | 7 ++-- ...model_meraki_wireless_ssid_eap_override.go | 8 ++-- ...ssid_firewall_isolation_allowlist_entry.go | 7 ++-- .../model_meraki_wireless_ssid_hotspot_20.go | 7 ++-- ...model_meraki_wireless_ssid_identity_psk.go | 7 ++-- ..._meraki_wireless_ssid_l3_firewall_rules.go | 8 ++-- ..._meraki_wireless_ssid_l7_firewall_rules.go | 8 ++-- .../model_meraki_wireless_ssid_schedules.go | 7 ++-- ...el_meraki_wireless_ssid_splash_settings.go | 7 ++-- ...aki_wireless_ssid_traffic_shaping_rules.go | 8 ++-- .../model_meraki_wireless_ssid_vpn.go | 7 ++-- .../provider/model_meraki_wireless_zigbee.go | 7 ++-- .../model_meraki_wireless_zigbee_device.go | 7 ++-- .../model_meraki_wireless_zigbee_door_lock.go | 7 ++-- .../model_resource_meraki_appliance_ports.go | 6 +-- ...raki_appliance_prefix_delegated_statics.go | 6 +-- ...l_resource_meraki_appliance_rf_profiles.go | 6 +-- .../model_resource_meraki_appliance_ssids.go | 6 +-- ...ffic_shaping_custom_performance_classes.go | 6 +-- .../model_resource_meraki_appliance_vlans.go | 6 +-- .../provider/model_resource_meraki_devices.go | 6 +-- ..._resource_meraki_network_group_policies.go | 6 +-- ...source_meraki_network_meraki_auth_users.go | 6 +-- ...eraki_network_webhook_payload_templates.go | 6 +-- ...e_meraki_organization_adaptive_policies.go | 6 +-- ...aki_organization_adaptive_policy_groups.go | 6 +-- ...l_resource_meraki_organization_licenses.go | 6 +-- ...eraki_organization_policy_object_groups.go | 6 +-- ...urce_meraki_organization_policy_objects.go | 6 +-- ..._resource_meraki_organization_saml_idps.go | 6 +-- ..._resource_meraki_sensor_alerts_profiles.go | 6 +-- ...del_resource_meraki_sensor_mqtt_brokers.go | 6 +-- .../model_resource_meraki_sm_admin_roles.go | 6 +-- ..._resource_meraki_switch_access_policies.go | 6 +-- ...esource_meraki_switch_link_aggregations.go | 6 +-- .../model_resource_meraki_switch_ports.go | 2 +- ...source_meraki_switch_routing_interfaces.go | 6 +-- ...tch_routing_multicast_rendezvous_points.go | 6 +-- ...rce_meraki_switch_routing_static_routes.go | 6 +-- ..._meraki_switch_stack_routing_interfaces.go | 6 +-- ...raki_switch_stack_routing_static_routes.go | 6 +-- ...el_resource_meraki_wireless_rf_profiles.go | 6 +-- ...urce_meraki_wireless_ssid_identity_psks.go | 6 +-- .../model_resource_meraki_wireless_ssids.go | 23 ++---------- ...eraki_appliance_cellular_firewall_rules.go | 1 + ...ce_connectivity_monitoring_destinations.go | 1 + ...urce_meraki_appliance_content_filtering.go | 1 + ...appliance_firewall_multicast_forwarding.go | 1 + ...urce_meraki_appliance_firewall_settings.go | 1 + ...rce_meraki_appliance_firewalled_service.go | 1 + ...pliance_inbound_cellular_firewall_rules.go | 1 + ...meraki_appliance_inbound_firewall_rules.go | 1 + ...urce_meraki_appliance_l3_firewall_rules.go | 1 + ...urce_meraki_appliance_l7_firewall_rules.go | 1 + ...ki_appliance_network_security_intrusion.go | 1 + ..._meraki_appliance_one_to_many_nat_rules.go | 1 + ...e_meraki_appliance_one_to_one_nat_rules.go | 1 + ...pliance_organization_security_intrusion.go | 1 + .../resource_meraki_appliance_port.go | 1 + ..._meraki_appliance_port_forwarding_rules.go | 1 + ...esource_meraki_appliance_radio_settings.go | 1 + ...eraki_appliance_sdwan_internet_policies.go | 1 + ...ource_meraki_appliance_security_malware.go | 1 + .../resource_meraki_appliance_settings.go | 1 + .../resource_meraki_appliance_single_lan.go | 1 + ...ource_meraki_appliance_site_to_site_vpn.go | 1 + .../resource_meraki_appliance_ssid.go | 1 + ..._meraki_appliance_third_party_vpn_peers.go | 1 + ...source_meraki_appliance_traffic_shaping.go | 1 + ..._meraki_appliance_traffic_shaping_rules.go | 1 + ...liance_traffic_shaping_uplink_bandwidth.go | 1 + ...liance_traffic_shaping_uplink_selection.go | 4 +- ...ppliance_traffic_shaping_vpn_exclusions.go | 1 + ...ource_meraki_appliance_uplinks_settings.go | 1 + .../resource_meraki_appliance_vlan_dhcp.go | 1 + ...esource_meraki_appliance_vlans_settings.go | 1 + .../resource_meraki_appliance_vpn_bgp.go | 1 + ...rce_meraki_appliance_vpn_firewall_rules.go | 1 + ...iance_vpn_site_to_site_ipsec_peers_slas.go | 1 + .../resource_meraki_appliance_warm_spare.go | 1 + ...resource_meraki_camera_custom_analytics.go | 1 + ..._meraki_camera_device_wireless_profiles.go | 15 -------- ...esource_meraki_camera_quality_retention.go | 1 + .../provider/resource_meraki_camera_sense.go | 1 + .../resource_meraki_camera_video_settings.go | 1 + ...ay_connectivity_monitoring_destinations.go | 1 + .../resource_meraki_cellular_gateway_dhcp.go | 1 + .../resource_meraki_cellular_gateway_lan.go | 1 + ..._cellular_gateway_port_forwarding_rules.go | 1 + ...rce_meraki_cellular_gateway_subnet_pool.go | 1 + ...resource_meraki_cellular_gateway_uplink.go | 1 + internal/provider/resource_meraki_device.go | 1 + .../resource_meraki_device_cellular_sims.go | 1 + ...urce_meraki_device_management_interface.go | 1 + ...resource_meraki_network_alerts_settings.go | 1 + .../resource_meraki_network_client_policy.go | 1 + ...work_client_splash_authorization_status.go | 1 + ...source_meraki_network_firmware_upgrades.go | 1 + .../resource_meraki_network_netflow.go | 1 + .../resource_meraki_network_settings.go | 1 + .../provider/resource_meraki_network_snmp.go | 1 + .../resource_meraki_network_syslog_servers.go | 1 + ...esource_meraki_network_traffic_analysis.go | 1 + ...aki_organization_adaptive_policies_test.go | 3 ++ ...i_organization_adaptive_policy_settings.go | 1 + ...eraki_organization_adaptive_policy_test.go | 3 ++ ...ganization_branding_policies_priorities.go | 1 + .../resource_meraki_organization_license.go | 1 + ...urce_meraki_organization_login_security.go | 1 + .../resource_meraki_organization_saml.go | 1 + .../resource_meraki_organization_snmp.go | 1 + .../resource_meraki_sensor_mqtt_broker.go | 1 + .../resource_meraki_sensor_mqtt_brokers.go | 4 +- .../resource_meraki_sensor_relationships.go | 1 + ...urce_meraki_switch_access_control_lists.go | 1 + ...i_switch_alternate_management_interface.go | 1 + ...source_meraki_switch_dhcp_server_policy.go | 1 + ...urce_meraki_switch_dscp_to_cos_mappings.go | 1 + .../provider/resource_meraki_switch_mtu.go | 1 + .../provider/resource_meraki_switch_port.go | 1 + .../provider/resource_meraki_switch_ports.go | 4 +- .../resource_meraki_switch_qos_rule_order.go | 1 + ...ce_meraki_switch_routing_interface_dhcp.go | 1 + ...esource_meraki_switch_routing_multicast.go | 1 + .../resource_meraki_switch_routing_ospf.go | 1 + .../resource_meraki_switch_settings.go | 1 + ...aki_switch_stack_routing_interface_dhcp.go | 1 + .../resource_meraki_switch_storm_control.go | 1 + .../provider/resource_meraki_switch_stp.go | 1 + .../resource_meraki_switch_warm_spare.go | 1 + ...ce_meraki_wireless_air_marshal_settings.go | 1 + ...wireless_alternate_management_interface.go | 1 + .../resource_meraki_wireless_billing.go | 1 + ...raki_wireless_device_bluetooth_settings.go | 1 + ..._wireless_device_electronic_shelf_label.go | 1 + ...ource_meraki_wireless_location_scanning.go | 27 ++++++++++++-- ...aki_wireless_network_bluetooth_settings.go | 1 + ...wireless_network_electronic_shelf_label.go | 1 + ...resource_meraki_wireless_radio_settings.go | 1 + .../resource_meraki_wireless_settings.go | 1 + .../provider/resource_meraki_wireless_ssid.go | 1 + ...meraki_wireless_ssid_bonjour_forwarding.go | 1 + ...ireless_ssid_device_type_group_policies.go | 1 + ...ource_meraki_wireless_ssid_eap_override.go | 3 +- ..._meraki_wireless_ssid_eap_override_test.go | 5 +++ ...esource_meraki_wireless_ssid_hotspot_20.go | 1 + ..._meraki_wireless_ssid_l3_firewall_rules.go | 1 + ..._meraki_wireless_ssid_l7_firewall_rules.go | 1 + ...resource_meraki_wireless_ssid_schedules.go | 1 + ...ce_meraki_wireless_ssid_splash_settings.go | 1 + ...aki_wireless_ssid_traffic_shaping_rules.go | 1 + .../resource_meraki_wireless_ssid_vpn.go | 1 + .../resource_meraki_wireless_ssids.go | 37 ------------------- .../resource_meraki_wireless_zigbee.go | 1 + .../resource_meraki_wireless_zigbee_device.go | 1 + ...source_meraki_wireless_zigbee_door_lock.go | 1 + 357 files changed, 796 insertions(+), 989 deletions(-) diff --git a/docs/data-sources/wireless_ssid_eap_override.md b/docs/data-sources/wireless_ssid_eap_override.md index d54c5c38..b23ac7d6 100644 --- a/docs/data-sources/wireless_ssid_eap_override.md +++ b/docs/data-sources/wireless_ssid_eap_override.md @@ -3,12 +3,12 @@ page_title: "meraki_wireless_ssid_eap_override Data Source - terraform-provider-meraki" subcategory: "Wireless" description: |- - This data source can read the Wireless SSID EAP override configuration. + This data source can read the Wireless SSID EAP Override configuration. --- # meraki_wireless_ssid_eap_override (Data Source) -This data source can read the `Wireless SSID EAP override` configuration. +This data source can read the `Wireless SSID EAP Override` configuration. ## Example Usage diff --git a/docs/resources/wireless_ssid_eap_override.md b/docs/resources/wireless_ssid_eap_override.md index b33921e2..bbdaa038 100644 --- a/docs/resources/wireless_ssid_eap_override.md +++ b/docs/resources/wireless_ssid_eap_override.md @@ -3,12 +3,12 @@ page_title: "meraki_wireless_ssid_eap_override Resource - terraform-provider-meraki" subcategory: "Wireless" description: |- - This resource can manage the Wireless SSID EAP override configuration. + This resource can manage the Wireless SSID EAP Override configuration. --- # meraki_wireless_ssid_eap_override (Resource) -This resource can manage the `Wireless SSID EAP override` configuration. +This resource can manage the `Wireless SSID EAP Override` configuration. ## Example Usage diff --git a/gen/definitions/appliance_cellular_firewall_rules.yaml b/gen/definitions/appliance_cellular_firewall_rules.yaml index 4ce7f813..333dca56 100644 --- a/gen/definitions/appliance_cellular_firewall_rules.yaml +++ b/gen/definitions/appliance_cellular_firewall_rules.yaml @@ -18,7 +18,6 @@ attributes: mandatory: true description: An ordered array of the firewall rules (not including the default rule) ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/appliance_connectivity_monitoring_destinations.yaml b/gen/definitions/appliance_connectivity_monitoring_destinations.yaml index 86f5b63e..652aebb8 100644 --- a/gen/definitions/appliance_connectivity_monitoring_destinations.yaml +++ b/gen/definitions/appliance_connectivity_monitoring_destinations.yaml @@ -17,14 +17,6 @@ attributes: type: List mandatory: true description: The list of connectivity monitoring destinations. Is set to Google DNS (8.8.8.8) when the resource is not created and gets reset to it on resource deletion - destroy_value: |- - []interface{}{ - map[string]interface{}{ - "ip": "8.8.8.8", - "default": true, - "description": "Google", - }, - } attributes: - model_name: default type: Bool diff --git a/gen/definitions/appliance_firewall_multicast_forwarding.yaml b/gen/definitions/appliance_firewall_multicast_forwarding.yaml index f8d1b979..87dbe35c 100644 --- a/gen/definitions/appliance_firewall_multicast_forwarding.yaml +++ b/gen/definitions/appliance_firewall_multicast_forwarding.yaml @@ -21,7 +21,6 @@ attributes: type: List mandatory: true description: Static multicast forwarding rules. Pass an empty array to clear all rules. - destroy_value: '[]interface{}{}' attributes: - model_name: address type: String diff --git a/gen/definitions/appliance_inbound_cellular_firewall_rules.yaml b/gen/definitions/appliance_inbound_cellular_firewall_rules.yaml index 47d9ff34..cbba4da0 100644 --- a/gen/definitions/appliance_inbound_cellular_firewall_rules.yaml +++ b/gen/definitions/appliance_inbound_cellular_firewall_rules.yaml @@ -18,7 +18,6 @@ attributes: mandatory: true description: An ordered array of the firewall rules (not including the default rule) ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/appliance_inbound_firewall_rules.yaml b/gen/definitions/appliance_inbound_firewall_rules.yaml index ba86a5b9..e035b4ca 100644 --- a/gen/definitions/appliance_inbound_firewall_rules.yaml +++ b/gen/definitions/appliance_inbound_firewall_rules.yaml @@ -24,7 +24,6 @@ attributes: mandatory: true description: An ordered array of the firewall rules (not including the default rule) ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/appliance_l3_firewall_rules.yaml b/gen/definitions/appliance_l3_firewall_rules.yaml index 0b240a21..6f27bf2c 100644 --- a/gen/definitions/appliance_l3_firewall_rules.yaml +++ b/gen/definitions/appliance_l3_firewall_rules.yaml @@ -23,7 +23,6 @@ attributes: mandatory: true description: An ordered array of the firewall rules (not including the default rule) ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/appliance_l7_firewall_rules.yaml b/gen/definitions/appliance_l7_firewall_rules.yaml index a6ae608a..151a2ed4 100644 --- a/gen/definitions/appliance_l7_firewall_rules.yaml +++ b/gen/definitions/appliance_l7_firewall_rules.yaml @@ -18,7 +18,6 @@ attributes: mandatory: true description: An ordered array of the MX L7 firewall rules ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: policy type: String diff --git a/gen/definitions/appliance_one_to_many_nat_rules.yaml b/gen/definitions/appliance_one_to_many_nat_rules.yaml index 75f5ab57..ba9e7dbe 100644 --- a/gen/definitions/appliance_one_to_many_nat_rules.yaml +++ b/gen/definitions/appliance_one_to_many_nat_rules.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: An array of 1:Many nat rules - destroy_value: '[]interface{}{}' attributes: - model_name: publicIp type: String diff --git a/gen/definitions/appliance_one_to_one_nat_rules.yaml b/gen/definitions/appliance_one_to_one_nat_rules.yaml index 78be902b..882e7517 100644 --- a/gen/definitions/appliance_one_to_one_nat_rules.yaml +++ b/gen/definitions/appliance_one_to_one_nat_rules.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: An array of 1:1 nat rules - destroy_value: '[]interface{}{}' attributes: - model_name: lanIp type: String diff --git a/gen/definitions/appliance_organization_security_intrusion.yaml b/gen/definitions/appliance_organization_security_intrusion.yaml index 5b50ff26..9dcfa5f4 100644 --- a/gen/definitions/appliance_organization_security_intrusion.yaml +++ b/gen/definitions/appliance_organization_security_intrusion.yaml @@ -18,7 +18,6 @@ attributes: type: List mandatory: true description: Sets a list of specific SNORT signatures to allow - destroy_value: '[]interface{}{}' attributes: - model_name: message type: String diff --git a/gen/definitions/appliance_port_forwarding_rules.yaml b/gen/definitions/appliance_port_forwarding_rules.yaml index ba9f34f8..2dc39ae1 100644 --- a/gen/definitions/appliance_port_forwarding_rules.yaml +++ b/gen/definitions/appliance_port_forwarding_rules.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: An array of port forwarding params - destroy_value: '[]interface{}{}' attributes: - model_name: lanIp type: String diff --git a/gen/definitions/appliance_sdwan_internet_policies.yaml b/gen/definitions/appliance_sdwan_internet_policies.yaml index 5ca779e0..0859653c 100644 --- a/gen/definitions/appliance_sdwan_internet_policies.yaml +++ b/gen/definitions/appliance_sdwan_internet_policies.yaml @@ -21,7 +21,6 @@ attributes: mandatory: true description: 'Policies with respective traffic filters for an MX network. Note: these policies are shared (merged) with meraki_appliance_traffic_shaping_uplink_selection resource''s wan_traffic_uplink_preferences attribute. It is recommended to only use one resource for them, not both at the same time: Deleting this resource clears preferences created in meraki_appliance_traffic_shaping_uplink_selection, which is detected as a change by the provider on a subsequent apply. The same happens the other way around, but the change is not detected in sdwan_internet_policies.' ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: failOverCriterion type: String diff --git a/gen/definitions/appliance_third_party_vpn_peers.yaml b/gen/definitions/appliance_third_party_vpn_peers.yaml index b459d3b3..2fdd2bb3 100644 --- a/gen/definitions/appliance_third_party_vpn_peers.yaml +++ b/gen/definitions/appliance_third_party_vpn_peers.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: The list of VPN peers - destroy_value: '[]interface{}{}' attributes: - model_name: ikeVersion type: String diff --git a/gen/definitions/appliance_traffic_shaping_rules.yaml b/gen/definitions/appliance_traffic_shaping_rules.yaml index c9275610..fa711929 100644 --- a/gen/definitions/appliance_traffic_shaping_rules.yaml +++ b/gen/definitions/appliance_traffic_shaping_rules.yaml @@ -21,7 +21,6 @@ attributes: type: List description: An array of traffic shaping rules. Rules are applied in the order that they are specified in. An empty list (or null) means no rules. Note that you are allowed a maximum of 8 rules. ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: dscpTagValue type: Int64 diff --git a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml index dacce4ae..20945814 100644 --- a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml +++ b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml @@ -37,7 +37,6 @@ attributes: exclude_test: true description: Array of uplink preference rules for VPN traffic ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: failOverCriterion type: String diff --git a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml index cabbeda7..9162eb74 100644 --- a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml +++ b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml @@ -23,7 +23,6 @@ attributes: type: List description: Custom VPN exclusion rules. Pass an empty array to clear existing rules. ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: destination type: String @@ -42,7 +41,6 @@ attributes: - model_name: majorApplications type: List description: Major Application based VPN exclusion rules. Pass an empty array to clear existing rules. - destroy_value: '[]interface{}{}' attributes: - model_name: id type: String diff --git a/gen/definitions/appliance_vpn_firewall_rules.yaml b/gen/definitions/appliance_vpn_firewall_rules.yaml index b68eae9b..a23e44e3 100644 --- a/gen/definitions/appliance_vpn_firewall_rules.yaml +++ b/gen/definitions/appliance_vpn_firewall_rules.yaml @@ -23,7 +23,6 @@ attributes: mandatory: true description: An ordered array of the firewall rules (not including the default rule) ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/appliance_vpn_site_to_site_ipsec_peers_slas.yaml b/gen/definitions/appliance_vpn_site_to_site_ipsec_peers_slas.yaml index 9b343907..f5fb0f19 100644 --- a/gen/definitions/appliance_vpn_site_to_site_ipsec_peers_slas.yaml +++ b/gen/definitions/appliance_vpn_site_to_site_ipsec_peers_slas.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: List of IPsec SLA policies - destroy_value: '[]interface{}{}' attributes: - model_name: name type: String diff --git a/gen/definitions/camera_device_wireless_profiles.yaml b/gen/definitions/camera_device_wireless_profiles.yaml index 6845fa0d..ffbba273 100644 --- a/gen/definitions/camera_device_wireless_profiles.yaml +++ b/gen/definitions/camera_device_wireless_profiles.yaml @@ -1,3 +1,4 @@ +# Customize Delete() function as resetting profiles to empty string is not supported name: Camera Device Wireless Profiles spec_endpoint: /devices/{serial}/camera/wirelessProfiles rest_endpoint: /devices/%v/camera/wirelessProfiles diff --git a/gen/definitions/cellular_gateway_connectivity_monitoring_destinations.yaml b/gen/definitions/cellular_gateway_connectivity_monitoring_destinations.yaml index 019fb2f8..97c393fd 100644 --- a/gen/definitions/cellular_gateway_connectivity_monitoring_destinations.yaml +++ b/gen/definitions/cellular_gateway_connectivity_monitoring_destinations.yaml @@ -17,14 +17,6 @@ attributes: type: List mandatory: true description: The list of connectivity monitoring destinations. Is set to Google DNS (8.8.8.8) when the resource is not created and gets reset to it on resource deletion - destroy_value: |- - []interface{}{ - map[string]interface{}{ - "ip": "8.8.8.8", - "default": true, - "description": "Google", - }, - } attributes: - model_name: default type: Bool diff --git a/gen/definitions/cellular_gateway_lan.yaml b/gen/definitions/cellular_gateway_lan.yaml index 1698f3aa..19434fae 100644 --- a/gen/definitions/cellular_gateway_lan.yaml +++ b/gen/definitions/cellular_gateway_lan.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: list of all fixed IP assignments for a single MG - destroy_value: '[]interface{}{}' attributes: - model_name: ip type: String @@ -37,7 +36,6 @@ attributes: type: List mandatory: true description: list of all reserved IP ranges for a single MG - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/cellular_gateway_port_forwarding_rules.yaml b/gen/definitions/cellular_gateway_port_forwarding_rules.yaml index 234a870f..d2d4a456 100644 --- a/gen/definitions/cellular_gateway_port_forwarding_rules.yaml +++ b/gen/definitions/cellular_gateway_port_forwarding_rules.yaml @@ -18,7 +18,6 @@ attributes: mandatory: true description: An array of port forwarding params ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: access type: String diff --git a/gen/definitions/cellular_gateway_uplink.yaml b/gen/definitions/cellular_gateway_uplink.yaml index 4435c244..29f58351 100644 --- a/gen/definitions/cellular_gateway_uplink.yaml +++ b/gen/definitions/cellular_gateway_uplink.yaml @@ -19,11 +19,13 @@ attributes: description: The maximum download limit (integer, in Kbps). null indicates no limit example: "1000000" minimum_test_value: "10000" + destroy_value: nil - model_name: limitUp type: Int64 data_path: [bandwidthLimits] description: The maximum upload limit (integer, in Kbps). null indicates no limit example: "1000000" + destroy_value: nil test_prerequisites: | data "meraki_organization" "test" { name = var.test_org diff --git a/gen/definitions/network_syslog_servers.yaml b/gen/definitions/network_syslog_servers.yaml index f316050b..f17ec3ea 100644 --- a/gen/definitions/network_syslog_servers.yaml +++ b/gen/definitions/network_syslog_servers.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: A list of the syslog servers for this network - destroy_value: '[]interface{}{}' attributes: - model_name: host type: String diff --git a/gen/definitions/organization_adaptive_policy.yaml b/gen/definitions/organization_adaptive_policy.yaml index 0e687166..ca7efcdf 100644 --- a/gen/definitions/organization_adaptive_policy.yaml +++ b/gen/definitions/organization_adaptive_policy.yaml @@ -1,3 +1,4 @@ +# Test tag added as batch api is temporarily not working name: Organization Adaptive Policy spec_endpoint: /organizations/{organizationId}/adaptivePolicy/policies/{id} rest_endpoint: /organizations/%v/adaptivePolicy/policies @@ -5,6 +6,7 @@ bulk_data_source: true bulk_resource: true id_name: adaptivePolicyId doc_category: Organizations +test_tags: [ORGANIZATION_ADAPTIVE_POLICY] test_variables: [test_org] attributes: - tf_name: organization_id diff --git a/gen/definitions/switch_access_control_lists.yaml b/gen/definitions/switch_access_control_lists.yaml index 05bd38ed..f70cc36e 100644 --- a/gen/definitions/switch_access_control_lists.yaml +++ b/gen/definitions/switch_access_control_lists.yaml @@ -18,7 +18,6 @@ attributes: mandatory: true description: An ordered array of the access control list rules (not including the default rule). An empty array will clear the rules. ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/switch_dscp_to_cos_mappings.yaml b/gen/definitions/switch_dscp_to_cos_mappings.yaml index 1433f6ab..51c08483 100644 --- a/gen/definitions/switch_dscp_to_cos_mappings.yaml +++ b/gen/definitions/switch_dscp_to_cos_mappings.yaml @@ -17,7 +17,6 @@ attributes: type: List mandatory: true description: An array of DSCP to CoS mappings. An empty array will reset the mappings to default. - destroy_value: '[]interface{}{}' attributes: - model_name: cos type: Int64 diff --git a/gen/definitions/switch_port.yaml b/gen/definitions/switch_port.yaml index 6f8d798d..57b91b54 100644 --- a/gen/definitions/switch_port.yaml +++ b/gen/definitions/switch_port.yaml @@ -1,4 +1,4 @@ -# Customize toDestroyBody(), Update() and Delete() for bulk resource to conditionally remove adaptive policy (if present) during deleting +# Customize addDeleteValues(), Update() and Delete() for bulk resource to conditionally remove adaptive policy (if present) during deleting name: Switch Port spec_endpoint: /devices/{serial}/switch/ports/{portId} rest_endpoint: /devices/%v/switch/ports/%v @@ -33,7 +33,6 @@ attributes: description: The type of the access policy of the switch port. Only applicable to access ports. Can be one of `Open`, `Custom access policy`, `MAC allow list` or `Sticky MAC allow list`. example: Sticky MAC allow list enum_values: [Custom access policy, MAC allow list, Open, Sticky MAC allow list] - destroy_value: '"Open"' - model_name: adaptivePolicyGroupId type: String exclude_test: true @@ -135,7 +134,6 @@ attributes: data_path: [profile] description: When enabled, override this port`s configuration with a port profile. example: "false" - destroy_value: "false" - model_name: id type: String data_path: [profile] diff --git a/gen/definitions/wireless_ssid.yaml b/gen/definitions/wireless_ssid.yaml index 6d1f7a87..c2a06141 100644 --- a/gen/definitions/wireless_ssid.yaml +++ b/gen/definitions/wireless_ssid.yaml @@ -32,18 +32,15 @@ attributes: exclude_test: true description: Boolean indicating whether or not adult content will be blocked example: "false" - destroy_value: "false" - model_name: authMode type: String description: The association control method for the SSID (`open`, `open-enhanced`, `psk`, `open-with-radius`, `open-with-nac`, `8021x-meraki`, `8021x-nac`, `8021x-radius`, `8021x-google`, `8021x-entra`, `8021x-localradius`, `ipsk-with-radius`, `ipsk-without-radius` or `ipsk-with-nac`) example: psk enum_values: [8021x-entra, 8021x-google, 8021x-localradius, 8021x-meraki, 8021x-nac, 8021x-radius, ipsk-with-nac, ipsk-with-radius, ipsk-without-radius, open, open-enhanced, open-with-nac, open-with-radius, psk] - destroy_value: '"open"' - model_name: availableOnAllAps type: Bool description: Boolean indicating whether all APs should broadcast the SSID or if it should be restricted to APs matching any availability tags. Can only be false if the SSID has availability tags. example: "false" - destroy_value: "true" - model_name: bandSelection type: String description: The client-serving radio frequencies of this SSID in the default indoor RF profile. (`Dual band operation`, `5 GHz band only` or `Dual band operation with Band Steering`) @@ -67,7 +64,6 @@ attributes: type: Bool description: Whether or not the SSID is enabled example: "false" - destroy_value: "false" - model_name: encryptionMode type: String description: The psk encryption mode for the SSID (`wep` or `wpa`). This param is only valid if the authMode is `psk` @@ -84,7 +80,6 @@ attributes: description: The client IP assignment mode (`NAT mode`, `Bridge mode`, `Layer 3 roaming`, `Ethernet over GRE`, `Layer 3 roaming with a concentrator` or `VPN`) example: Bridge mode enum_values: [Bridge mode, Ethernet over GRE, Layer 3 roaming, Layer 3 roaming with a concentrator, NAT mode, VPN] - destroy_value: '"NAT mode"' - model_name: lanIsolationEnabled type: Bool description: Boolean indicating whether Layer 2 LAN isolation should be enabled or disabled. Only configurable when ipAssignmentMode is `Bridge mode`. @@ -93,7 +88,6 @@ attributes: type: Bool description: If true, Mandatory DHCP will enforce that clients connecting to this SSID must use the IP address assigned by the DHCP server. Clients who use a static IP address won`t be able to associate. example: "false" - destroy_value: "false" - model_name: minBitrate type: Float64 description: The minimum bitrate in Mbps of this SSID in the default indoor RF profile. (`1`, `2`, `5.5`, `6`, `9`, `11`, `12`, `18`, `24`, `36`, `48` or `54`) @@ -103,27 +97,22 @@ attributes: mandatory: true description: The name of the SSID example: My SSID - destroy_value: '"Unconfigured SSID"' - model_name: perClientBandwidthLimitDown type: Int64 description: The download bandwidth limit in Kbps. (0 represents no limit.) example: "0" - destroy_value: "0" - model_name: perClientBandwidthLimitUp type: Int64 description: The upload bandwidth limit in Kbps. (0 represents no limit.) example: "0" - destroy_value: "0" - model_name: perSsidBandwidthLimitDown type: Int64 description: The total download bandwidth limit in Kbps. (0 represents no limit.) example: "0" - destroy_value: "0" - model_name: perSsidBandwidthLimitUp type: Int64 description: The total upload bandwidth limit in Kbps. (0 represents no limit.) example: "0" - destroy_value: "0" - model_name: psk type: String description: The passkey for the SSID. This param is only valid if the authMode is `psk` @@ -221,7 +210,6 @@ attributes: description: The type of splash page for the SSID (`None`, `Click-through splash page`, `Billing`, `Password-protected with Meraki RADIUS`, `Password-protected with custom RADIUS`, `Password-protected with Active Directory`, `Password-protected with LDAP`, `SMS authentication`, `Systems Manager Sentry`, `Facebook Wi-Fi`, `Google OAuth`, `Microsoft Entra ID`, `Sponsored guest`, `Cisco ISE` or `Google Apps domain`). This attribute is not supported for template children. example: Click-through splash page enum_values: [Billing, Cisco ISE, Click-through splash page, Facebook Wi-Fi, Google Apps domain, Google OAuth, Microsoft Entra ID, None, Password-protected with Active Directory, Password-protected with LDAP, Password-protected with Meraki RADIUS, Password-protected with custom RADIUS, SMS authentication, Sponsored guest, Systems Manager Sentry] - destroy_value: '"None"' - model_name: useVlanTagging type: Bool description: Whether or not traffic should be directed to use specific VLANs. This param is only valid if the ipAssignmentMode is `Bridge mode` or `Layer 3 roaming` @@ -230,7 +218,6 @@ attributes: type: Bool description: Boolean indicating whether APs should advertise or hide this SSID. APs will only broadcast this SSID if set to true example: "false" - destroy_value: "true" - model_name: vlanId type: Int64 exclude_test: true @@ -279,7 +266,6 @@ attributes: exclude_test: true description: Boolean indicating whether or not DNS server rewrite is enabled. If disabled, upstream DNS will be used example: "false" - destroy_value: "false" - model_name: dnsCustomNameservers type: List element_type: String @@ -287,7 +273,6 @@ attributes: exclude_test: true description: User specified DNS servers (up to two servers) example: 8.8.8.8 - destroy_value: '[]interface{}{}' - model_name: adaptive type: Bool data_path: [dot11r] @@ -504,7 +489,6 @@ attributes: data_path: [speedBurst] description: Boolean indicating whether or not to allow users to temporarily exceed the bandwidth limit for short periods while still keeping them under the bandwidth limit over time. example: "false" - destroy_value: "false" - model_name: apTagsAndVlanIds type: List exclude_test: true @@ -524,7 +508,6 @@ attributes: element_type: String description: Accepts a list of tags for this SSID. If availableOnAllAps is false, then the SSID will only be broadcast by APs with tags matching any of the tags in this list. example: tag1 - destroy_value: '[]interface{}{}' - model_name: radiusAccountingServers type: List exclude_test: true diff --git a/gen/definitions/wireless_ssid_eap_override.yaml b/gen/definitions/wireless_ssid_eap_override.yaml index 95941550..a3031954 100644 --- a/gen/definitions/wireless_ssid_eap_override.yaml +++ b/gen/definitions/wireless_ssid_eap_override.yaml @@ -1,4 +1,4 @@ -name: Wireless SSID EAP override +name: Wireless SSID EAP Override spec_endpoint: /networks/{networkId}/wireless/ssids/{number}/eapOverride rest_endpoint: /networks/%v/wireless/ssids/%v/eapOverride put_create: true @@ -24,6 +24,7 @@ attributes: description: Maximum number of general EAP retries. example: "5" minimum_test_value: "5" + destroy_value: "5" - model_name: timeout type: Int64 description: General EAP timeout in seconds. @@ -62,4 +63,9 @@ test_prerequisites: |- name = "My SSID" network_id = meraki_network.test.id ip_assignment_mode = "Bridge mode" + auth_mode = "8021x-radius" + radius_servers = [{ + host = "1.2.3.4" + secret = "secret123" + }] } diff --git a/gen/definitions/wireless_ssid_l3_firewall_rules.yaml b/gen/definitions/wireless_ssid_l3_firewall_rules.yaml index 8b4bc352..8062f5dc 100644 --- a/gen/definitions/wireless_ssid_l3_firewall_rules.yaml +++ b/gen/definitions/wireless_ssid_l3_firewall_rules.yaml @@ -29,7 +29,6 @@ attributes: type: List description: An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule). ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: comment type: String diff --git a/gen/definitions/wireless_ssid_l7_firewall_rules.yaml b/gen/definitions/wireless_ssid_l7_firewall_rules.yaml index 01616310..f169ab8e 100644 --- a/gen/definitions/wireless_ssid_l7_firewall_rules.yaml +++ b/gen/definitions/wireless_ssid_l7_firewall_rules.yaml @@ -24,7 +24,6 @@ attributes: type: List description: An array of L7 firewall rules for this SSID. Rules will get applied in the same order user has specified in request. Empty array will clear the L7 firewall rule configuration. ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: policy type: String diff --git a/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml b/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml index 4388871e..ddba2e13 100644 --- a/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml +++ b/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml @@ -31,7 +31,6 @@ attributes: type: List description: An array of traffic shaping rules. Rules are applied in the order that they are specified in. An empty list (or null) means no rules. Note that you are allowed a maximum of 8 rules. ordered_list: true - destroy_value: '[]interface{}{}' attributes: - model_name: dscpTagValue type: Int64 diff --git a/gen/templates/bulk/model_resource.go b/gen/templates/bulk/model_resource.go index 6cb3d150..c7e000d2 100644 --- a/gen/templates/bulk/model_resource.go +++ b/gen/templates/bulk/model_resource.go @@ -688,9 +688,9 @@ func (data *Resource{{camelCase .BulkName}}) fromBodyImport(ctx context.Context, // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data Resource{{camelCase .BulkName}}) toDestroyBody(ctx context.Context) string { +func (data Resource{{camelCase .BulkName}}) addDeleteValues(ctx context.Context) string { body := "" {{- range getBulkItemAttributes .}} {{- if .DestroyValue}} @@ -700,7 +700,7 @@ func (data Resource{{camelCase .BulkName}}) toDestroyBody(ctx context.Context) s return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/gen/templates/bulk/resource.go b/gen/templates/bulk/resource.go index 0373aeb5..72cc33e2 100644 --- a/gen/templates/bulk/resource.go +++ b/gen/templates/bulk/resource.go @@ -644,7 +644,7 @@ func (r *{{camelCase .BulkName}}Resource) Update(ctx context.Context, req resour actions = append(actions, meraki.ActionModel{ Operation: "update", Resource: plan.getItemPath(itemState.{{toGoName ((getId .Attributes).TfName)}}.ValueString()), - Body: plan.toDestroyBody(ctx), + Body: plan.addDeleteValues(ctx), }) {{- else if not .NoDelete}} actions = append(actions, meraki.ActionModel{ @@ -755,7 +755,7 @@ func (r *{{camelCase .BulkName}}Resource) Delete(ctx context.Context, req resour actions[i] = meraki.ActionModel{ Operation: "update", Resource: state.getItemPath(item.{{toGoName ((getId .Attributes).TfName)}}.ValueString()), - Body: state.toDestroyBody(ctx), + Body: state.addDeleteValues(ctx), } } if len(actions) > 0 { diff --git a/gen/templates/model.go b/gen/templates/model.go index 94053426..30ee3eb5 100644 --- a/gen/templates/model.go +++ b/gen/templates/model.go @@ -515,10 +515,9 @@ func (data *{{camelCase .Name}}) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data {{camelCase .Name}}) toDestroyBody(ctx context.Context) string { - body := "" +func (data {{camelCase .Name}}) addDeleteValues(ctx context.Context, body string) string { {{- range .Attributes}} {{- if .DestroyValue}} body, _ = sjson.Set(body, "{{getFullModelName . true}}", {{.DestroyValue}}) @@ -527,7 +526,7 @@ func (data {{camelCase .Name}}) toDestroyBody(ctx context.Context) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues {{- range .Attributes}} {{- range .Attributes}} diff --git a/gen/templates/resource.go b/gen/templates/resource.go index f7763e4c..c344ba1a 100644 --- a/gen/templates/resource.go +++ b/gen/templates/resource.go @@ -582,6 +582,7 @@ func (r *{{camelCase .Name}}Resource) Delete(ctx context.Context, req resource.D {{- if isSingleton .}} // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } @@ -592,7 +593,7 @@ func (r *{{camelCase .Name}}Resource) Delete(ctx context.Context, req resource.D return } {{- else if hasDestroyValues .Attributes}} - body := state.toDestroyBody(ctx) + body := state.addDeleteValues(ctx, "") res, err := r.client.Put(state.getPath(), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) diff --git a/internal/provider/data_source_meraki_organization_adaptive_policies_test.go b/internal/provider/data_source_meraki_organization_adaptive_policies_test.go index a3fc646e..4acef888 100644 --- a/internal/provider/data_source_meraki_organization_adaptive_policies_test.go +++ b/internal/provider/data_source_meraki_organization_adaptive_policies_test.go @@ -30,6 +30,9 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceMerakiOrganizationAdaptivePolicies(t *testing.T) { + if os.Getenv("ORGANIZATION_ADAPTIVE_POLICY") == "" { + t.Skip("skipping test, set environment variable ORGANIZATION_ADAPTIVE_POLICY") + } if os.Getenv("TF_VAR_test_org") == "" { t.Skip("skipping test, set environment variable TF_VAR_test_org") } diff --git a/internal/provider/data_source_meraki_organization_adaptive_policy_test.go b/internal/provider/data_source_meraki_organization_adaptive_policy_test.go index 4e4463f0..8e8b0db1 100644 --- a/internal/provider/data_source_meraki_organization_adaptive_policy_test.go +++ b/internal/provider/data_source_meraki_organization_adaptive_policy_test.go @@ -30,6 +30,9 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAccDataSource func TestAccDataSourceMerakiOrganizationAdaptivePolicy(t *testing.T) { + if os.Getenv("ORGANIZATION_ADAPTIVE_POLICY") == "" { + t.Skip("skipping test, set environment variable ORGANIZATION_ADAPTIVE_POLICY") + } if os.Getenv("TF_VAR_test_org") == "" { t.Skip("skipping test, set environment variable TF_VAR_test_org") } diff --git a/internal/provider/data_source_meraki_wireless_location_scanning.go b/internal/provider/data_source_meraki_wireless_location_scanning.go index b113f0e7..4a742059 100644 --- a/internal/provider/data_source_meraki_wireless_location_scanning.go +++ b/internal/provider/data_source_meraki_wireless_location_scanning.go @@ -27,6 +27,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" + "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -107,14 +108,22 @@ func (d *WirelessLocationScanningDataSource) Read(ctx context.Context, req datas } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, config.NetworkId.ValueString()) + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork", orgId) res, err = d.client.Get(getPath) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve wireless location scanning (GET), got error: %s, %s", err, res.String())) return } - res = meraki.Res{Result: res.Get("items.0")} + if len(res.Get("items").Array()) > 0 { + res.Get("items").ForEach(func(k, v gjson.Result) bool { + if config.NetworkId.ValueString() == v.Get("networkId").String() { + res = meraki.Res{Result: v} + return false + } + return true + }) + } config.fromBody(ctx, res) config.Id = config.NetworkId diff --git a/internal/provider/data_source_meraki_wireless_ssid_eap_override.go b/internal/provider/data_source_meraki_wireless_ssid_eap_override.go index 41c44264..af10f281 100644 --- a/internal/provider/data_source_meraki_wireless_ssid_eap_override.go +++ b/internal/provider/data_source_meraki_wireless_ssid_eap_override.go @@ -54,7 +54,7 @@ func (d *WirelessSSIDEAPOverrideDataSource) Metadata(_ context.Context, req data func (d *WirelessSSIDEAPOverrideDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: helpers.NewAttributeDescription("This data source can read the `Wireless SSID EAP override` configuration.").String, + MarkdownDescription: helpers.NewAttributeDescription("This data source can read the `Wireless SSID EAP Override` configuration.").String, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ diff --git a/internal/provider/data_source_meraki_wireless_ssid_eap_override_test.go b/internal/provider/data_source_meraki_wireless_ssid_eap_override_test.go index 3b8f475d..c205417c 100644 --- a/internal/provider/data_source_meraki_wireless_ssid_eap_override_test.go +++ b/internal/provider/data_source_meraki_wireless_ssid_eap_override_test.go @@ -72,6 +72,11 @@ resource "meraki_wireless_ssid" "test" { name = "My SSID" network_id = meraki_network.test.id ip_assignment_mode = "Bridge mode" + auth_mode = "8021x-radius" + radius_servers = [{ + host = "1.2.3.4" + secret = "secret123" + }] } ` diff --git a/internal/provider/model_meraki_appliance_cellular_firewall_rules.go b/internal/provider/model_meraki_appliance_cellular_firewall_rules.go index dbcf7ee4..17d552b0 100644 --- a/internal/provider/model_meraki_appliance_cellular_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_cellular_firewall_rules.go @@ -234,12 +234,10 @@ func (data *ApplianceCellularFirewallRules) fromBodyUnknowns(ctx context.Context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceCellularFirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceCellularFirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_connectivity_monitoring_destinations.go b/internal/provider/model_meraki_appliance_connectivity_monitoring_destinations.go index 19576355..c9329f16 100644 --- a/internal/provider/model_meraki_appliance_connectivity_monitoring_destinations.go +++ b/internal/provider/model_meraki_appliance_connectivity_monitoring_destinations.go @@ -186,18 +186,10 @@ func (data *ApplianceConnectivityMonitoringDestinations) fromBodyUnknowns(ctx co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceConnectivityMonitoringDestinations) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "destinations", []interface{}{ - map[string]interface{}{ - "ip": "8.8.8.8", - "default": true, - "description": "Google", - }, - }) +func (data ApplianceConnectivityMonitoringDestinations) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_content_filtering.go b/internal/provider/model_meraki_appliance_content_filtering.go index 2763e170..c44e2dea 100644 --- a/internal/provider/model_meraki_appliance_content_filtering.go +++ b/internal/provider/model_meraki_appliance_content_filtering.go @@ -126,11 +126,10 @@ func (data *ApplianceContentFiltering) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceContentFiltering) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceContentFiltering) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_dns_local_profile.go b/internal/provider/model_meraki_appliance_dns_local_profile.go index b45b5953..f1c18283 100644 --- a/internal/provider/model_meraki_appliance_dns_local_profile.go +++ b/internal/provider/model_meraki_appliance_dns_local_profile.go @@ -97,11 +97,10 @@ func (data *ApplianceDNSLocalProfile) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceDNSLocalProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceDNSLocalProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_dns_local_profile_assignments.go b/internal/provider/model_meraki_appliance_dns_local_profile_assignments.go index 119738b7..d574c6b1 100644 --- a/internal/provider/model_meraki_appliance_dns_local_profile_assignments.go +++ b/internal/provider/model_meraki_appliance_dns_local_profile_assignments.go @@ -251,11 +251,10 @@ func (data *ApplianceDNSLocalProfileAssignments) fromBodyUnknowns(ctx context.Co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceDNSLocalProfileAssignments) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceDNSLocalProfileAssignments) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_dns_local_record.go b/internal/provider/model_meraki_appliance_dns_local_record.go index d7403eea..65150c4b 100644 --- a/internal/provider/model_meraki_appliance_dns_local_record.go +++ b/internal/provider/model_meraki_appliance_dns_local_record.go @@ -125,11 +125,10 @@ func (data *ApplianceDNSLocalRecord) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceDNSLocalRecord) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceDNSLocalRecord) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_dns_split_profile.go b/internal/provider/model_meraki_appliance_dns_split_profile.go index b1003047..17d7c740 100644 --- a/internal/provider/model_meraki_appliance_dns_split_profile.go +++ b/internal/provider/model_meraki_appliance_dns_split_profile.go @@ -130,11 +130,10 @@ func (data *ApplianceDNSSplitProfile) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceDNSSplitProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceDNSSplitProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_dns_split_profile_assignments.go b/internal/provider/model_meraki_appliance_dns_split_profile_assignments.go index f676fad9..51f5e67f 100644 --- a/internal/provider/model_meraki_appliance_dns_split_profile_assignments.go +++ b/internal/provider/model_meraki_appliance_dns_split_profile_assignments.go @@ -251,11 +251,10 @@ func (data *ApplianceDNSSplitProfileAssignments) fromBodyUnknowns(ctx context.Co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceDNSSplitProfileAssignments) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceDNSSplitProfileAssignments) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_firewall_multicast_forwarding.go b/internal/provider/model_meraki_appliance_firewall_multicast_forwarding.go index 70ddb1a5..c5dc0ffc 100644 --- a/internal/provider/model_meraki_appliance_firewall_multicast_forwarding.go +++ b/internal/provider/model_meraki_appliance_firewall_multicast_forwarding.go @@ -189,12 +189,10 @@ func (data *ApplianceFirewallMulticastForwarding) fromBodyUnknowns(ctx context.C // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceFirewallMulticastForwarding) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceFirewallMulticastForwarding) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_firewall_settings.go b/internal/provider/model_meraki_appliance_firewall_settings.go index 31f62aa4..9f81492d 100644 --- a/internal/provider/model_meraki_appliance_firewall_settings.go +++ b/internal/provider/model_meraki_appliance_firewall_settings.go @@ -97,11 +97,10 @@ func (data *ApplianceFirewallSettings) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceFirewallSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceFirewallSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_firewalled_service.go b/internal/provider/model_meraki_appliance_firewalled_service.go index 76920f9a..04767005 100644 --- a/internal/provider/model_meraki_appliance_firewalled_service.go +++ b/internal/provider/model_meraki_appliance_firewalled_service.go @@ -115,11 +115,10 @@ func (data *ApplianceFirewalledService) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceFirewalledService) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceFirewalledService) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_inbound_cellular_firewall_rules.go b/internal/provider/model_meraki_appliance_inbound_cellular_firewall_rules.go index d7c21097..5f199595 100644 --- a/internal/provider/model_meraki_appliance_inbound_cellular_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_inbound_cellular_firewall_rules.go @@ -234,12 +234,10 @@ func (data *ApplianceInboundCellularFirewallRules) fromBodyUnknowns(ctx context. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceInboundCellularFirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceInboundCellularFirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_inbound_firewall_rules.go b/internal/provider/model_meraki_appliance_inbound_firewall_rules.go index bac236cf..0d132093 100644 --- a/internal/provider/model_meraki_appliance_inbound_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_inbound_firewall_rules.go @@ -238,12 +238,10 @@ func (data *ApplianceInboundFirewallRules) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceInboundFirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceInboundFirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_l3_firewall_rules.go b/internal/provider/model_meraki_appliance_l3_firewall_rules.go index 0d6c4eba..93849fc2 100644 --- a/internal/provider/model_meraki_appliance_l3_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_l3_firewall_rules.go @@ -238,12 +238,10 @@ func (data *ApplianceL3FirewallRules) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceL3FirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceL3FirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_l7_firewall_rules.go b/internal/provider/model_meraki_appliance_l7_firewall_rules.go index 51e7bcf4..2d646b2f 100644 --- a/internal/provider/model_meraki_appliance_l7_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_l7_firewall_rules.go @@ -198,12 +198,10 @@ func (data *ApplianceL7FirewallRules) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceL7FirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceL7FirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_network_security_intrusion.go b/internal/provider/model_meraki_appliance_network_security_intrusion.go index 377daadc..b0c0d0f5 100644 --- a/internal/provider/model_meraki_appliance_network_security_intrusion.go +++ b/internal/provider/model_meraki_appliance_network_security_intrusion.go @@ -158,11 +158,10 @@ func (data *ApplianceNetworkSecurityIntrusion) fromBodyUnknowns(ctx context.Cont // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceNetworkSecurityIntrusion) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceNetworkSecurityIntrusion) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_one_to_many_nat_rules.go b/internal/provider/model_meraki_appliance_one_to_many_nat_rules.go index 7fbdecfd..fb40f4d6 100644 --- a/internal/provider/model_meraki_appliance_one_to_many_nat_rules.go +++ b/internal/provider/model_meraki_appliance_one_to_many_nat_rules.go @@ -317,12 +317,10 @@ func (data *ApplianceOneToManyNATRules) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceOneToManyNATRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceOneToManyNATRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go b/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go index 21e6696b..467b7875 100644 --- a/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go +++ b/internal/provider/model_meraki_appliance_one_to_one_nat_rules.go @@ -305,12 +305,10 @@ func (data *ApplianceOneToOneNATRules) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceOneToOneNATRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceOneToOneNATRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_organization_security_intrusion.go b/internal/provider/model_meraki_appliance_organization_security_intrusion.go index 0e7a97c6..a23a9a44 100644 --- a/internal/provider/model_meraki_appliance_organization_security_intrusion.go +++ b/internal/provider/model_meraki_appliance_organization_security_intrusion.go @@ -172,12 +172,10 @@ func (data *ApplianceOrganizationSecurityIntrusion) fromBodyUnknowns(ctx context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceOrganizationSecurityIntrusion) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "allowedRules", []interface{}{}) +func (data ApplianceOrganizationSecurityIntrusion) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_port.go b/internal/provider/model_meraki_appliance_port.go index 2ca460d8..2440c9f7 100644 --- a/internal/provider/model_meraki_appliance_port.go +++ b/internal/provider/model_meraki_appliance_port.go @@ -168,11 +168,10 @@ func (data *AppliancePort) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data AppliancePort) toDestroyBody(ctx context.Context) string { - body := "" +func (data AppliancePort) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_port_forwarding_rules.go b/internal/provider/model_meraki_appliance_port_forwarding_rules.go index c075dcd9..959cade2 100644 --- a/internal/provider/model_meraki_appliance_port_forwarding_rules.go +++ b/internal/provider/model_meraki_appliance_port_forwarding_rules.go @@ -245,12 +245,10 @@ func (data *AppliancePortForwardingRules) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data AppliancePortForwardingRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data AppliancePortForwardingRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_prefix_delegated_static.go b/internal/provider/model_meraki_appliance_prefix_delegated_static.go index 805a2158..1eee61ba 100644 --- a/internal/provider/model_meraki_appliance_prefix_delegated_static.go +++ b/internal/provider/model_meraki_appliance_prefix_delegated_static.go @@ -142,11 +142,10 @@ func (data *AppliancePrefixDelegatedStatic) fromBodyUnknowns(ctx context.Context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data AppliancePrefixDelegatedStatic) toDestroyBody(ctx context.Context) string { - body := "" +func (data AppliancePrefixDelegatedStatic) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_radio_settings.go b/internal/provider/model_meraki_appliance_radio_settings.go index 9610016a..d85c7953 100644 --- a/internal/provider/model_meraki_appliance_radio_settings.go +++ b/internal/provider/model_meraki_appliance_radio_settings.go @@ -167,11 +167,10 @@ func (data *ApplianceRadioSettings) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceRadioSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceRadioSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_rf_profile.go b/internal/provider/model_meraki_appliance_rf_profile.go index f53f7c18..0c7994da 100644 --- a/internal/provider/model_meraki_appliance_rf_profile.go +++ b/internal/provider/model_meraki_appliance_rf_profile.go @@ -265,11 +265,10 @@ func (data *ApplianceRFProfile) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceRFProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceRFProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go index ddc6db63..40226c95 100644 --- a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go @@ -460,12 +460,10 @@ func (data *ApplianceSDWANInternetPolicies) fromBodyUnknowns(ctx context.Context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSDWANInternetPolicies) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "wanTrafficUplinkPreferences", []interface{}{}) +func (data ApplianceSDWANInternetPolicies) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_security_malware.go b/internal/provider/model_meraki_appliance_security_malware.go index cbb42f8c..f97e7c8a 100644 --- a/internal/provider/model_meraki_appliance_security_malware.go +++ b/internal/provider/model_meraki_appliance_security_malware.go @@ -272,11 +272,10 @@ func (data *ApplianceSecurityMalware) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSecurityMalware) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceSecurityMalware) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_settings.go b/internal/provider/model_meraki_appliance_settings.go index e4a5baec..2e08f612 100644 --- a/internal/provider/model_meraki_appliance_settings.go +++ b/internal/provider/model_meraki_appliance_settings.go @@ -139,11 +139,10 @@ func (data *ApplianceSettings) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_single_lan.go b/internal/provider/model_meraki_appliance_single_lan.go index 1adc92db..8ef1f5e2 100644 --- a/internal/provider/model_meraki_appliance_single_lan.go +++ b/internal/provider/model_meraki_appliance_single_lan.go @@ -248,11 +248,10 @@ func (data *ApplianceSingleLAN) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSingleLAN) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceSingleLAN) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_site_to_site_vpn.go b/internal/provider/model_meraki_appliance_site_to_site_vpn.go index 22b6ff05..2cacd6ab 100644 --- a/internal/provider/model_meraki_appliance_site_to_site_vpn.go +++ b/internal/provider/model_meraki_appliance_site_to_site_vpn.go @@ -314,11 +314,10 @@ func (data *ApplianceSiteToSiteVPN) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSiteToSiteVPN) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceSiteToSiteVPN) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_ssid.go b/internal/provider/model_meraki_appliance_ssid.go index 9acac370..74e19b38 100644 --- a/internal/provider/model_meraki_appliance_ssid.go +++ b/internal/provider/model_meraki_appliance_ssid.go @@ -306,11 +306,10 @@ func (data *ApplianceSSID) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceSSID) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceSSID) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_static_route.go b/internal/provider/model_meraki_appliance_static_route.go index b1431ff2..af71a925 100644 --- a/internal/provider/model_meraki_appliance_static_route.go +++ b/internal/provider/model_meraki_appliance_static_route.go @@ -139,11 +139,10 @@ func (data *ApplianceStaticRoute) fromBodyUnknowns(ctx context.Context, res mera // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceStaticRoute) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceStaticRoute) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_third_party_vpn_peers.go b/internal/provider/model_meraki_appliance_third_party_vpn_peers.go index c4093bc7..76a8c7fb 100644 --- a/internal/provider/model_meraki_appliance_third_party_vpn_peers.go +++ b/internal/provider/model_meraki_appliance_third_party_vpn_peers.go @@ -671,12 +671,10 @@ func (data *ApplianceThirdPartyVPNPeers) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceThirdPartyVPNPeers) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "peers", []interface{}{}) +func (data ApplianceThirdPartyVPNPeers) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping.go b/internal/provider/model_meraki_appliance_traffic_shaping.go index 89a94f4b..0e25aaee 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping.go @@ -111,11 +111,10 @@ func (data *ApplianceTrafficShaping) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShaping) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceTrafficShaping) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_custom_performance_class.go b/internal/provider/model_meraki_appliance_traffic_shaping_custom_performance_class.go index 08a30507..94ddd5f6 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_custom_performance_class.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_custom_performance_class.go @@ -139,11 +139,10 @@ func (data *ApplianceTrafficShapingCustomPerformanceClass) fromBodyUnknowns(ctx // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShapingCustomPerformanceClass) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceTrafficShapingCustomPerformanceClass) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go index 1db512db..824fec35 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go @@ -300,12 +300,10 @@ func (data *ApplianceTrafficShapingRules) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShapingRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceTrafficShapingRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_bandwidth.go b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_bandwidth.go index 455b8126..9b44015e 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_bandwidth.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_bandwidth.go @@ -167,11 +167,10 @@ func (data *ApplianceTrafficShapingUplinkBandwidth) fromBodyUnknowns(ctx context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShapingUplinkBandwidth) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceTrafficShapingUplinkBandwidth) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go index ac8c7ffc..2c73c5e2 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go @@ -718,12 +718,10 @@ func (data *ApplianceTrafficShapingUplinkSelection) fromBodyUnknowns(ctx context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShapingUplinkSelection) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "vpnTrafficUplinkPreferences", []interface{}{}) +func (data ApplianceTrafficShapingUplinkSelection) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go index a96c92b6..509ec835 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -248,13 +248,10 @@ func (data *ApplianceTrafficShapingVPNExclusions) fromBodyUnknowns(ctx context.C // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceTrafficShapingVPNExclusions) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "custom", []interface{}{}) - body, _ = sjson.Set(body, "majorApplications", []interface{}{}) +func (data ApplianceTrafficShapingVPNExclusions) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_uplinks_settings.go b/internal/provider/model_meraki_appliance_uplinks_settings.go index 12d52791..1632d8b0 100644 --- a/internal/provider/model_meraki_appliance_uplinks_settings.go +++ b/internal/provider/model_meraki_appliance_uplinks_settings.go @@ -492,11 +492,10 @@ func (data *ApplianceUplinksSettings) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceUplinksSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceUplinksSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vlan.go b/internal/provider/model_meraki_appliance_vlan.go index c42fa3f0..5a4a833e 100644 --- a/internal/provider/model_meraki_appliance_vlan.go +++ b/internal/provider/model_meraki_appliance_vlan.go @@ -702,11 +702,10 @@ func (data *ApplianceVLAN) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVLAN) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceVLAN) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vlan_dhcp.go b/internal/provider/model_meraki_appliance_vlan_dhcp.go index 0c21add6..8f7e6e46 100644 --- a/internal/provider/model_meraki_appliance_vlan_dhcp.go +++ b/internal/provider/model_meraki_appliance_vlan_dhcp.go @@ -411,11 +411,10 @@ func (data *ApplianceVLANDHCP) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVLANDHCP) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceVLANDHCP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vlans_settings.go b/internal/provider/model_meraki_appliance_vlans_settings.go index 936f7f49..baa73a57 100644 --- a/internal/provider/model_meraki_appliance_vlans_settings.go +++ b/internal/provider/model_meraki_appliance_vlans_settings.go @@ -97,11 +97,10 @@ func (data *ApplianceVLANsSettings) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVLANsSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceVLANsSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vmx_authentication_token.go b/internal/provider/model_meraki_appliance_vmx_authentication_token.go index cdafb807..62b62806 100644 --- a/internal/provider/model_meraki_appliance_vmx_authentication_token.go +++ b/internal/provider/model_meraki_appliance_vmx_authentication_token.go @@ -118,11 +118,10 @@ func (data *ApplianceVMXAuthenticationToken) fromBodyUnknowns(ctx context.Contex // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVMXAuthenticationToken) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceVMXAuthenticationToken) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vpn_bgp.go b/internal/provider/model_meraki_appliance_vpn_bgp.go index 7341da4b..144ce2cf 100644 --- a/internal/provider/model_meraki_appliance_vpn_bgp.go +++ b/internal/provider/model_meraki_appliance_vpn_bgp.go @@ -385,11 +385,10 @@ func (data *ApplianceVPNBGP) fromBodyUnknowns(ctx context.Context, res meraki.Re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVPNBGP) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceVPNBGP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vpn_firewall_rules.go b/internal/provider/model_meraki_appliance_vpn_firewall_rules.go index 66727aca..4dd179c7 100644 --- a/internal/provider/model_meraki_appliance_vpn_firewall_rules.go +++ b/internal/provider/model_meraki_appliance_vpn_firewall_rules.go @@ -238,12 +238,10 @@ func (data *ApplianceVPNFirewallRules) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVPNFirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data ApplianceVPNFirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go b/internal/provider/model_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go index 25abc311..fe0046c0 100644 --- a/internal/provider/model_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go +++ b/internal/provider/model_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go @@ -172,12 +172,10 @@ func (data *ApplianceVPNSiteToSiteIPsecPeersSLAs) fromBodyUnknowns(ctx context.C // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceVPNSiteToSiteIPsecPeersSLAs) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "items", []interface{}{}) +func (data ApplianceVPNSiteToSiteIPsecPeersSLAs) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_appliance_warm_spare.go b/internal/provider/model_meraki_appliance_warm_spare.go index 7c3d0446..86133d84 100644 --- a/internal/provider/model_meraki_appliance_warm_spare.go +++ b/internal/provider/model_meraki_appliance_warm_spare.go @@ -145,11 +145,10 @@ func (data *ApplianceWarmSpare) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ApplianceWarmSpare) toDestroyBody(ctx context.Context) string { - body := "" +func (data ApplianceWarmSpare) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_custom_analytics.go b/internal/provider/model_meraki_camera_custom_analytics.go index e0082f7d..ae6fc0f0 100644 --- a/internal/provider/model_meraki_camera_custom_analytics.go +++ b/internal/provider/model_meraki_camera_custom_analytics.go @@ -200,11 +200,10 @@ func (data *CameraCustomAnalytics) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraCustomAnalytics) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraCustomAnalytics) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_device_wireless_profiles.go b/internal/provider/model_meraki_camera_device_wireless_profiles.go index 7b3a8008..a06ce157 100644 --- a/internal/provider/model_meraki_camera_device_wireless_profiles.go +++ b/internal/provider/model_meraki_camera_device_wireless_profiles.go @@ -125,11 +125,10 @@ func (data *CameraDeviceWirelessProfiles) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraDeviceWirelessProfiles) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraDeviceWirelessProfiles) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_quality_retention.go b/internal/provider/model_meraki_camera_quality_retention.go index cb8dd3fe..cbd7a3b2 100644 --- a/internal/provider/model_meraki_camera_quality_retention.go +++ b/internal/provider/model_meraki_camera_quality_retention.go @@ -181,11 +181,10 @@ func (data *CameraQualityRetention) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraQualityRetention) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraQualityRetention) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_quality_retention_profile.go b/internal/provider/model_meraki_camera_quality_retention_profile.go index 43ed5e1b..bc908c90 100644 --- a/internal/provider/model_meraki_camera_quality_retention_profile.go +++ b/internal/provider/model_meraki_camera_quality_retention_profile.go @@ -881,11 +881,10 @@ func (data *CameraQualityRetentionProfile) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraQualityRetentionProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraQualityRetentionProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_role.go b/internal/provider/model_meraki_camera_role.go index 30e28969..45193dcd 100644 --- a/internal/provider/model_meraki_camera_role.go +++ b/internal/provider/model_meraki_camera_role.go @@ -400,11 +400,10 @@ func (data *CameraRole) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraRole) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraRole) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_sense.go b/internal/provider/model_meraki_camera_sense.go index 2f933816..c36154b4 100644 --- a/internal/provider/model_meraki_camera_sense.go +++ b/internal/provider/model_meraki_camera_sense.go @@ -139,11 +139,10 @@ func (data *CameraSense) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraSense) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraSense) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_video_settings.go b/internal/provider/model_meraki_camera_video_settings.go index 55ec60a8..931d3746 100644 --- a/internal/provider/model_meraki_camera_video_settings.go +++ b/internal/provider/model_meraki_camera_video_settings.go @@ -97,11 +97,10 @@ func (data *CameraVideoSettings) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraVideoSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraVideoSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_camera_wireless_profile.go b/internal/provider/model_meraki_camera_wireless_profile.go index 11900790..89c957ab 100644 --- a/internal/provider/model_meraki_camera_wireless_profile.go +++ b/internal/provider/model_meraki_camera_wireless_profile.go @@ -181,11 +181,10 @@ func (data *CameraWirelessProfile) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CameraWirelessProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data CameraWirelessProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_connectivity_monitoring_destinations.go b/internal/provider/model_meraki_cellular_gateway_connectivity_monitoring_destinations.go index ccf93467..975d2e8b 100644 --- a/internal/provider/model_meraki_cellular_gateway_connectivity_monitoring_destinations.go +++ b/internal/provider/model_meraki_cellular_gateway_connectivity_monitoring_destinations.go @@ -187,18 +187,10 @@ func (data *CellularGatewayConnectivityMonitoringDestinations) fromBodyUnknowns( // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewayConnectivityMonitoringDestinations) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "destinations", []interface{}{ - map[string]interface{}{ - "ip": "8.8.8.8", - "default": true, - "description": "Google", - }, - }) +func (data CellularGatewayConnectivityMonitoringDestinations) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_dhcp.go b/internal/provider/model_meraki_cellular_gateway_dhcp.go index a4291f7f..799dd656 100644 --- a/internal/provider/model_meraki_cellular_gateway_dhcp.go +++ b/internal/provider/model_meraki_cellular_gateway_dhcp.go @@ -128,11 +128,10 @@ func (data *CellularGatewayDHCP) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewayDHCP) toDestroyBody(ctx context.Context) string { - body := "" +func (data CellularGatewayDHCP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_lan.go b/internal/provider/model_meraki_cellular_gateway_lan.go index b49ed455..2acda529 100644 --- a/internal/provider/model_meraki_cellular_gateway_lan.go +++ b/internal/provider/model_meraki_cellular_gateway_lan.go @@ -286,13 +286,10 @@ func (data *CellularGatewayLAN) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewayLAN) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "fixedIpAssignments", []interface{}{}) - body, _ = sjson.Set(body, "reservedIpRanges", []interface{}{}) +func (data CellularGatewayLAN) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_port_forwarding_rules.go b/internal/provider/model_meraki_cellular_gateway_port_forwarding_rules.go index 92016864..7b776d07 100644 --- a/internal/provider/model_meraki_cellular_gateway_port_forwarding_rules.go +++ b/internal/provider/model_meraki_cellular_gateway_port_forwarding_rules.go @@ -220,12 +220,10 @@ func (data *CellularGatewayPortForwardingRules) fromBodyUnknowns(ctx context.Con // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewayPortForwardingRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data CellularGatewayPortForwardingRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_subnet_pool.go b/internal/provider/model_meraki_cellular_gateway_subnet_pool.go index c0cc79e3..ed9ebc97 100644 --- a/internal/provider/model_meraki_cellular_gateway_subnet_pool.go +++ b/internal/provider/model_meraki_cellular_gateway_subnet_pool.go @@ -111,11 +111,10 @@ func (data *CellularGatewaySubnetPool) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewaySubnetPool) toDestroyBody(ctx context.Context) string { - body := "" +func (data CellularGatewaySubnetPool) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_cellular_gateway_uplink.go b/internal/provider/model_meraki_cellular_gateway_uplink.go index c677e477..e10de33d 100644 --- a/internal/provider/model_meraki_cellular_gateway_uplink.go +++ b/internal/provider/model_meraki_cellular_gateway_uplink.go @@ -111,11 +111,12 @@ func (data *CellularGatewayUplink) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data CellularGatewayUplink) toDestroyBody(ctx context.Context) string { - body := "" +func (data CellularGatewayUplink) addDeleteValues(ctx context.Context, body string) string { + body, _ = sjson.Set(body, "bandwidthLimits.limitDown", nil) + body, _ = sjson.Set(body, "bandwidthLimits.limitUp", nil) return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_device.go b/internal/provider/model_meraki_device.go index 5db69cf8..df122e93 100644 --- a/internal/provider/model_meraki_device.go +++ b/internal/provider/model_meraki_device.go @@ -182,11 +182,10 @@ func (data *Device) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data Device) toDestroyBody(ctx context.Context) string { - body := "" +func (data Device) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_device_cellular_sims.go b/internal/provider/model_meraki_device_cellular_sims.go index 50543647..43391544 100644 --- a/internal/provider/model_meraki_device_cellular_sims.go +++ b/internal/provider/model_meraki_device_cellular_sims.go @@ -361,11 +361,10 @@ func (data *DeviceCellularSIMs) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data DeviceCellularSIMs) toDestroyBody(ctx context.Context) string { - body := "" +func (data DeviceCellularSIMs) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_device_management_interface.go b/internal/provider/model_meraki_device_management_interface.go index 1ef9eef3..62fb65bb 100644 --- a/internal/provider/model_meraki_device_management_interface.go +++ b/internal/provider/model_meraki_device_management_interface.go @@ -284,11 +284,10 @@ func (data *DeviceManagementInterface) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data DeviceManagementInterface) toDestroyBody(ctx context.Context) string { - body := "" +func (data DeviceManagementInterface) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_insight_monitored_media_server.go b/internal/provider/model_meraki_insight_monitored_media_server.go index f4b5b5f3..2dd431bf 100644 --- a/internal/provider/model_meraki_insight_monitored_media_server.go +++ b/internal/provider/model_meraki_insight_monitored_media_server.go @@ -125,11 +125,10 @@ func (data *InsightMonitoredMediaServer) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data InsightMonitoredMediaServer) toDestroyBody(ctx context.Context) string { - body := "" +func (data InsightMonitoredMediaServer) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network.go b/internal/provider/model_meraki_network.go index 711f766f..26072b92 100644 --- a/internal/provider/model_meraki_network.go +++ b/internal/provider/model_meraki_network.go @@ -158,11 +158,10 @@ func (data *Network) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data Network) toDestroyBody(ctx context.Context) string { - body := "" +func (data Network) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_alerts_settings.go b/internal/provider/model_meraki_network_alerts_settings.go index 9f897c68..a3791dcf 100644 --- a/internal/provider/model_meraki_network_alerts_settings.go +++ b/internal/provider/model_meraki_network_alerts_settings.go @@ -635,11 +635,10 @@ func (data *NetworkAlertsSettings) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkAlertsSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkAlertsSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_client_policy.go b/internal/provider/model_meraki_network_client_policy.go index 03cd01d3..277ab5b3 100644 --- a/internal/provider/model_meraki_network_client_policy.go +++ b/internal/provider/model_meraki_network_client_policy.go @@ -112,11 +112,10 @@ func (data *NetworkClientPolicy) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkClientPolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkClientPolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_client_splash_authorization_status.go b/internal/provider/model_meraki_network_client_splash_authorization_status.go index 58b11466..9f7b3bec 100644 --- a/internal/provider/model_meraki_network_client_splash_authorization_status.go +++ b/internal/provider/model_meraki_network_client_splash_authorization_status.go @@ -294,11 +294,10 @@ func (data *NetworkClientSplashAuthorizationStatus) fromBodyUnknowns(ctx context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkClientSplashAuthorizationStatus) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkClientSplashAuthorizationStatus) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_device_claim.go b/internal/provider/model_meraki_network_device_claim.go index 6b2af465..b4ec0c85 100644 --- a/internal/provider/model_meraki_network_device_claim.go +++ b/internal/provider/model_meraki_network_device_claim.go @@ -269,11 +269,10 @@ func (data *NetworkDeviceClaim) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkDeviceClaim) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkDeviceClaim) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_device_claim_vmx.go b/internal/provider/model_meraki_network_device_claim_vmx.go index c0e85439..ad55f323 100644 --- a/internal/provider/model_meraki_network_device_claim_vmx.go +++ b/internal/provider/model_meraki_network_device_claim_vmx.go @@ -115,11 +115,10 @@ func (data *NetworkDeviceClaimVMX) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkDeviceClaimVMX) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkDeviceClaimVMX) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_firmware_upgrades.go b/internal/provider/model_meraki_network_firmware_upgrades.go index cc410583..cb04f112 100644 --- a/internal/provider/model_meraki_network_firmware_upgrades.go +++ b/internal/provider/model_meraki_network_firmware_upgrades.go @@ -503,11 +503,10 @@ func (data *NetworkFirmwareUpgrades) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkFirmwareUpgrades) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkFirmwareUpgrades) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_floor_plan.go b/internal/provider/model_meraki_network_floor_plan.go index ee60cd5d..0ba4a55e 100644 --- a/internal/provider/model_meraki_network_floor_plan.go +++ b/internal/provider/model_meraki_network_floor_plan.go @@ -155,11 +155,10 @@ func (data *NetworkFloorPlan) fromBodyUnknowns(ctx context.Context, res meraki.R // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkFloorPlan) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkFloorPlan) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_group_policy.go b/internal/provider/model_meraki_network_group_policy.go index f96b9d70..2daa0692 100644 --- a/internal/provider/model_meraki_network_group_policy.go +++ b/internal/provider/model_meraki_network_group_policy.go @@ -1116,11 +1116,10 @@ func (data *NetworkGroupPolicy) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkGroupPolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkGroupPolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_meraki_auth_user.go b/internal/provider/model_meraki_network_meraki_auth_user.go index 92e25f50..29f88d01 100644 --- a/internal/provider/model_meraki_network_meraki_auth_user.go +++ b/internal/provider/model_meraki_network_meraki_auth_user.go @@ -237,11 +237,10 @@ func (data *NetworkMerakiAuthUser) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkMerakiAuthUser) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkMerakiAuthUser) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_mqtt_broker.go b/internal/provider/model_meraki_network_mqtt_broker.go index 34546d72..7af609b2 100644 --- a/internal/provider/model_meraki_network_mqtt_broker.go +++ b/internal/provider/model_meraki_network_mqtt_broker.go @@ -175,11 +175,10 @@ func (data *NetworkMQTTBroker) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkMQTTBroker) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkMQTTBroker) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_netflow.go b/internal/provider/model_meraki_network_netflow.go index 6adb34f8..c8a27858 100644 --- a/internal/provider/model_meraki_network_netflow.go +++ b/internal/provider/model_meraki_network_netflow.go @@ -153,11 +153,10 @@ func (data *NetworkNetflow) fromBodyUnknowns(ctx context.Context, res meraki.Res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkNetflow) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkNetflow) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_settings.go b/internal/provider/model_meraki_network_settings.go index 3b915129..e71eb823 100644 --- a/internal/provider/model_meraki_network_settings.go +++ b/internal/provider/model_meraki_network_settings.go @@ -171,11 +171,10 @@ func (data *NetworkSettings) fromBodyUnknowns(ctx context.Context, res meraki.Re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_snmp.go b/internal/provider/model_meraki_network_snmp.go index 17d11b0a..fe1a2780 100644 --- a/internal/provider/model_meraki_network_snmp.go +++ b/internal/provider/model_meraki_network_snmp.go @@ -200,11 +200,10 @@ func (data *NetworkSNMP) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkSNMP) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkSNMP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_syslog_servers.go b/internal/provider/model_meraki_network_syslog_servers.go index 02f374f4..e00758cb 100644 --- a/internal/provider/model_meraki_network_syslog_servers.go +++ b/internal/provider/model_meraki_network_syslog_servers.go @@ -190,12 +190,10 @@ func (data *NetworkSyslogServers) fromBodyUnknowns(ctx context.Context, res mera // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkSyslogServers) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "servers", []interface{}{}) +func (data NetworkSyslogServers) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_traffic_analysis.go b/internal/provider/model_meraki_network_traffic_analysis.go index 0ff0a10e..734fceaf 100644 --- a/internal/provider/model_meraki_network_traffic_analysis.go +++ b/internal/provider/model_meraki_network_traffic_analysis.go @@ -200,11 +200,10 @@ func (data *NetworkTrafficAnalysis) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkTrafficAnalysis) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkTrafficAnalysis) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_vlan_profile.go b/internal/provider/model_meraki_network_vlan_profile.go index 97ad4fa3..313450bd 100644 --- a/internal/provider/model_meraki_network_vlan_profile.go +++ b/internal/provider/model_meraki_network_vlan_profile.go @@ -303,11 +303,10 @@ func (data *NetworkVLANProfile) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkVLANProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkVLANProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_webhook_http_server.go b/internal/provider/model_meraki_network_webhook_http_server.go index 6af5d592..65300e39 100644 --- a/internal/provider/model_meraki_network_webhook_http_server.go +++ b/internal/provider/model_meraki_network_webhook_http_server.go @@ -143,11 +143,10 @@ func (data *NetworkWebhookHTTPServer) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkWebhookHTTPServer) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkWebhookHTTPServer) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_network_webhook_payload_template.go b/internal/provider/model_meraki_network_webhook_payload_template.go index 13c6041e..49c783be 100644 --- a/internal/provider/model_meraki_network_webhook_payload_template.go +++ b/internal/provider/model_meraki_network_webhook_payload_template.go @@ -228,11 +228,10 @@ func (data *NetworkWebhookPayloadTemplate) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data NetworkWebhookPayloadTemplate) toDestroyBody(ctx context.Context) string { - body := "" +func (data NetworkWebhookPayloadTemplate) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization.go b/internal/provider/model_meraki_organization.go index c07cf393..331e8aa6 100644 --- a/internal/provider/model_meraki_organization.go +++ b/internal/provider/model_meraki_organization.go @@ -184,11 +184,10 @@ func (data *Organization) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data Organization) toDestroyBody(ctx context.Context) string { - body := "" +func (data Organization) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_adaptive_policy.go b/internal/provider/model_meraki_organization_adaptive_policy.go index 2b7679ad..55668060 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy.go +++ b/internal/provider/model_meraki_organization_adaptive_policy.go @@ -245,11 +245,10 @@ func (data *OrganizationAdaptivePolicy) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAdaptivePolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAdaptivePolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_adaptive_policy_acl.go b/internal/provider/model_meraki_organization_adaptive_policy_acl.go index 408951c8..18cf5ec0 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy_acl.go +++ b/internal/provider/model_meraki_organization_adaptive_policy_acl.go @@ -245,11 +245,10 @@ func (data *OrganizationAdaptivePolicyACL) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAdaptivePolicyACL) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAdaptivePolicyACL) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_adaptive_policy_group.go b/internal/provider/model_meraki_organization_adaptive_policy_group.go index f6761dac..89952768 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy_group.go +++ b/internal/provider/model_meraki_organization_adaptive_policy_group.go @@ -214,11 +214,10 @@ func (data *OrganizationAdaptivePolicyGroup) fromBodyUnknowns(ctx context.Contex // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAdaptivePolicyGroup) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAdaptivePolicyGroup) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_adaptive_policy_settings.go b/internal/provider/model_meraki_organization_adaptive_policy_settings.go index 270f83e1..592e2596 100644 --- a/internal/provider/model_meraki_organization_adaptive_policy_settings.go +++ b/internal/provider/model_meraki_organization_adaptive_policy_settings.go @@ -100,11 +100,10 @@ func (data *OrganizationAdaptivePolicySettings) fromBodyUnknowns(ctx context.Con // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAdaptivePolicySettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAdaptivePolicySettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_admin.go b/internal/provider/model_meraki_organization_admin.go index ae711855..97c8bb66 100644 --- a/internal/provider/model_meraki_organization_admin.go +++ b/internal/provider/model_meraki_organization_admin.go @@ -314,11 +314,10 @@ func (data *OrganizationAdmin) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAdmin) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAdmin) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_alerts_profile.go b/internal/provider/model_meraki_organization_alerts_profile.go index c29bdcba..0f410d09 100644 --- a/internal/provider/model_meraki_organization_alerts_profile.go +++ b/internal/provider/model_meraki_organization_alerts_profile.go @@ -272,11 +272,10 @@ func (data *OrganizationAlertsProfile) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAlertsProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAlertsProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_auth_radius_server.go b/internal/provider/model_meraki_organization_auth_radius_server.go index 04765537..644fb77f 100644 --- a/internal/provider/model_meraki_organization_auth_radius_server.go +++ b/internal/provider/model_meraki_organization_auth_radius_server.go @@ -205,11 +205,10 @@ func (data *OrganizationAuthRADIUSServer) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationAuthRADIUSServer) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationAuthRADIUSServer) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_branding_policies_priorities.go b/internal/provider/model_meraki_organization_branding_policies_priorities.go index 016415ba..87751063 100644 --- a/internal/provider/model_meraki_organization_branding_policies_priorities.go +++ b/internal/provider/model_meraki_organization_branding_policies_priorities.go @@ -100,11 +100,10 @@ func (data *OrganizationBrandingPoliciesPriorities) fromBodyUnknowns(ctx context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationBrandingPoliciesPriorities) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationBrandingPoliciesPriorities) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_branding_policy.go b/internal/provider/model_meraki_organization_branding_policy.go index 88c571bd..c5a61444 100644 --- a/internal/provider/model_meraki_organization_branding_policy.go +++ b/internal/provider/model_meraki_organization_branding_policy.go @@ -394,11 +394,10 @@ func (data *OrganizationBrandingPolicy) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationBrandingPolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationBrandingPolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_config_template.go b/internal/provider/model_meraki_organization_config_template.go index 0f242665..3995d296 100644 --- a/internal/provider/model_meraki_organization_config_template.go +++ b/internal/provider/model_meraki_organization_config_template.go @@ -115,11 +115,10 @@ func (data *OrganizationConfigTemplate) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationConfigTemplate) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationConfigTemplate) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_early_access_features_opt_in.go b/internal/provider/model_meraki_organization_early_access_features_opt_in.go index 331192f9..1d13301b 100644 --- a/internal/provider/model_meraki_organization_early_access_features_opt_in.go +++ b/internal/provider/model_meraki_organization_early_access_features_opt_in.go @@ -106,11 +106,10 @@ func (data *OrganizationEarlyAccessFeaturesOptIn) fromBodyUnknowns(ctx context.C // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationEarlyAccessFeaturesOptIn) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationEarlyAccessFeaturesOptIn) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_extensions_thousand_eyes_network.go b/internal/provider/model_meraki_organization_extensions_thousand_eyes_network.go index f348fc59..e873eb75 100644 --- a/internal/provider/model_meraki_organization_extensions_thousand_eyes_network.go +++ b/internal/provider/model_meraki_organization_extensions_thousand_eyes_network.go @@ -130,11 +130,10 @@ func (data *OrganizationExtensionsThousandEyesNetwork) fromBodyUnknowns(ctx cont // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationExtensionsThousandEyesNetwork) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationExtensionsThousandEyesNetwork) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_inventory_claim.go b/internal/provider/model_meraki_organization_inventory_claim.go index aa4f5db3..53176630 100644 --- a/internal/provider/model_meraki_organization_inventory_claim.go +++ b/internal/provider/model_meraki_organization_inventory_claim.go @@ -213,11 +213,10 @@ func (data *OrganizationInventoryClaim) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationInventoryClaim) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationInventoryClaim) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_license.go b/internal/provider/model_meraki_organization_license.go index 97dfd29b..2f9b0a0d 100644 --- a/internal/provider/model_meraki_organization_license.go +++ b/internal/provider/model_meraki_organization_license.go @@ -98,11 +98,10 @@ func (data *OrganizationLicense) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationLicense) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationLicense) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_login_security.go b/internal/provider/model_meraki_organization_login_security.go index 62350ef1..1ce807f9 100644 --- a/internal/provider/model_meraki_organization_login_security.go +++ b/internal/provider/model_meraki_organization_login_security.go @@ -298,11 +298,10 @@ func (data *OrganizationLoginSecurity) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationLoginSecurity) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationLoginSecurity) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_policy_object.go b/internal/provider/model_meraki_organization_policy_object.go index 795ec62c..19864873 100644 --- a/internal/provider/model_meraki_organization_policy_object.go +++ b/internal/provider/model_meraki_organization_policy_object.go @@ -198,11 +198,10 @@ func (data *OrganizationPolicyObject) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationPolicyObject) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationPolicyObject) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_policy_object_group.go b/internal/provider/model_meraki_organization_policy_object_group.go index 5c39051d..3fc0958d 100644 --- a/internal/provider/model_meraki_organization_policy_object_group.go +++ b/internal/provider/model_meraki_organization_policy_object_group.go @@ -128,11 +128,10 @@ func (data *OrganizationPolicyObjectGroup) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationPolicyObjectGroup) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationPolicyObjectGroup) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_saml.go b/internal/provider/model_meraki_organization_saml.go index 3da53eb6..e83b7da1 100644 --- a/internal/provider/model_meraki_organization_saml.go +++ b/internal/provider/model_meraki_organization_saml.go @@ -97,11 +97,10 @@ func (data *OrganizationSAML) fromBodyUnknowns(ctx context.Context, res meraki.R // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationSAML) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationSAML) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_saml_idp.go b/internal/provider/model_meraki_organization_saml_idp.go index bf5dcfd3..12c71341 100644 --- a/internal/provider/model_meraki_organization_saml_idp.go +++ b/internal/provider/model_meraki_organization_saml_idp.go @@ -111,11 +111,10 @@ func (data *OrganizationSAMLIdP) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationSAMLIdP) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationSAMLIdP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_saml_role.go b/internal/provider/model_meraki_organization_saml_role.go index 8b69dc80..1eca8df3 100644 --- a/internal/provider/model_meraki_organization_saml_role.go +++ b/internal/provider/model_meraki_organization_saml_role.go @@ -286,11 +286,10 @@ func (data *OrganizationSAMLRole) fromBodyUnknowns(ctx context.Context, res mera // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationSAMLRole) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationSAMLRole) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_organization_snmp.go b/internal/provider/model_meraki_organization_snmp.go index 875d3f78..030d8855 100644 --- a/internal/provider/model_meraki_organization_snmp.go +++ b/internal/provider/model_meraki_organization_snmp.go @@ -164,11 +164,10 @@ func (data *OrganizationSNMP) fromBodyUnknowns(ctx context.Context, res meraki.R // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data OrganizationSNMP) toDestroyBody(ctx context.Context) string { - body := "" +func (data OrganizationSNMP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_sensor_alerts_profile.go b/internal/provider/model_meraki_sensor_alerts_profile.go index 83fd67e7..1176e344 100644 --- a/internal/provider/model_meraki_sensor_alerts_profile.go +++ b/internal/provider/model_meraki_sensor_alerts_profile.go @@ -643,11 +643,10 @@ func (data *SensorAlertsProfile) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SensorAlertsProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data SensorAlertsProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_sensor_mqtt_broker.go b/internal/provider/model_meraki_sensor_mqtt_broker.go index cb5e7d35..7532738d 100644 --- a/internal/provider/model_meraki_sensor_mqtt_broker.go +++ b/internal/provider/model_meraki_sensor_mqtt_broker.go @@ -98,12 +98,11 @@ func (data *SensorMQTTBroker) fromBodyUnknowns(ctx context.Context, res meraki.R // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SensorMQTTBroker) toDestroyBody(ctx context.Context) string { - body := "" +func (data SensorMQTTBroker) addDeleteValues(ctx context.Context, body string) string { body, _ = sjson.Set(body, "enabled", false) return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_sensor_relationships.go b/internal/provider/model_meraki_sensor_relationships.go index 9fa1917a..195ba477 100644 --- a/internal/provider/model_meraki_sensor_relationships.go +++ b/internal/provider/model_meraki_sensor_relationships.go @@ -158,11 +158,10 @@ func (data *SensorRelationships) fromBodyUnknowns(ctx context.Context, res merak // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SensorRelationships) toDestroyBody(ctx context.Context) string { - body := "" +func (data SensorRelationships) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_sm_admin_role.go b/internal/provider/model_meraki_sm_admin_role.go index 810f9ddf..ddbb33ff 100644 --- a/internal/provider/model_meraki_sm_admin_role.go +++ b/internal/provider/model_meraki_sm_admin_role.go @@ -128,11 +128,10 @@ func (data *SMAdminRole) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SMAdminRole) toDestroyBody(ctx context.Context) string { - body := "" +func (data SMAdminRole) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_sm_target_group.go b/internal/provider/model_meraki_sm_target_group.go index 654185ba..80d1eec5 100644 --- a/internal/provider/model_meraki_sm_target_group.go +++ b/internal/provider/model_meraki_sm_target_group.go @@ -101,11 +101,10 @@ func (data *SMTargetGroup) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SMTargetGroup) toDestroyBody(ctx context.Context) string { - body := "" +func (data SMTargetGroup) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_access_control_lists.go b/internal/provider/model_meraki_switch_access_control_lists.go index 4e62bf2d..f509cc51 100644 --- a/internal/provider/model_meraki_switch_access_control_lists.go +++ b/internal/provider/model_meraki_switch_access_control_lists.go @@ -248,12 +248,10 @@ func (data *SwitchAccessControlLists) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchAccessControlLists) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data SwitchAccessControlLists) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_access_policy.go b/internal/provider/model_meraki_switch_access_policy.go index ca402bcc..22e7e702 100644 --- a/internal/provider/model_meraki_switch_access_policy.go +++ b/internal/provider/model_meraki_switch_access_policy.go @@ -662,11 +662,10 @@ func (data *SwitchAccessPolicy) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchAccessPolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchAccessPolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_alternate_management_interface.go b/internal/provider/model_meraki_switch_alternate_management_interface.go index edb5ae41..de7b2329 100644 --- a/internal/provider/model_meraki_switch_alternate_management_interface.go +++ b/internal/provider/model_meraki_switch_alternate_management_interface.go @@ -224,11 +224,10 @@ func (data *SwitchAlternateManagementInterface) fromBodyUnknowns(ctx context.Con // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchAlternateManagementInterface) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchAlternateManagementInterface) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_dhcp_server_policy.go b/internal/provider/model_meraki_switch_dhcp_server_policy.go index cb07de1a..e80879d3 100644 --- a/internal/provider/model_meraki_switch_dhcp_server_policy.go +++ b/internal/provider/model_meraki_switch_dhcp_server_policy.go @@ -158,11 +158,10 @@ func (data *SwitchDHCPServerPolicy) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchDHCPServerPolicy) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchDHCPServerPolicy) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_dhcp_server_policy_arp_inspection_trusted_server.go b/internal/provider/model_meraki_switch_dhcp_server_policy_arp_inspection_trusted_server.go index 992510b0..854c16a9 100644 --- a/internal/provider/model_meraki_switch_dhcp_server_policy_arp_inspection_trusted_server.go +++ b/internal/provider/model_meraki_switch_dhcp_server_policy_arp_inspection_trusted_server.go @@ -125,11 +125,10 @@ func (data *SwitchDHCPServerPolicyARPInspectionTrustedServer) fromBodyUnknowns(c // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchDHCPServerPolicyARPInspectionTrustedServer) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchDHCPServerPolicyARPInspectionTrustedServer) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_dscp_to_cos_mappings.go b/internal/provider/model_meraki_switch_dscp_to_cos_mappings.go index 0e7119f9..ba56a48f 100644 --- a/internal/provider/model_meraki_switch_dscp_to_cos_mappings.go +++ b/internal/provider/model_meraki_switch_dscp_to_cos_mappings.go @@ -187,12 +187,10 @@ func (data *SwitchDSCPToCoSMappings) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchDSCPToCoSMappings) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "mappings", []interface{}{}) +func (data SwitchDSCPToCoSMappings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_link_aggregation.go b/internal/provider/model_meraki_switch_link_aggregation.go index 1c15fc52..83568f05 100644 --- a/internal/provider/model_meraki_switch_link_aggregation.go +++ b/internal/provider/model_meraki_switch_link_aggregation.go @@ -258,11 +258,10 @@ func (data *SwitchLinkAggregation) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchLinkAggregation) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchLinkAggregation) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_mtu.go b/internal/provider/model_meraki_switch_mtu.go index a5d22c83..054ae905 100644 --- a/internal/provider/model_meraki_switch_mtu.go +++ b/internal/provider/model_meraki_switch_mtu.go @@ -180,11 +180,10 @@ func (data *SwitchMTU) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchMTU) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchMTU) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_organization_ports_profile.go b/internal/provider/model_meraki_switch_organization_ports_profile.go index 1b1449a6..37ebe3c2 100644 --- a/internal/provider/model_meraki_switch_organization_ports_profile.go +++ b/internal/provider/model_meraki_switch_organization_ports_profile.go @@ -515,11 +515,10 @@ func (data *SwitchOrganizationPortsProfile) fromBodyUnknowns(ctx context.Context // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchOrganizationPortsProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchOrganizationPortsProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go b/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go index 9db97666..ff62cfa2 100644 --- a/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go +++ b/internal/provider/model_meraki_switch_organization_ports_profiles_automation.go @@ -420,11 +420,10 @@ func (data *SwitchOrganizationPortsProfilesAutomation) fromBodyUnknowns(ctx cont // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchOrganizationPortsProfilesAutomation) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchOrganizationPortsProfilesAutomation) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_port.go b/internal/provider/model_meraki_switch_port.go index dd516aed..6684a5c8 100644 --- a/internal/provider/model_meraki_switch_port.go +++ b/internal/provider/model_meraki_switch_port.go @@ -497,8 +497,7 @@ func (data *SwitchPort) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -func (data SwitchPort) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchPort) addDeleteValues(ctx context.Context, body string) string { body, _ = sjson.Set(body, "accessPolicyType", "Open") if !data.AdaptivePolicyGroupId.IsNull() { // This can fail with "Adaptive Policy is not enabled in this network" diff --git a/internal/provider/model_meraki_switch_port_schedule.go b/internal/provider/model_meraki_switch_port_schedule.go index dbf2d156..366bae56 100644 --- a/internal/provider/model_meraki_switch_port_schedule.go +++ b/internal/provider/model_meraki_switch_port_schedule.go @@ -391,11 +391,10 @@ func (data *SwitchPortSchedule) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchPortSchedule) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchPortSchedule) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_qos_rule.go b/internal/provider/model_meraki_switch_qos_rule.go index 784aed89..77549820 100644 --- a/internal/provider/model_meraki_switch_qos_rule.go +++ b/internal/provider/model_meraki_switch_qos_rule.go @@ -181,11 +181,10 @@ func (data *SwitchQoSRule) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchQoSRule) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchQoSRule) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_qos_rule_order.go b/internal/provider/model_meraki_switch_qos_rule_order.go index e32465d3..94d7db6b 100644 --- a/internal/provider/model_meraki_switch_qos_rule_order.go +++ b/internal/provider/model_meraki_switch_qos_rule_order.go @@ -100,11 +100,10 @@ func (data *SwitchQoSRuleOrder) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchQoSRuleOrder) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchQoSRuleOrder) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_interface.go b/internal/provider/model_meraki_switch_routing_interface.go index 121ce558..36b04e83 100644 --- a/internal/provider/model_meraki_switch_routing_interface.go +++ b/internal/provider/model_meraki_switch_routing_interface.go @@ -321,11 +321,10 @@ func (data *SwitchRoutingInterface) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingInterface) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingInterface) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_interface_dhcp.go b/internal/provider/model_meraki_switch_routing_interface_dhcp.go index 9bd1a787..5bd74c63 100644 --- a/internal/provider/model_meraki_switch_routing_interface_dhcp.go +++ b/internal/provider/model_meraki_switch_routing_interface_dhcp.go @@ -504,11 +504,10 @@ func (data *SwitchRoutingInterfaceDHCP) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingInterfaceDHCP) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingInterfaceDHCP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_multicast.go b/internal/provider/model_meraki_switch_routing_multicast.go index f5d42ed7..aec51cf9 100644 --- a/internal/provider/model_meraki_switch_routing_multicast.go +++ b/internal/provider/model_meraki_switch_routing_multicast.go @@ -250,11 +250,10 @@ func (data *SwitchRoutingMulticast) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingMulticast) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingMulticast) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_multicast_rendezvous_point.go b/internal/provider/model_meraki_switch_routing_multicast_rendezvous_point.go index e2042517..1a9db05a 100644 --- a/internal/provider/model_meraki_switch_routing_multicast_rendezvous_point.go +++ b/internal/provider/model_meraki_switch_routing_multicast_rendezvous_point.go @@ -125,11 +125,10 @@ func (data *SwitchRoutingMulticastRendezvousPoint) fromBodyUnknowns(ctx context. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingMulticastRendezvousPoint) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingMulticastRendezvousPoint) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_ospf.go b/internal/provider/model_meraki_switch_routing_ospf.go index 0942362e..dd52257f 100644 --- a/internal/provider/model_meraki_switch_routing_ospf.go +++ b/internal/provider/model_meraki_switch_routing_ospf.go @@ -412,11 +412,10 @@ func (data *SwitchRoutingOSPF) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingOSPF) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingOSPF) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_routing_static_route.go b/internal/provider/model_meraki_switch_routing_static_route.go index 27723673..e9560e8b 100644 --- a/internal/provider/model_meraki_switch_routing_static_route.go +++ b/internal/provider/model_meraki_switch_routing_static_route.go @@ -181,11 +181,10 @@ func (data *SwitchRoutingStaticRoute) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchRoutingStaticRoute) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchRoutingStaticRoute) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_settings.go b/internal/provider/model_meraki_switch_settings.go index d3b620cf..5f05bb94 100644 --- a/internal/provider/model_meraki_switch_settings.go +++ b/internal/provider/model_meraki_switch_settings.go @@ -228,11 +228,10 @@ func (data *SwitchSettings) fromBodyUnknowns(ctx context.Context, res meraki.Res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_stack.go b/internal/provider/model_meraki_switch_stack.go index aa291df3..b4f35ead 100644 --- a/internal/provider/model_meraki_switch_stack.go +++ b/internal/provider/model_meraki_switch_stack.go @@ -122,11 +122,10 @@ func (data *SwitchStack) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchStack) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchStack) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_stack_routing_interface.go b/internal/provider/model_meraki_switch_stack_routing_interface.go index 9a53c86c..8691c8b1 100644 --- a/internal/provider/model_meraki_switch_stack_routing_interface.go +++ b/internal/provider/model_meraki_switch_stack_routing_interface.go @@ -322,11 +322,10 @@ func (data *SwitchStackRoutingInterface) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchStackRoutingInterface) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchStackRoutingInterface) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go b/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go index d5c686ee..727d03cc 100644 --- a/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go +++ b/internal/provider/model_meraki_switch_stack_routing_interface_dhcp.go @@ -505,11 +505,10 @@ func (data *SwitchStackRoutingInterfaceDHCP) fromBodyUnknowns(ctx context.Contex // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchStackRoutingInterfaceDHCP) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchStackRoutingInterfaceDHCP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_stack_routing_static_route.go b/internal/provider/model_meraki_switch_stack_routing_static_route.go index cabb3135..8a2e42fc 100644 --- a/internal/provider/model_meraki_switch_stack_routing_static_route.go +++ b/internal/provider/model_meraki_switch_stack_routing_static_route.go @@ -182,11 +182,10 @@ func (data *SwitchStackRoutingStaticRoute) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchStackRoutingStaticRoute) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchStackRoutingStaticRoute) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_storm_control.go b/internal/provider/model_meraki_switch_storm_control.go index 2607ae33..790e3ca3 100644 --- a/internal/provider/model_meraki_switch_storm_control.go +++ b/internal/provider/model_meraki_switch_storm_control.go @@ -142,11 +142,10 @@ func (data *SwitchStormControl) fromBodyUnknowns(ctx context.Context, res meraki // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchStormControl) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchStormControl) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_switch_stp.go b/internal/provider/model_meraki_switch_stp.go index befb5be0..a8923cfc 100644 --- a/internal/provider/model_meraki_switch_stp.go +++ b/internal/provider/model_meraki_switch_stp.go @@ -237,14 +237,13 @@ func (data *SwitchSTP) fromBodyUnknowns(ctx context.Context, res meraki.Res) { // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchSTP) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchSTP) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues func setOrNull(s types.Set) types.Set { if len(s.Elements()) == 0 { diff --git a/internal/provider/model_meraki_switch_warm_spare.go b/internal/provider/model_meraki_switch_warm_spare.go index 3bb3ca41..2d1f85b3 100644 --- a/internal/provider/model_meraki_switch_warm_spare.go +++ b/internal/provider/model_meraki_switch_warm_spare.go @@ -111,11 +111,10 @@ func (data *SwitchWarmSpare) fromBodyUnknowns(ctx context.Context, res meraki.Re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data SwitchWarmSpare) toDestroyBody(ctx context.Context) string { - body := "" +func (data SwitchWarmSpare) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_air_marshal_rule.go b/internal/provider/model_meraki_wireless_air_marshal_rule.go index de64a1e7..e455f21e 100644 --- a/internal/provider/model_meraki_wireless_air_marshal_rule.go +++ b/internal/provider/model_meraki_wireless_air_marshal_rule.go @@ -125,11 +125,10 @@ func (data *WirelessAirMarshalRule) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessAirMarshalRule) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessAirMarshalRule) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_air_marshal_settings.go b/internal/provider/model_meraki_wireless_air_marshal_settings.go index 27c612ca..8db82b2b 100644 --- a/internal/provider/model_meraki_wireless_air_marshal_settings.go +++ b/internal/provider/model_meraki_wireless_air_marshal_settings.go @@ -97,11 +97,10 @@ func (data *WirelessAirMarshalSettings) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessAirMarshalSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessAirMarshalSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_alternate_management_interface.go b/internal/provider/model_meraki_wireless_alternate_management_interface.go index 680e547c..831c0f39 100644 --- a/internal/provider/model_meraki_wireless_alternate_management_interface.go +++ b/internal/provider/model_meraki_wireless_alternate_management_interface.go @@ -273,11 +273,10 @@ func (data *WirelessAlternateManagementInterface) fromBodyUnknowns(ctx context.C // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessAlternateManagementInterface) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessAlternateManagementInterface) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_billing.go b/internal/provider/model_meraki_wireless_billing.go index 26afe684..32333db3 100644 --- a/internal/provider/model_meraki_wireless_billing.go +++ b/internal/provider/model_meraki_wireless_billing.go @@ -189,11 +189,10 @@ func (data *WirelessBilling) fromBodyUnknowns(ctx context.Context, res meraki.Re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessBilling) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessBilling) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_device_bluetooth_settings.go b/internal/provider/model_meraki_wireless_device_bluetooth_settings.go index 51ac7261..93a393fd 100644 --- a/internal/provider/model_meraki_wireless_device_bluetooth_settings.go +++ b/internal/provider/model_meraki_wireless_device_bluetooth_settings.go @@ -125,11 +125,10 @@ func (data *WirelessDeviceBluetoothSettings) fromBodyUnknowns(ctx context.Contex // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessDeviceBluetoothSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessDeviceBluetoothSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_device_electronic_shelf_label.go b/internal/provider/model_meraki_wireless_device_electronic_shelf_label.go index ebbd00db..e3dcbed9 100644 --- a/internal/provider/model_meraki_wireless_device_electronic_shelf_label.go +++ b/internal/provider/model_meraki_wireless_device_electronic_shelf_label.go @@ -111,11 +111,10 @@ func (data *WirelessDeviceElectronicShelfLabel) fromBodyUnknowns(ctx context.Con // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessDeviceElectronicShelfLabel) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessDeviceElectronicShelfLabel) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ethernet_port_profile.go b/internal/provider/model_meraki_wireless_ethernet_port_profile.go index c5553784..9881fe9e 100644 --- a/internal/provider/model_meraki_wireless_ethernet_port_profile.go +++ b/internal/provider/model_meraki_wireless_ethernet_port_profile.go @@ -314,11 +314,10 @@ func (data *WirelessEthernetPortProfile) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessEthernetPortProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessEthernetPortProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ethernet_port_profile_assign.go b/internal/provider/model_meraki_wireless_ethernet_port_profile_assign.go index 36c85035..b19ecf95 100644 --- a/internal/provider/model_meraki_wireless_ethernet_port_profile_assign.go +++ b/internal/provider/model_meraki_wireless_ethernet_port_profile_assign.go @@ -114,11 +114,10 @@ func (data *WirelessEthernetPortProfileAssign) fromBodyUnknowns(ctx context.Cont // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessEthernetPortProfileAssign) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessEthernetPortProfileAssign) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ethernet_port_profile_default.go b/internal/provider/model_meraki_wireless_ethernet_port_profile_default.go index ac2bc929..b9a3face 100644 --- a/internal/provider/model_meraki_wireless_ethernet_port_profile_default.go +++ b/internal/provider/model_meraki_wireless_ethernet_port_profile_default.go @@ -101,11 +101,10 @@ func (data *WirelessEthernetPortProfileDefault) fromBodyUnknowns(ctx context.Con // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessEthernetPortProfileDefault) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessEthernetPortProfileDefault) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_location_scanning.go b/internal/provider/model_meraki_wireless_location_scanning.go index a2bac2c1..c11bec69 100644 --- a/internal/provider/model_meraki_wireless_location_scanning.go +++ b/internal/provider/model_meraki_wireless_location_scanning.go @@ -111,11 +111,10 @@ func (data *WirelessLocationScanning) fromBodyUnknowns(ctx context.Context, res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessLocationScanning) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessLocationScanning) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_location_scanning_receiver.go b/internal/provider/model_meraki_wireless_location_scanning_receiver.go index b716fd29..2d37b992 100644 --- a/internal/provider/model_meraki_wireless_location_scanning_receiver.go +++ b/internal/provider/model_meraki_wireless_location_scanning_receiver.go @@ -143,11 +143,10 @@ func (data *WirelessLocationScanningReceiver) fromBodyUnknowns(ctx context.Conte // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessLocationScanningReceiver) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessLocationScanningReceiver) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_network_bluetooth_settings.go b/internal/provider/model_meraki_wireless_network_bluetooth_settings.go index ebc09555..decede94 100644 --- a/internal/provider/model_meraki_wireless_network_bluetooth_settings.go +++ b/internal/provider/model_meraki_wireless_network_bluetooth_settings.go @@ -167,11 +167,10 @@ func (data *WirelessNetworkBluetoothSettings) fromBodyUnknowns(ctx context.Conte // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessNetworkBluetoothSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessNetworkBluetoothSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_network_electronic_shelf_label.go b/internal/provider/model_meraki_wireless_network_electronic_shelf_label.go index a8b160bb..db553d3b 100644 --- a/internal/provider/model_meraki_wireless_network_electronic_shelf_label.go +++ b/internal/provider/model_meraki_wireless_network_electronic_shelf_label.go @@ -125,11 +125,10 @@ func (data *WirelessNetworkElectronicShelfLabel) fromBodyUnknowns(ctx context.Co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessNetworkElectronicShelfLabel) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessNetworkElectronicShelfLabel) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_radio_settings.go b/internal/provider/model_meraki_wireless_radio_settings.go index df1d58a8..56bf55f2 100644 --- a/internal/provider/model_meraki_wireless_radio_settings.go +++ b/internal/provider/model_meraki_wireless_radio_settings.go @@ -167,11 +167,10 @@ func (data *WirelessRadioSettings) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessRadioSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessRadioSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_rf_profile.go b/internal/provider/model_meraki_wireless_rf_profile.go index 43b0340c..84f9f6f4 100644 --- a/internal/provider/model_meraki_wireless_rf_profile.go +++ b/internal/provider/model_meraki_wireless_rf_profile.go @@ -1436,11 +1436,10 @@ func (data *WirelessRFProfile) fromBodyUnknowns(ctx context.Context, res meraki. // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessRFProfile) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessRFProfile) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_settings.go b/internal/provider/model_meraki_wireless_settings.go index dfd79771..d5935d9d 100644 --- a/internal/provider/model_meraki_wireless_settings.go +++ b/internal/provider/model_meraki_wireless_settings.go @@ -181,11 +181,10 @@ func (data *WirelessSettings) fromBodyUnknowns(ctx context.Context, res meraki.R // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid.go b/internal/provider/model_meraki_wireless_ssid.go index 81695f15..9906dab4 100644 --- a/internal/provider/model_meraki_wireless_ssid.go +++ b/internal/provider/model_meraki_wireless_ssid.go @@ -1737,28 +1737,10 @@ func (data *WirelessSSID) fromBodyUnknowns(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSID) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "adultContentFilteringEnabled", false) - body, _ = sjson.Set(body, "authMode", "open") - body, _ = sjson.Set(body, "availableOnAllAps", true) - body, _ = sjson.Set(body, "enabled", false) - body, _ = sjson.Set(body, "ipAssignmentMode", "NAT mode") - body, _ = sjson.Set(body, "mandatoryDhcpEnabled", false) - body, _ = sjson.Set(body, "name", "Unconfigured SSID") - body, _ = sjson.Set(body, "perClientBandwidthLimitDown", 0) - body, _ = sjson.Set(body, "perClientBandwidthLimitUp", 0) - body, _ = sjson.Set(body, "perSsidBandwidthLimitDown", 0) - body, _ = sjson.Set(body, "perSsidBandwidthLimitUp", 0) - body, _ = sjson.Set(body, "splashPage", "None") - body, _ = sjson.Set(body, "visible", true) - body, _ = sjson.Set(body, "dnsRewrite.enabled", false) - body, _ = sjson.Set(body, "dnsRewrite.dnsCustomNameservers", []interface{}{}) - body, _ = sjson.Set(body, "speedBurst.enabled", false) - body, _ = sjson.Set(body, "availabilityTags", []interface{}{}) +func (data WirelessSSID) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go b/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go index 0533ad0d..a6ec0aa1 100644 --- a/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go +++ b/internal/provider/model_meraki_wireless_ssid_bonjour_forwarding.go @@ -218,11 +218,10 @@ func (data *WirelessSSIDBonjourForwarding) fromBodyUnknowns(ctx context.Context, // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDBonjourForwarding) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDBonjourForwarding) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go b/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go index 8cd55384..fbb0c997 100644 --- a/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go +++ b/internal/provider/model_meraki_wireless_ssid_device_type_group_policies.go @@ -201,11 +201,10 @@ func (data *WirelessSSIDDeviceTypeGroupPolicies) fromBodyUnknowns(ctx context.Co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDDeviceTypeGroupPolicies) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDDeviceTypeGroupPolicies) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_eap_override.go b/internal/provider/model_meraki_wireless_ssid_eap_override.go index 75116b8b..e7e6e06e 100644 --- a/internal/provider/model_meraki_wireless_ssid_eap_override.go +++ b/internal/provider/model_meraki_wireless_ssid_eap_override.go @@ -168,11 +168,11 @@ func (data *WirelessSSIDEAPOverride) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDEAPOverride) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDEAPOverride) addDeleteValues(ctx context.Context, body string) string { + body, _ = sjson.Set(body, "maxRetries", 5) return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_firewall_isolation_allowlist_entry.go b/internal/provider/model_meraki_wireless_ssid_firewall_isolation_allowlist_entry.go index b9c7ca79..ff779595 100644 --- a/internal/provider/model_meraki_wireless_ssid_firewall_isolation_allowlist_entry.go +++ b/internal/provider/model_meraki_wireless_ssid_firewall_isolation_allowlist_entry.go @@ -139,11 +139,10 @@ func (data *WirelessSSIDFirewallIsolationAllowlistEntry) fromBodyUnknowns(ctx co // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDFirewallIsolationAllowlistEntry) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDFirewallIsolationAllowlistEntry) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_hotspot_20.go b/internal/provider/model_meraki_wireless_ssid_hotspot_20.go index 32c218f5..4429f582 100644 --- a/internal/provider/model_meraki_wireless_ssid_hotspot_20.go +++ b/internal/provider/model_meraki_wireless_ssid_hotspot_20.go @@ -498,11 +498,10 @@ func (data *WirelessSSIDHotspot20) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDHotspot20) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDHotspot20) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_identity_psk.go b/internal/provider/model_meraki_wireless_ssid_identity_psk.go index 77f7b5d7..96910b31 100644 --- a/internal/provider/model_meraki_wireless_ssid_identity_psk.go +++ b/internal/provider/model_meraki_wireless_ssid_identity_psk.go @@ -140,11 +140,10 @@ func (data *WirelessSSIDIdentityPSK) fromBodyUnknowns(ctx context.Context, res m // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDIdentityPSK) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDIdentityPSK) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go index c42433f7..254f527b 100644 --- a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go @@ -214,12 +214,10 @@ func (data *WirelessSSIDL3FirewallRules) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDL3FirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data WirelessSSIDL3FirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go index 6156b87f..630cce62 100644 --- a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go @@ -167,12 +167,10 @@ func (data *WirelessSSIDL7FirewallRules) fromBodyUnknowns(ctx context.Context, r // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDL7FirewallRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data WirelessSSIDL7FirewallRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_schedules.go b/internal/provider/model_meraki_wireless_ssid_schedules.go index 2299329e..c750495a 100644 --- a/internal/provider/model_meraki_wireless_ssid_schedules.go +++ b/internal/provider/model_meraki_wireless_ssid_schedules.go @@ -302,11 +302,10 @@ func (data *WirelessSSIDSchedules) fromBodyUnknowns(ctx context.Context, res mer // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDSchedules) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDSchedules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_splash_settings.go b/internal/provider/model_meraki_wireless_ssid_splash_settings.go index 0f2d7054..a28656da 100644 --- a/internal/provider/model_meraki_wireless_ssid_splash_settings.go +++ b/internal/provider/model_meraki_wireless_ssid_splash_settings.go @@ -549,11 +549,10 @@ func (data *WirelessSSIDSplashSettings) fromBodyUnknowns(ctx context.Context, re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDSplashSettings) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDSplashSettings) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go index c279627e..5f4e7ca8 100644 --- a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go @@ -315,12 +315,10 @@ func (data *WirelessSSIDTrafficShapingRules) fromBodyUnknowns(ctx context.Contex // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDTrafficShapingRules) toDestroyBody(ctx context.Context) string { - body := "" - body, _ = sjson.Set(body, "rules", []interface{}{}) +func (data WirelessSSIDTrafficShapingRules) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_ssid_vpn.go b/internal/provider/model_meraki_wireless_ssid_vpn.go index 8c031018..14071188 100644 --- a/internal/provider/model_meraki_wireless_ssid_vpn.go +++ b/internal/provider/model_meraki_wireless_ssid_vpn.go @@ -274,11 +274,10 @@ func (data *WirelessSSIDVPN) fromBodyUnknowns(ctx context.Context, res meraki.Re // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessSSIDVPN) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessSSIDVPN) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_zigbee.go b/internal/provider/model_meraki_wireless_zigbee.go index 688986e6..affac0b4 100644 --- a/internal/provider/model_meraki_wireless_zigbee.go +++ b/internal/provider/model_meraki_wireless_zigbee.go @@ -181,11 +181,10 @@ func (data *WirelessZigbee) fromBodyUnknowns(ctx context.Context, res meraki.Res // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessZigbee) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessZigbee) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_zigbee_device.go b/internal/provider/model_meraki_wireless_zigbee_device.go index 8c96dd31..d13a4936 100644 --- a/internal/provider/model_meraki_wireless_zigbee_device.go +++ b/internal/provider/model_meraki_wireless_zigbee_device.go @@ -112,11 +112,10 @@ func (data *WirelessZigbeeDevice) fromBodyUnknowns(ctx context.Context, res mera // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessZigbeeDevice) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessZigbeeDevice) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_meraki_wireless_zigbee_door_lock.go b/internal/provider/model_meraki_wireless_zigbee_door_lock.go index 2aafaaaa..cf132d79 100644 --- a/internal/provider/model_meraki_wireless_zigbee_door_lock.go +++ b/internal/provider/model_meraki_wireless_zigbee_door_lock.go @@ -98,11 +98,10 @@ func (data *WirelessZigbeeDoorLock) fromBodyUnknowns(ctx context.Context, res me // End of section. //template:end fromBodyUnknowns -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data WirelessZigbeeDoorLock) toDestroyBody(ctx context.Context) string { - body := "" +func (data WirelessZigbeeDoorLock) addDeleteValues(ctx context.Context, body string) string { return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues diff --git a/internal/provider/model_resource_meraki_appliance_ports.go b/internal/provider/model_resource_meraki_appliance_ports.go index 83d387cc..d8c120c6 100644 --- a/internal/provider/model_resource_meraki_appliance_ports.go +++ b/internal/provider/model_resource_meraki_appliance_ports.go @@ -300,14 +300,14 @@ func (data *ResourceAppliancePorts) fromBodyImport(ctx context.Context, res mera // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceAppliancePorts) toDestroyBody(ctx context.Context) string { +func (data ResourceAppliancePorts) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_appliance_prefix_delegated_statics.go b/internal/provider/model_resource_meraki_appliance_prefix_delegated_statics.go index 52a76d5f..51a2d35e 100644 --- a/internal/provider/model_resource_meraki_appliance_prefix_delegated_statics.go +++ b/internal/provider/model_resource_meraki_appliance_prefix_delegated_statics.go @@ -257,14 +257,14 @@ func (data *ResourceAppliancePrefixDelegatedStatics) fromBodyImport(ctx context. // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceAppliancePrefixDelegatedStatics) toDestroyBody(ctx context.Context) string { +func (data ResourceAppliancePrefixDelegatedStatics) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_appliance_rf_profiles.go b/internal/provider/model_resource_meraki_appliance_rf_profiles.go index 93a209d3..11911b5c 100644 --- a/internal/provider/model_resource_meraki_appliance_rf_profiles.go +++ b/internal/provider/model_resource_meraki_appliance_rf_profiles.go @@ -425,14 +425,14 @@ func (data *ResourceApplianceRFProfiles) fromBodyImport(ctx context.Context, res // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceApplianceRFProfiles) toDestroyBody(ctx context.Context) string { +func (data ResourceApplianceRFProfiles) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_appliance_ssids.go b/internal/provider/model_resource_meraki_appliance_ssids.go index 977e755e..1d70ef80 100644 --- a/internal/provider/model_resource_meraki_appliance_ssids.go +++ b/internal/provider/model_resource_meraki_appliance_ssids.go @@ -480,14 +480,14 @@ func (data *ResourceApplianceSSIDs) fromBodyImport(ctx context.Context, res mera // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceApplianceSSIDs) toDestroyBody(ctx context.Context) string { +func (data ResourceApplianceSSIDs) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_appliance_traffic_shaping_custom_performance_classes.go b/internal/provider/model_resource_meraki_appliance_traffic_shaping_custom_performance_classes.go index caabbd07..38abc820 100644 --- a/internal/provider/model_resource_meraki_appliance_traffic_shaping_custom_performance_classes.go +++ b/internal/provider/model_resource_meraki_appliance_traffic_shaping_custom_performance_classes.go @@ -254,14 +254,14 @@ func (data *ResourceApplianceTrafficShapingCustomPerformanceClasses) fromBodyImp // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceApplianceTrafficShapingCustomPerformanceClasses) toDestroyBody(ctx context.Context) string { +func (data ResourceApplianceTrafficShapingCustomPerformanceClasses) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_appliance_vlans.go b/internal/provider/model_resource_meraki_appliance_vlans.go index 48d7ad13..b9938b9c 100644 --- a/internal/provider/model_resource_meraki_appliance_vlans.go +++ b/internal/provider/model_resource_meraki_appliance_vlans.go @@ -986,14 +986,14 @@ func (data *ResourceApplianceVLANs) fromBodyImport(ctx context.Context, res mera // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceApplianceVLANs) toDestroyBody(ctx context.Context) string { +func (data ResourceApplianceVLANs) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_devices.go b/internal/provider/model_resource_meraki_devices.go index bedc24c0..9a965610 100644 --- a/internal/provider/model_resource_meraki_devices.go +++ b/internal/provider/model_resource_meraki_devices.go @@ -299,14 +299,14 @@ func (data *ResourceDevices) fromBodyImport(ctx context.Context, res meraki.Res) // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceDevices) toDestroyBody(ctx context.Context) string { +func (data ResourceDevices) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_network_group_policies.go b/internal/provider/model_resource_meraki_network_group_policies.go index b3a7f766..16141a1a 100644 --- a/internal/provider/model_resource_meraki_network_group_policies.go +++ b/internal/provider/model_resource_meraki_network_group_policies.go @@ -1500,14 +1500,14 @@ func (data *ResourceNetworkGroupPolicies) fromBodyImport(ctx context.Context, re // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceNetworkGroupPolicies) toDestroyBody(ctx context.Context) string { +func (data ResourceNetworkGroupPolicies) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_network_meraki_auth_users.go b/internal/provider/model_resource_meraki_network_meraki_auth_users.go index 447b9834..6474b2a4 100644 --- a/internal/provider/model_resource_meraki_network_meraki_auth_users.go +++ b/internal/provider/model_resource_meraki_network_meraki_auth_users.go @@ -368,14 +368,14 @@ func (data *ResourceNetworkMerakiAuthUsers) fromBodyImport(ctx context.Context, // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceNetworkMerakiAuthUsers) toDestroyBody(ctx context.Context) string { +func (data ResourceNetworkMerakiAuthUsers) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_network_webhook_payload_templates.go b/internal/provider/model_resource_meraki_network_webhook_payload_templates.go index 475dc137..c69c4d12 100644 --- a/internal/provider/model_resource_meraki_network_webhook_payload_templates.go +++ b/internal/provider/model_resource_meraki_network_webhook_payload_templates.go @@ -359,14 +359,14 @@ func (data *ResourceNetworkWebhookPayloadTemplates) fromBodyImport(ctx context.C // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceNetworkWebhookPayloadTemplates) toDestroyBody(ctx context.Context) string { +func (data ResourceNetworkWebhookPayloadTemplates) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_adaptive_policies.go b/internal/provider/model_resource_meraki_organization_adaptive_policies.go index 5bf08f54..5cc189e7 100644 --- a/internal/provider/model_resource_meraki_organization_adaptive_policies.go +++ b/internal/provider/model_resource_meraki_organization_adaptive_policies.go @@ -391,14 +391,14 @@ func (data *ResourceOrganizationAdaptivePolicies) fromBodyImport(ctx context.Con // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationAdaptivePolicies) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationAdaptivePolicies) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_adaptive_policy_groups.go b/internal/provider/model_resource_meraki_organization_adaptive_policy_groups.go index 80b587e3..e93db45e 100644 --- a/internal/provider/model_resource_meraki_organization_adaptive_policy_groups.go +++ b/internal/provider/model_resource_meraki_organization_adaptive_policy_groups.go @@ -339,14 +339,14 @@ func (data *ResourceOrganizationAdaptivePolicyGroups) fromBodyImport(ctx context // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationAdaptivePolicyGroups) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationAdaptivePolicyGroups) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_licenses.go b/internal/provider/model_resource_meraki_organization_licenses.go index ca477f00..1e5287eb 100644 --- a/internal/provider/model_resource_meraki_organization_licenses.go +++ b/internal/provider/model_resource_meraki_organization_licenses.go @@ -204,14 +204,14 @@ func (data *ResourceOrganizationLicenses) fromBodyImport(ctx context.Context, re // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationLicenses) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationLicenses) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_policy_object_groups.go b/internal/provider/model_resource_meraki_organization_policy_object_groups.go index a9fa3c1e..593e1f5f 100644 --- a/internal/provider/model_resource_meraki_organization_policy_object_groups.go +++ b/internal/provider/model_resource_meraki_organization_policy_object_groups.go @@ -237,14 +237,14 @@ func (data *ResourceOrganizationPolicyObjectGroups) fromBodyImport(ctx context.C // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationPolicyObjectGroups) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationPolicyObjectGroups) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_policy_objects.go b/internal/provider/model_resource_meraki_organization_policy_objects.go index 8ea5a584..19270d5d 100644 --- a/internal/provider/model_resource_meraki_organization_policy_objects.go +++ b/internal/provider/model_resource_meraki_organization_policy_objects.go @@ -332,14 +332,14 @@ func (data *ResourceOrganizationPolicyObjects) fromBodyImport(ctx context.Contex // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationPolicyObjects) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationPolicyObjects) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_organization_saml_idps.go b/internal/provider/model_resource_meraki_organization_saml_idps.go index f3351a44..f0215394 100644 --- a/internal/provider/model_resource_meraki_organization_saml_idps.go +++ b/internal/provider/model_resource_meraki_organization_saml_idps.go @@ -215,14 +215,14 @@ func (data *ResourceOrganizationSAMLIdPs) fromBodyImport(ctx context.Context, re // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceOrganizationSAMLIdPs) toDestroyBody(ctx context.Context) string { +func (data ResourceOrganizationSAMLIdPs) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_sensor_alerts_profiles.go b/internal/provider/model_resource_meraki_sensor_alerts_profiles.go index 4b004f35..b69176d1 100644 --- a/internal/provider/model_resource_meraki_sensor_alerts_profiles.go +++ b/internal/provider/model_resource_meraki_sensor_alerts_profiles.go @@ -919,14 +919,14 @@ func (data *ResourceSensorAlertsProfiles) fromBodyImport(ctx context.Context, re // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSensorAlertsProfiles) toDestroyBody(ctx context.Context) string { +func (data ResourceSensorAlertsProfiles) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_sensor_mqtt_brokers.go b/internal/provider/model_resource_meraki_sensor_mqtt_brokers.go index 2de99b6a..fb29bffd 100644 --- a/internal/provider/model_resource_meraki_sensor_mqtt_brokers.go +++ b/internal/provider/model_resource_meraki_sensor_mqtt_brokers.go @@ -205,15 +205,15 @@ func (data *ResourceSensorMQTTBrokers) fromBodyImport(ctx context.Context, res m // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSensorMQTTBrokers) toDestroyBody(ctx context.Context) string { +func (data ResourceSensorMQTTBrokers) addDeleteValues(ctx context.Context) string { body := "" body, _ = sjson.Set(body, "enabled", false) return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_sm_admin_roles.go b/internal/provider/model_resource_meraki_sm_admin_roles.go index e32d9394..8d608de8 100644 --- a/internal/provider/model_resource_meraki_sm_admin_roles.go +++ b/internal/provider/model_resource_meraki_sm_admin_roles.go @@ -237,14 +237,14 @@ func (data *ResourceSMAdminRoles) fromBodyImport(ctx context.Context, res meraki // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSMAdminRoles) toDestroyBody(ctx context.Context) string { +func (data ResourceSMAdminRoles) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_access_policies.go b/internal/provider/model_resource_meraki_switch_access_policies.go index 0eaa7f73..ff28258e 100644 --- a/internal/provider/model_resource_meraki_switch_access_policies.go +++ b/internal/provider/model_resource_meraki_switch_access_policies.go @@ -948,14 +948,14 @@ func (data *ResourceSwitchAccessPolicies) fromBodyImport(ctx context.Context, re // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchAccessPolicies) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchAccessPolicies) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_link_aggregations.go b/internal/provider/model_resource_meraki_switch_link_aggregations.go index 82cb22ae..fa8c61a4 100644 --- a/internal/provider/model_resource_meraki_switch_link_aggregations.go +++ b/internal/provider/model_resource_meraki_switch_link_aggregations.go @@ -388,14 +388,14 @@ func (data *ResourceSwitchLinkAggregations) fromBodyImport(ctx context.Context, // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchLinkAggregations) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchLinkAggregations) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_ports.go b/internal/provider/model_resource_meraki_switch_ports.go index 754b4762..3020d6c8 100644 --- a/internal/provider/model_resource_meraki_switch_ports.go +++ b/internal/provider/model_resource_meraki_switch_ports.go @@ -744,7 +744,7 @@ func (data *ResourceSwitchPorts) fromBodyImport(ctx context.Context, res meraki. // End of section. //template:end fromBodyImport -func (data ResourceSwitchPortsItems) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchPortsItems) addDeleteValues(ctx context.Context) string { body := "" body, _ = sjson.Set(body, "accessPolicyType", "Open") if !data.AdaptivePolicyGroupId.IsNull() { diff --git a/internal/provider/model_resource_meraki_switch_routing_interfaces.go b/internal/provider/model_resource_meraki_switch_routing_interfaces.go index 110f3325..703b17eb 100644 --- a/internal/provider/model_resource_meraki_switch_routing_interfaces.go +++ b/internal/provider/model_resource_meraki_switch_routing_interfaces.go @@ -501,14 +501,14 @@ func (data *ResourceSwitchRoutingInterfaces) fromBodyImport(ctx context.Context, // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchRoutingInterfaces) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchRoutingInterfaces) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_routing_multicast_rendezvous_points.go b/internal/provider/model_resource_meraki_switch_routing_multicast_rendezvous_points.go index 4d620db8..6ad61f19 100644 --- a/internal/provider/model_resource_meraki_switch_routing_multicast_rendezvous_points.go +++ b/internal/provider/model_resource_meraki_switch_routing_multicast_rendezvous_points.go @@ -235,14 +235,14 @@ func (data *ResourceSwitchRoutingMulticastRendezvousPoints) fromBodyImport(ctx c // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchRoutingMulticastRendezvousPoints) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchRoutingMulticastRendezvousPoints) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_routing_static_routes.go b/internal/provider/model_resource_meraki_switch_routing_static_routes.go index 76a8f1e9..37a87958 100644 --- a/internal/provider/model_resource_meraki_switch_routing_static_routes.go +++ b/internal/provider/model_resource_meraki_switch_routing_static_routes.go @@ -311,14 +311,14 @@ func (data *ResourceSwitchRoutingStaticRoutes) fromBodyImport(ctx context.Contex // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchRoutingStaticRoutes) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchRoutingStaticRoutes) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_stack_routing_interfaces.go b/internal/provider/model_resource_meraki_switch_stack_routing_interfaces.go index 582173c9..0d992cbd 100644 --- a/internal/provider/model_resource_meraki_switch_stack_routing_interfaces.go +++ b/internal/provider/model_resource_meraki_switch_stack_routing_interfaces.go @@ -502,14 +502,14 @@ func (data *ResourceSwitchStackRoutingInterfaces) fromBodyImport(ctx context.Con // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchStackRoutingInterfaces) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchStackRoutingInterfaces) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_switch_stack_routing_static_routes.go b/internal/provider/model_resource_meraki_switch_stack_routing_static_routes.go index 209f4f74..7f7a823b 100644 --- a/internal/provider/model_resource_meraki_switch_stack_routing_static_routes.go +++ b/internal/provider/model_resource_meraki_switch_stack_routing_static_routes.go @@ -312,14 +312,14 @@ func (data *ResourceSwitchStackRoutingStaticRoutes) fromBodyImport(ctx context.C // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceSwitchStackRoutingStaticRoutes) toDestroyBody(ctx context.Context) string { +func (data ResourceSwitchStackRoutingStaticRoutes) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_wireless_rf_profiles.go b/internal/provider/model_resource_meraki_wireless_rf_profiles.go index aa16b182..ec21477d 100644 --- a/internal/provider/model_resource_meraki_wireless_rf_profiles.go +++ b/internal/provider/model_resource_meraki_wireless_rf_profiles.go @@ -1996,14 +1996,14 @@ func (data *ResourceWirelessRFProfiles) fromBodyImport(ctx context.Context, res // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceWirelessRFProfiles) toDestroyBody(ctx context.Context) string { +func (data ResourceWirelessRFProfiles) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_wireless_ssid_identity_psks.go b/internal/provider/model_resource_meraki_wireless_ssid_identity_psks.go index 5044c01f..b932690b 100644 --- a/internal/provider/model_resource_meraki_wireless_ssid_identity_psks.go +++ b/internal/provider/model_resource_meraki_wireless_ssid_identity_psks.go @@ -255,14 +255,14 @@ func (data *ResourceWirelessSSIDIdentityPSKs) fromBodyImport(ctx context.Context // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceWirelessSSIDIdentityPSKs) toDestroyBody(ctx context.Context) string { +func (data ResourceWirelessSSIDIdentityPSKs) addDeleteValues(ctx context.Context) string { body := "" return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/model_resource_meraki_wireless_ssids.go b/internal/provider/model_resource_meraki_wireless_ssids.go index 7da5118b..b7279380 100644 --- a/internal/provider/model_resource_meraki_wireless_ssids.go +++ b/internal/provider/model_resource_meraki_wireless_ssids.go @@ -2370,31 +2370,14 @@ func (data *ResourceWirelessSSIDs) fromBodyImport(ctx context.Context, res merak // End of section. //template:end fromBodyImport -// Section below is generated&owned by "gen/generator.go". //template:begin toDestroyBody +// Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues -func (data ResourceWirelessSSIDs) toDestroyBody(ctx context.Context) string { +func (data ResourceWirelessSSIDs) addDeleteValues(ctx context.Context) string { body := "" - body, _ = sjson.Set(body, "adultContentFilteringEnabled", false) - body, _ = sjson.Set(body, "authMode", "open") - body, _ = sjson.Set(body, "availableOnAllAps", true) - body, _ = sjson.Set(body, "enabled", false) - body, _ = sjson.Set(body, "ipAssignmentMode", "NAT mode") - body, _ = sjson.Set(body, "mandatoryDhcpEnabled", false) - body, _ = sjson.Set(body, "name", "Unconfigured SSID") - body, _ = sjson.Set(body, "perClientBandwidthLimitDown", 0) - body, _ = sjson.Set(body, "perClientBandwidthLimitUp", 0) - body, _ = sjson.Set(body, "perSsidBandwidthLimitDown", 0) - body, _ = sjson.Set(body, "perSsidBandwidthLimitUp", 0) - body, _ = sjson.Set(body, "splashPage", "None") - body, _ = sjson.Set(body, "visible", true) - body, _ = sjson.Set(body, "dnsRewrite.enabled", false) - body, _ = sjson.Set(body, "dnsRewrite.dnsCustomNameservers", []interface{}{}) - body, _ = sjson.Set(body, "speedBurst.enabled", false) - body, _ = sjson.Set(body, "availabilityTags", []interface{}{}) return body } -// End of section. //template:end toDestroyBody +// End of section. //template:end addDeleteValues // Section below is generated&owned by "gen/generator.go". //template:begin hasChanges diff --git a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go index f5319213..4046e6e9 100644 --- a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go @@ -269,6 +269,7 @@ func (r *ApplianceCellularFirewallRulesResource) Delete(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go index 0c3be6c0..a1277347 100644 --- a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go @@ -241,6 +241,7 @@ func (r *ApplianceConnectivityMonitoringDestinationsResource) Delete(ctx context tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_content_filtering.go b/internal/provider/resource_meraki_appliance_content_filtering.go index bf21af03..37c17022 100644 --- a/internal/provider/resource_meraki_appliance_content_filtering.go +++ b/internal/provider/resource_meraki_appliance_content_filtering.go @@ -246,6 +246,7 @@ func (r *ApplianceContentFilteringResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go index be02d834..68c4eb59 100644 --- a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go +++ b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go @@ -258,6 +258,7 @@ func (r *ApplianceFirewallMulticastForwardingResource) Delete(ctx context.Contex tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_firewall_settings.go b/internal/provider/resource_meraki_appliance_firewall_settings.go index 2b3b65cb..b4b156d4 100644 --- a/internal/provider/resource_meraki_appliance_firewall_settings.go +++ b/internal/provider/resource_meraki_appliance_firewall_settings.go @@ -230,6 +230,7 @@ func (r *ApplianceFirewallSettingsResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_firewalled_service.go b/internal/provider/resource_meraki_appliance_firewalled_service.go index 7eb11854..6d838594 100644 --- a/internal/provider/resource_meraki_appliance_firewalled_service.go +++ b/internal/provider/resource_meraki_appliance_firewalled_service.go @@ -246,6 +246,7 @@ func (r *ApplianceFirewalledServiceResource) Delete(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go index 0bc5d08a..3d091636 100644 --- a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go @@ -269,6 +269,7 @@ func (r *ApplianceInboundCellularFirewallRulesResource) Delete(ctx context.Conte tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go index df8c59d8..097192b7 100644 --- a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go @@ -273,6 +273,7 @@ func (r *ApplianceInboundFirewallRulesResource) Delete(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go index ff50b3b6..3d3e7d17 100644 --- a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go @@ -273,6 +273,7 @@ func (r *ApplianceL3FirewallRulesResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go index ca5e3ec8..d9b0f5d0 100644 --- a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go @@ -255,6 +255,7 @@ func (r *ApplianceL7FirewallRulesResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_network_security_intrusion.go b/internal/provider/resource_meraki_appliance_network_security_intrusion.go index 6838ae7c..cd2c8f2e 100644 --- a/internal/provider/resource_meraki_appliance_network_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_network_security_intrusion.go @@ -252,6 +252,7 @@ func (r *ApplianceNetworkSecurityIntrusionResource) Delete(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go index b6cc0853..bfb3724c 100644 --- a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go @@ -279,6 +279,7 @@ func (r *ApplianceOneToManyNATRulesResource) Delete(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go index 79bd8e9d..fb48ce1e 100644 --- a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go @@ -276,6 +276,7 @@ func (r *ApplianceOneToOneNATRulesResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go index 6146c068..c2769c16 100644 --- a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go @@ -237,6 +237,7 @@ func (r *ApplianceOrganizationSecurityIntrusionResource) Delete(ctx context.Cont tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_port.go b/internal/provider/resource_meraki_appliance_port.go index 5e777354..a069145b 100644 --- a/internal/provider/resource_meraki_appliance_port.go +++ b/internal/provider/resource_meraki_appliance_port.go @@ -252,6 +252,7 @@ func (r *AppliancePortResource) Delete(ctx context.Context, req resource.DeleteR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go index 2fab84d5..4ca5772b 100644 --- a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go @@ -267,6 +267,7 @@ func (r *AppliancePortForwardingRulesResource) Delete(ctx context.Context, req r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_radio_settings.go b/internal/provider/resource_meraki_appliance_radio_settings.go index 86890aed..827d0c20 100644 --- a/internal/provider/resource_meraki_appliance_radio_settings.go +++ b/internal/provider/resource_meraki_appliance_radio_settings.go @@ -245,6 +245,7 @@ func (r *ApplianceRadioSettingsResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go index 0b27e2e7..17b7d2f6 100644 --- a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go @@ -306,6 +306,7 @@ func (r *ApplianceSDWANInternetPoliciesResource) Delete(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_security_malware.go b/internal/provider/resource_meraki_appliance_security_malware.go index f71664bf..b566202f 100644 --- a/internal/provider/resource_meraki_appliance_security_malware.go +++ b/internal/provider/resource_meraki_appliance_security_malware.go @@ -262,6 +262,7 @@ func (r *ApplianceSecurityMalwareResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_settings.go b/internal/provider/resource_meraki_appliance_settings.go index 67566d4c..3a71ff04 100644 --- a/internal/provider/resource_meraki_appliance_settings.go +++ b/internal/provider/resource_meraki_appliance_settings.go @@ -245,6 +245,7 @@ func (r *ApplianceSettingsResource) Delete(ctx context.Context, req resource.Del tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_single_lan.go b/internal/provider/resource_meraki_appliance_single_lan.go index d48dadcb..bd4bce53 100644 --- a/internal/provider/resource_meraki_appliance_single_lan.go +++ b/internal/provider/resource_meraki_appliance_single_lan.go @@ -272,6 +272,7 @@ func (r *ApplianceSingleLANResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go index 664e97a9..d5536107 100644 --- a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go +++ b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go @@ -274,6 +274,7 @@ func (r *ApplianceSiteToSiteVPNResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_ssid.go b/internal/provider/resource_meraki_appliance_ssid.go index 44b258fe..3e9c93dc 100644 --- a/internal/provider/resource_meraki_appliance_ssid.go +++ b/internal/provider/resource_meraki_appliance_ssid.go @@ -303,6 +303,7 @@ func (r *ApplianceSSIDResource) Delete(ctx context.Context, req resource.DeleteR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go index 98c2fabf..130e26b8 100644 --- a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go +++ b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go @@ -390,6 +390,7 @@ func (r *ApplianceThirdPartyVPNPeersResource) Delete(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping.go b/internal/provider/resource_meraki_appliance_traffic_shaping.go index 25f733e9..32047016 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping.go @@ -229,6 +229,7 @@ func (r *ApplianceTrafficShapingResource) Delete(ctx context.Context, req resour tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go index 8dfaa276..72e040b6 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go @@ -274,6 +274,7 @@ func (r *ApplianceTrafficShapingRulesResource) Delete(ctx context.Context, req r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go index ba015b70..dbd8a81c 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go @@ -245,6 +245,7 @@ func (r *ApplianceTrafficShapingUplinkBandwidthResource) Delete(ctx context.Cont tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go index 378a0745..582d3b26 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go @@ -401,7 +401,7 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Delete(ctx context.Cont tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - body := state.toDestroyBody(ctx) + body := state.addDeleteValues(ctx, "") res, err := r.client.Put(state.getPath(), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) @@ -416,7 +416,7 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Delete(ctx context.Cont sdwanInternetPolicies := ApplianceSDWANInternetPolicies{ NetworkId: state.NetworkId, } - body = sdwanInternetPolicies.toDestroyBody(ctx) + body = sdwanInternetPolicies.addDeleteValues(ctx, "") res, err = r.client.Put(sdwanInternetPolicies.getPath(), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to clear Appliance Traffic Shaping Uplink Preferences wan_traffic_uplink_preferences via Appliance SDWAN Internet Policies endpoint (PUT), got error: %s, %s", err, res.String())) diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go index 1998d9a2..66a2e11a 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -280,6 +280,7 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Delete(ctx context.Contex tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_uplinks_settings.go b/internal/provider/resource_meraki_appliance_uplinks_settings.go index d6c74fde..9d558228 100644 --- a/internal/provider/resource_meraki_appliance_uplinks_settings.go +++ b/internal/provider/resource_meraki_appliance_uplinks_settings.go @@ -360,6 +360,7 @@ func (r *ApplianceUplinksSettingsResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_vlan_dhcp.go b/internal/provider/resource_meraki_appliance_vlan_dhcp.go index bc97f245..2a3520e6 100644 --- a/internal/provider/resource_meraki_appliance_vlan_dhcp.go +++ b/internal/provider/resource_meraki_appliance_vlan_dhcp.go @@ -292,6 +292,7 @@ func (r *ApplianceVLANDHCPResource) Delete(ctx context.Context, req resource.Del tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_vlans_settings.go b/internal/provider/resource_meraki_appliance_vlans_settings.go index 47caa762..85930f0a 100644 --- a/internal/provider/resource_meraki_appliance_vlans_settings.go +++ b/internal/provider/resource_meraki_appliance_vlans_settings.go @@ -225,6 +225,7 @@ func (r *ApplianceVLANsSettingsResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_vpn_bgp.go b/internal/provider/resource_meraki_appliance_vpn_bgp.go index 5d27eb40..a67e18a3 100644 --- a/internal/provider/resource_meraki_appliance_vpn_bgp.go +++ b/internal/provider/resource_meraki_appliance_vpn_bgp.go @@ -299,6 +299,7 @@ func (r *ApplianceVPNBGPResource) Delete(ctx context.Context, req resource.Delet tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go index 906c57bf..e717877b 100644 --- a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go @@ -273,6 +273,7 @@ func (r *ApplianceVPNFirewallRulesResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go index 40fb3ed0..d3d5fe15 100644 --- a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go +++ b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go @@ -237,6 +237,7 @@ func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Delete(ctx context.Contex tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_appliance_warm_spare.go b/internal/provider/resource_meraki_appliance_warm_spare.go index 422c65d0..dcc2a3a6 100644 --- a/internal/provider/resource_meraki_appliance_warm_spare.go +++ b/internal/provider/resource_meraki_appliance_warm_spare.go @@ -241,6 +241,7 @@ func (r *ApplianceWarmSpareResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_camera_custom_analytics.go b/internal/provider/resource_meraki_camera_custom_analytics.go index 11d5278d..52d13144 100644 --- a/internal/provider/resource_meraki_camera_custom_analytics.go +++ b/internal/provider/resource_meraki_camera_custom_analytics.go @@ -245,6 +245,7 @@ func (r *CameraCustomAnalyticsResource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_camera_device_wireless_profiles.go b/internal/provider/resource_meraki_camera_device_wireless_profiles.go index e7b8872b..ecb376fa 100644 --- a/internal/provider/resource_meraki_camera_device_wireless_profiles.go +++ b/internal/provider/resource_meraki_camera_device_wireless_profiles.go @@ -219,8 +219,6 @@ func (r *CameraDeviceWirelessProfilesResource) Update(ctx context.Context, req r // End of section. //template:end update -// Section below is generated&owned by "gen/generator.go". //template:begin delete - func (r *CameraDeviceWirelessProfilesResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state CameraDeviceWirelessProfiles @@ -231,25 +229,12 @@ func (r *CameraDeviceWirelessProfilesResource) Delete(ctx context.Context, req r } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - // If the resource is a singleton, we need to restore the initial state - jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) - if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { - return - } - - res, err := r.client.Put(state.getPath(), jsonInitialState) - if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) - return - } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) resp.State.RemoveResource(ctx) } -// End of section. //template:end delete - // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CameraDeviceWirelessProfilesResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { idParts := strings.Split(req.ID, ",") diff --git a/internal/provider/resource_meraki_camera_quality_retention.go b/internal/provider/resource_meraki_camera_quality_retention.go index ab7e23f0..0e05ea94 100644 --- a/internal/provider/resource_meraki_camera_quality_retention.go +++ b/internal/provider/resource_meraki_camera_quality_retention.go @@ -257,6 +257,7 @@ func (r *CameraQualityRetentionResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_camera_sense.go b/internal/provider/resource_meraki_camera_sense.go index 23231589..4322d94b 100644 --- a/internal/provider/resource_meraki_camera_sense.go +++ b/internal/provider/resource_meraki_camera_sense.go @@ -237,6 +237,7 @@ func (r *CameraSenseResource) Delete(ctx context.Context, req resource.DeleteReq tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_camera_video_settings.go b/internal/provider/resource_meraki_camera_video_settings.go index 323a0eef..474e6d8b 100644 --- a/internal/provider/resource_meraki_camera_video_settings.go +++ b/internal/provider/resource_meraki_camera_video_settings.go @@ -225,6 +225,7 @@ func (r *CameraVideoSettingsResource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go index 1fbb2505..93a5f4f6 100644 --- a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go @@ -241,6 +241,7 @@ func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Delete(ctx c tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_dhcp.go b/internal/provider/resource_meraki_cellular_gateway_dhcp.go index 3c2607e2..03182e12 100644 --- a/internal/provider/resource_meraki_cellular_gateway_dhcp.go +++ b/internal/provider/resource_meraki_cellular_gateway_dhcp.go @@ -235,6 +235,7 @@ func (r *CellularGatewayDHCPResource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_lan.go b/internal/provider/resource_meraki_cellular_gateway_lan.go index 2d2b9d2b..74d2398d 100644 --- a/internal/provider/resource_meraki_cellular_gateway_lan.go +++ b/internal/provider/resource_meraki_cellular_gateway_lan.go @@ -261,6 +261,7 @@ func (r *CellularGatewayLANResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go index 9c15cc21..af8a2cbd 100644 --- a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go @@ -259,6 +259,7 @@ func (r *CellularGatewayPortForwardingRulesResource) Delete(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go index f82a8c09..1d3e1059 100644 --- a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go +++ b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go @@ -229,6 +229,7 @@ func (r *CellularGatewaySubnetPoolResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_cellular_gateway_uplink.go b/internal/provider/resource_meraki_cellular_gateway_uplink.go index 2c448bdd..4bd1bf86 100644 --- a/internal/provider/resource_meraki_cellular_gateway_uplink.go +++ b/internal/provider/resource_meraki_cellular_gateway_uplink.go @@ -229,6 +229,7 @@ func (r *CellularGatewayUplinkResource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_device.go b/internal/provider/resource_meraki_device.go index a4c2e000..62f52feb 100644 --- a/internal/provider/resource_meraki_device.go +++ b/internal/provider/resource_meraki_device.go @@ -259,6 +259,7 @@ func (r *DeviceResource) Delete(ctx context.Context, req resource.DeleteRequest, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_device_cellular_sims.go b/internal/provider/resource_meraki_device_cellular_sims.go index ae21600a..1f116801 100644 --- a/internal/provider/resource_meraki_device_cellular_sims.go +++ b/internal/provider/resource_meraki_device_cellular_sims.go @@ -289,6 +289,7 @@ func (r *DeviceCellularSIMsResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_device_management_interface.go b/internal/provider/resource_meraki_device_management_interface.go index 1017d03a..13497b0d 100644 --- a/internal/provider/resource_meraki_device_management_interface.go +++ b/internal/provider/resource_meraki_device_management_interface.go @@ -288,6 +288,7 @@ func (r *DeviceManagementInterfaceResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_alerts_settings.go b/internal/provider/resource_meraki_network_alerts_settings.go index 66903ac0..c9825260 100644 --- a/internal/provider/resource_meraki_network_alerts_settings.go +++ b/internal/provider/resource_meraki_network_alerts_settings.go @@ -369,6 +369,7 @@ func (r *NetworkAlertsSettingsResource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_client_policy.go b/internal/provider/resource_meraki_network_client_policy.go index 963db255..0e264994 100644 --- a/internal/provider/resource_meraki_network_client_policy.go +++ b/internal/provider/resource_meraki_network_client_policy.go @@ -236,6 +236,7 @@ func (r *NetworkClientPolicyResource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_client_splash_authorization_status.go b/internal/provider/resource_meraki_network_client_splash_authorization_status.go index 84ee55e6..7adfadbf 100644 --- a/internal/provider/resource_meraki_network_client_splash_authorization_status.go +++ b/internal/provider/resource_meraki_network_client_splash_authorization_status.go @@ -288,6 +288,7 @@ func (r *NetworkClientSplashAuthorizationStatusResource) Delete(ctx context.Cont tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_firmware_upgrades.go b/internal/provider/resource_meraki_network_firmware_upgrades.go index ab4c8a9c..cc5b2624 100644 --- a/internal/provider/resource_meraki_network_firmware_upgrades.go +++ b/internal/provider/resource_meraki_network_firmware_upgrades.go @@ -349,6 +349,7 @@ func (r *NetworkFirmwareUpgradesResource) Delete(ctx context.Context, req resour tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_netflow.go b/internal/provider/resource_meraki_network_netflow.go index 4d97149c..bc91c706 100644 --- a/internal/provider/resource_meraki_network_netflow.go +++ b/internal/provider/resource_meraki_network_netflow.go @@ -241,6 +241,7 @@ func (r *NetworkNetflowResource) Delete(ctx context.Context, req resource.Delete tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_settings.go b/internal/provider/resource_meraki_network_settings.go index c51a1250..c04009d3 100644 --- a/internal/provider/resource_meraki_network_settings.go +++ b/internal/provider/resource_meraki_network_settings.go @@ -249,6 +249,7 @@ func (r *NetworkSettingsResource) Delete(ctx context.Context, req resource.Delet tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_snmp.go b/internal/provider/resource_meraki_network_snmp.go index a0a4d586..7ff620e3 100644 --- a/internal/provider/resource_meraki_network_snmp.go +++ b/internal/provider/resource_meraki_network_snmp.go @@ -250,6 +250,7 @@ func (r *NetworkSNMPResource) Delete(ctx context.Context, req resource.DeleteReq tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_syslog_servers.go b/internal/provider/resource_meraki_network_syslog_servers.go index 0fc0ee1f..28a11b92 100644 --- a/internal/provider/resource_meraki_network_syslog_servers.go +++ b/internal/provider/resource_meraki_network_syslog_servers.go @@ -243,6 +243,7 @@ func (r *NetworkSyslogServersResource) Delete(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_network_traffic_analysis.go b/internal/provider/resource_meraki_network_traffic_analysis.go index 4e63694d..1b65f21c 100644 --- a/internal/provider/resource_meraki_network_traffic_analysis.go +++ b/internal/provider/resource_meraki_network_traffic_analysis.go @@ -253,6 +253,7 @@ func (r *NetworkTrafficAnalysisResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_adaptive_policies_test.go b/internal/provider/resource_meraki_organization_adaptive_policies_test.go index a795cfa6..99c68474 100644 --- a/internal/provider/resource_meraki_organization_adaptive_policies_test.go +++ b/internal/provider/resource_meraki_organization_adaptive_policies_test.go @@ -32,6 +32,9 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccMerakiOrganizationAdaptivePolicies(t *testing.T) { + if os.Getenv("ORGANIZATION_ADAPTIVE_POLICY") == "" { + t.Skip("skipping test, set environment variable ORGANIZATION_ADAPTIVE_POLICY") + } if os.Getenv("TF_VAR_test_org") == "" { t.Skip("skipping test, set environment variable TF_VAR_test_org") } diff --git a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go index 7e7c7031..c7f4e75b 100644 --- a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go +++ b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go @@ -227,6 +227,7 @@ func (r *OrganizationAdaptivePolicySettingsResource) Delete(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_adaptive_policy_test.go b/internal/provider/resource_meraki_organization_adaptive_policy_test.go index 057c0a90..1234f378 100644 --- a/internal/provider/resource_meraki_organization_adaptive_policy_test.go +++ b/internal/provider/resource_meraki_organization_adaptive_policy_test.go @@ -32,6 +32,9 @@ import ( // Section below is generated&owned by "gen/generator.go". //template:begin testAcc func TestAccMerakiOrganizationAdaptivePolicy(t *testing.T) { + if os.Getenv("ORGANIZATION_ADAPTIVE_POLICY") == "" { + t.Skip("skipping test, set environment variable ORGANIZATION_ADAPTIVE_POLICY") + } if os.Getenv("TF_VAR_test_org") == "" { t.Skip("skipping test, set environment variable TF_VAR_test_org") } diff --git a/internal/provider/resource_meraki_organization_branding_policies_priorities.go b/internal/provider/resource_meraki_organization_branding_policies_priorities.go index 0c730717..38381d6e 100644 --- a/internal/provider/resource_meraki_organization_branding_policies_priorities.go +++ b/internal/provider/resource_meraki_organization_branding_policies_priorities.go @@ -227,6 +227,7 @@ func (r *OrganizationBrandingPoliciesPrioritiesResource) Delete(ctx context.Cont tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_license.go b/internal/provider/resource_meraki_organization_license.go index 0d1843fb..a949dea5 100644 --- a/internal/provider/resource_meraki_organization_license.go +++ b/internal/provider/resource_meraki_organization_license.go @@ -232,6 +232,7 @@ func (r *OrganizationLicenseResource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_login_security.go b/internal/provider/resource_meraki_organization_login_security.go index 96fd2337..9e4a36a5 100644 --- a/internal/provider/resource_meraki_organization_login_security.go +++ b/internal/provider/resource_meraki_organization_login_security.go @@ -289,6 +289,7 @@ func (r *OrganizationLoginSecurityResource) Delete(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_saml.go b/internal/provider/resource_meraki_organization_saml.go index f9a65cf6..5d59cb73 100644 --- a/internal/provider/resource_meraki_organization_saml.go +++ b/internal/provider/resource_meraki_organization_saml.go @@ -225,6 +225,7 @@ func (r *OrganizationSAMLResource) Delete(ctx context.Context, req resource.Dele tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_organization_snmp.go b/internal/provider/resource_meraki_organization_snmp.go index d3af3a0f..ffd591ad 100644 --- a/internal/provider/resource_meraki_organization_snmp.go +++ b/internal/provider/resource_meraki_organization_snmp.go @@ -259,6 +259,7 @@ func (r *OrganizationSNMPResource) Delete(ctx context.Context, req resource.Dele tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_sensor_mqtt_broker.go b/internal/provider/resource_meraki_sensor_mqtt_broker.go index 38a5bb14..9cdb297e 100644 --- a/internal/provider/resource_meraki_sensor_mqtt_broker.go +++ b/internal/provider/resource_meraki_sensor_mqtt_broker.go @@ -232,6 +232,7 @@ func (r *SensorMQTTBrokerResource) Delete(ctx context.Context, req resource.Dele tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_sensor_mqtt_brokers.go b/internal/provider/resource_meraki_sensor_mqtt_brokers.go index 3639e7d5..7547cf19 100644 --- a/internal/provider/resource_meraki_sensor_mqtt_brokers.go +++ b/internal/provider/resource_meraki_sensor_mqtt_brokers.go @@ -234,7 +234,7 @@ func (r *SensorMQTTBrokersResource) Update(ctx context.Context, req resource.Upd actions = append(actions, meraki.ActionModel{ Operation: "update", Resource: plan.getItemPath(itemState.MqttBrokerId.ValueString()), - Body: plan.toDestroyBody(ctx), + Body: plan.addDeleteValues(ctx), }) } } @@ -304,7 +304,7 @@ func (r *SensorMQTTBrokersResource) Delete(ctx context.Context, req resource.Del actions[i] = meraki.ActionModel{ Operation: "update", Resource: state.getItemPath(item.MqttBrokerId.ValueString()), - Body: state.toDestroyBody(ctx), + Body: state.addDeleteValues(ctx), } } if len(actions) > 0 { diff --git a/internal/provider/resource_meraki_sensor_relationships.go b/internal/provider/resource_meraki_sensor_relationships.go index 2099e8c4..1236a72a 100644 --- a/internal/provider/resource_meraki_sensor_relationships.go +++ b/internal/provider/resource_meraki_sensor_relationships.go @@ -233,6 +233,7 @@ func (r *SensorRelationshipsResource) Delete(ctx context.Context, req resource.D tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_access_control_lists.go b/internal/provider/resource_meraki_switch_access_control_lists.go index bc0d51aa..36825f3d 100644 --- a/internal/provider/resource_meraki_switch_access_control_lists.go +++ b/internal/provider/resource_meraki_switch_access_control_lists.go @@ -276,6 +276,7 @@ func (r *SwitchAccessControlListsResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_alternate_management_interface.go b/internal/provider/resource_meraki_switch_alternate_management_interface.go index e96ffb67..6c68533e 100644 --- a/internal/provider/resource_meraki_switch_alternate_management_interface.go +++ b/internal/provider/resource_meraki_switch_alternate_management_interface.go @@ -259,6 +259,7 @@ func (r *SwitchAlternateManagementInterfaceResource) Delete(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_dhcp_server_policy.go b/internal/provider/resource_meraki_switch_dhcp_server_policy.go index 7e805c56..d9654751 100644 --- a/internal/provider/resource_meraki_switch_dhcp_server_policy.go +++ b/internal/provider/resource_meraki_switch_dhcp_server_policy.go @@ -249,6 +249,7 @@ func (r *SwitchDHCPServerPolicyResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go index c2a00e97..124c1ff7 100644 --- a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go +++ b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go @@ -241,6 +241,7 @@ func (r *SwitchDSCPToCoSMappingsResource) Delete(ctx context.Context, req resour tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_mtu.go b/internal/provider/resource_meraki_switch_mtu.go index 359cb948..68787abc 100644 --- a/internal/provider/resource_meraki_switch_mtu.go +++ b/internal/provider/resource_meraki_switch_mtu.go @@ -248,6 +248,7 @@ func (r *SwitchMTUResource) Delete(ctx context.Context, req resource.DeleteReque tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_port.go b/internal/provider/resource_meraki_switch_port.go index bfae422f..b042731c 100644 --- a/internal/provider/resource_meraki_switch_port.go +++ b/internal/provider/resource_meraki_switch_port.go @@ -362,6 +362,7 @@ func (r *SwitchPortResource) Delete(ctx context.Context, req resource.DeleteRequ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_ports.go b/internal/provider/resource_meraki_switch_ports.go index f6ee095b..d7adb627 100644 --- a/internal/provider/resource_meraki_switch_ports.go +++ b/internal/provider/resource_meraki_switch_ports.go @@ -361,7 +361,7 @@ func (r *SwitchPortsResource) Update(ctx context.Context, req resource.UpdateReq actions = append(actions, meraki.ActionModel{ Operation: "update", Resource: plan.getItemPath(itemState.PortId.ValueString()), - Body: itemState.toDestroyBody(ctx), + Body: itemState.addDeleteValues(ctx), }) } } @@ -427,7 +427,7 @@ func (r *SwitchPortsResource) Delete(ctx context.Context, req resource.DeleteReq actions[i] = meraki.ActionModel{ Operation: "update", Resource: state.getItemPath(item.PortId.ValueString()), - Body: item.toDestroyBody(ctx), + Body: item.addDeleteValues(ctx), } } if len(actions) > 0 { diff --git a/internal/provider/resource_meraki_switch_qos_rule_order.go b/internal/provider/resource_meraki_switch_qos_rule_order.go index 089d3375..d9ced4ea 100644 --- a/internal/provider/resource_meraki_switch_qos_rule_order.go +++ b/internal/provider/resource_meraki_switch_qos_rule_order.go @@ -227,6 +227,7 @@ func (r *SwitchQoSRuleOrderResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go index 66ed4042..06f4f050 100644 --- a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go @@ -337,6 +337,7 @@ func (r *SwitchRoutingInterfaceDHCPResource) Delete(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_routing_multicast.go b/internal/provider/resource_meraki_switch_routing_multicast.go index 7315a05d..5ae486ed 100644 --- a/internal/provider/resource_meraki_switch_routing_multicast.go +++ b/internal/provider/resource_meraki_switch_routing_multicast.go @@ -261,6 +261,7 @@ func (r *SwitchRoutingMulticastResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_routing_ospf.go b/internal/provider/resource_meraki_switch_routing_ospf.go index 07b92794..ade0a9d1 100644 --- a/internal/provider/resource_meraki_switch_routing_ospf.go +++ b/internal/provider/resource_meraki_switch_routing_ospf.go @@ -305,6 +305,7 @@ func (r *SwitchRoutingOSPFResource) Delete(ctx context.Context, req resource.Del tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_settings.go b/internal/provider/resource_meraki_switch_settings.go index a621831a..38cd7afe 100644 --- a/internal/provider/resource_meraki_switch_settings.go +++ b/internal/provider/resource_meraki_switch_settings.go @@ -258,6 +258,7 @@ func (r *SwitchSettingsResource) Delete(ctx context.Context, req resource.Delete tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go index d9f2dda2..c8e44650 100644 --- a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go @@ -344,6 +344,7 @@ func (r *SwitchStackRoutingInterfaceDHCPResource) Delete(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_storm_control.go b/internal/provider/resource_meraki_switch_storm_control.go index 8118af3f..5d5313aa 100644 --- a/internal/provider/resource_meraki_switch_storm_control.go +++ b/internal/provider/resource_meraki_switch_storm_control.go @@ -239,6 +239,7 @@ func (r *SwitchStormControlResource) Delete(ctx context.Context, req resource.De tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_stp.go b/internal/provider/resource_meraki_switch_stp.go index 6d327b57..8e26cc45 100644 --- a/internal/provider/resource_meraki_switch_stp.go +++ b/internal/provider/resource_meraki_switch_stp.go @@ -253,6 +253,7 @@ func (r *SwitchSTPResource) Delete(ctx context.Context, req resource.DeleteReque tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_switch_warm_spare.go b/internal/provider/resource_meraki_switch_warm_spare.go index cb10c187..e7a61e21 100644 --- a/internal/provider/resource_meraki_switch_warm_spare.go +++ b/internal/provider/resource_meraki_switch_warm_spare.go @@ -229,6 +229,7 @@ func (r *SwitchWarmSpareResource) Delete(ctx context.Context, req resource.Delet tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_air_marshal_settings.go b/internal/provider/resource_meraki_wireless_air_marshal_settings.go index 921bbe67..13366721 100644 --- a/internal/provider/resource_meraki_wireless_air_marshal_settings.go +++ b/internal/provider/resource_meraki_wireless_air_marshal_settings.go @@ -245,6 +245,7 @@ func (r *WirelessAirMarshalSettingsResource) Delete(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_alternate_management_interface.go b/internal/provider/resource_meraki_wireless_alternate_management_interface.go index a3518bd2..41bc054d 100644 --- a/internal/provider/resource_meraki_wireless_alternate_management_interface.go +++ b/internal/provider/resource_meraki_wireless_alternate_management_interface.go @@ -267,6 +267,7 @@ func (r *WirelessAlternateManagementInterfaceResource) Delete(ctx context.Contex tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_billing.go b/internal/provider/resource_meraki_wireless_billing.go index b0ac0f64..91b4ee1a 100644 --- a/internal/provider/resource_meraki_wireless_billing.go +++ b/internal/provider/resource_meraki_wireless_billing.go @@ -254,6 +254,7 @@ func (r *WirelessBillingResource) Delete(ctx context.Context, req resource.Delet tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go index dd824373..3a8418ee 100644 --- a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go @@ -233,6 +233,7 @@ func (r *WirelessDeviceBluetoothSettingsResource) Delete(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go index 39ada76d..d6a06d05 100644 --- a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go @@ -229,6 +229,7 @@ func (r *WirelessDeviceElectronicShelfLabelResource) Delete(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_location_scanning.go b/internal/provider/resource_meraki_wireless_location_scanning.go index 34b15d56..b3c4666f 100644 --- a/internal/provider/resource_meraki_wireless_location_scanning.go +++ b/internal/provider/resource_meraki_wireless_location_scanning.go @@ -31,6 +31,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" + "github.com/tidwall/gjson" ) // End of section. //template:end imports @@ -115,13 +116,22 @@ func (r *WirelessLocationScanningResource) Create(ctx context.Context, req resou return } orgId := nres.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, plan.NetworkId.ValueString()) + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork", orgId) gres, err := r.client.Get(getPath) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve wireless location scanning (GET), got error: %s, %s", err, gres.String())) return } - initialState.fromBody(ctx, meraki.Res{Result: gres.Get("items.0")}) + if len(gres.Get("items").Array()) > 0 { + gres.Get("items").ForEach(func(k, v gjson.Result) bool { + if plan.NetworkId.ValueString() == v.Get("networkId").String() { + gres = meraki.Res{Result: v} + return false + } + return true + }) + } + initialState.fromBody(ctx, gres) helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, WirelessLocationScanning{}), resp.Private, &resp.Diagnostics) // Create object @@ -164,7 +174,7 @@ func (r *WirelessLocationScanningResource) Read(ctx context.Context, req resourc } orgId := res.Get("organizationId").String() - getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork?networkIds[]=%v", orgId, state.NetworkId.ValueString()) + getPath := fmt.Sprintf("/organizations/%v/wireless/location/scanning/byNetwork", orgId) res, err = r.client.Get(getPath) if err != nil && (strings.Contains(err.Error(), "StatusCode 404") || strings.Contains(err.Error(), "StatusCode 400")) { resp.State.RemoveResource(ctx) @@ -174,7 +184,15 @@ func (r *WirelessLocationScanningResource) Read(ctx context.Context, req resourc return } - res = meraki.Res{Result: res.Get("items.0")} + if len(res.Get("items").Array()) > 0 { + res.Get("items").ForEach(func(k, v gjson.Result) bool { + if state.NetworkId.ValueString() == v.Get("networkId").String() { + res = meraki.Res{Result: v} + return false + } + return true + }) + } imp, diags := helpers.IsFlagImporting(ctx, req) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { @@ -244,6 +262,7 @@ func (r *WirelessLocationScanningResource) Delete(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go index 17c9e2c4..03596b3c 100644 --- a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go @@ -250,6 +250,7 @@ func (r *WirelessNetworkBluetoothSettingsResource) Delete(ctx context.Context, r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go index 09f93400..a3180aa7 100644 --- a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go @@ -238,6 +238,7 @@ func (r *WirelessNetworkElectronicShelfLabelResource) Delete(ctx context.Context tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_radio_settings.go b/internal/provider/resource_meraki_wireless_radio_settings.go index b59354d5..771a4d51 100644 --- a/internal/provider/resource_meraki_wireless_radio_settings.go +++ b/internal/provider/resource_meraki_wireless_radio_settings.go @@ -245,6 +245,7 @@ func (r *WirelessRadioSettingsResource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_settings.go b/internal/provider/resource_meraki_wireless_settings.go index af3c543c..1c061254 100644 --- a/internal/provider/resource_meraki_wireless_settings.go +++ b/internal/provider/resource_meraki_wireless_settings.go @@ -254,6 +254,7 @@ func (r *WirelessSettingsResource) Delete(ctx context.Context, req resource.Dele tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid.go b/internal/provider/resource_meraki_wireless_ssid.go index c8a5d1f7..831e4a56 100644 --- a/internal/provider/resource_meraki_wireless_ssid.go +++ b/internal/provider/resource_meraki_wireless_ssid.go @@ -710,6 +710,7 @@ func (r *WirelessSSIDResource) Delete(ctx context.Context, req resource.DeleteRe tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go index 85d050ae..041869fa 100644 --- a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go +++ b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go @@ -258,6 +258,7 @@ func (r *WirelessSSIDBonjourForwardingResource) Delete(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go index cecfe743..2bfad54b 100644 --- a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go +++ b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go @@ -260,6 +260,7 @@ func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Delete(ctx context.Context tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_eap_override.go b/internal/provider/resource_meraki_wireless_ssid_eap_override.go index fac5cc54..80ccb797 100644 --- a/internal/provider/resource_meraki_wireless_ssid_eap_override.go +++ b/internal/provider/resource_meraki_wireless_ssid_eap_override.go @@ -58,7 +58,7 @@ func (r *WirelessSSIDEAPOverrideResource) Metadata(ctx context.Context, req reso func (r *WirelessSSIDEAPOverrideResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: helpers.NewAttributeDescription("This resource can manage the `Wireless SSID EAP override` configuration.").String, + MarkdownDescription: helpers.NewAttributeDescription("This resource can manage the `Wireless SSID EAP Override` configuration.").String, Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ @@ -252,6 +252,7 @@ func (r *WirelessSSIDEAPOverrideResource) Delete(ctx context.Context, req resour tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_eap_override_test.go b/internal/provider/resource_meraki_wireless_ssid_eap_override_test.go index 84688ae1..8f48cda1 100644 --- a/internal/provider/resource_meraki_wireless_ssid_eap_override_test.go +++ b/internal/provider/resource_meraki_wireless_ssid_eap_override_test.go @@ -103,6 +103,11 @@ resource "meraki_wireless_ssid" "test" { name = "My SSID" network_id = meraki_network.test.id ip_assignment_mode = "Bridge mode" + auth_mode = "8021x-radius" + radius_servers = [{ + host = "1.2.3.4" + secret = "secret123" + }] } ` diff --git a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go index 6040ae66..17baeafb 100644 --- a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go +++ b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go @@ -334,6 +334,7 @@ func (r *WirelessSSIDHotspot20Resource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go index 1b4bef04..4d3b8e24 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go @@ -275,6 +275,7 @@ func (r *WirelessSSIDL3FirewallRulesResource) Delete(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go index c9d4f00c..2d3d231c 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go @@ -256,6 +256,7 @@ func (r *WirelessSSIDL7FirewallRulesResource) Delete(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_schedules.go b/internal/provider/resource_meraki_wireless_ssid_schedules.go index 541b3dd4..60b3455d 100644 --- a/internal/provider/resource_meraki_wireless_ssid_schedules.go +++ b/internal/provider/resource_meraki_wireless_ssid_schedules.go @@ -272,6 +272,7 @@ func (r *WirelessSSIDSchedulesResource) Delete(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go index 91ae4792..8ba97e41 100644 --- a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go +++ b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go @@ -382,6 +382,7 @@ func (r *WirelessSSIDSplashSettingsResource) Delete(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go index 1db875fb..797342cd 100644 --- a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go @@ -285,6 +285,7 @@ func (r *WirelessSSIDTrafficShapingRulesResource) Delete(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssid_vpn.go b/internal/provider/resource_meraki_wireless_ssid_vpn.go index 01c8f6ba..55a49d58 100644 --- a/internal/provider/resource_meraki_wireless_ssid_vpn.go +++ b/internal/provider/resource_meraki_wireless_ssid_vpn.go @@ -285,6 +285,7 @@ func (r *WirelessSSIDVPNResource) Delete(ctx context.Context, req resource.Delet tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_ssids.go b/internal/provider/resource_meraki_wireless_ssids.go index 47ac5ad6..be429436 100644 --- a/internal/provider/resource_meraki_wireless_ssids.go +++ b/internal/provider/resource_meraki_wireless_ssids.go @@ -694,27 +694,6 @@ func (r *WirelessSSIDsResource) Update(ctx context.Context, req resource.UpdateR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Update", plan.Id.ValueString())) var actions []meraki.ActionModel - // If there are destroy values, we need to compare the plan and state to determine what to delete - for _, itemState := range state.Items { - found := false - for _, item := range plan.Items { - if item.Number.ValueString() != itemState.Number.ValueString() { - continue - } - - // If the item is present in both plan and state, we can skip it - found = true - break - } - if !found { - // If the item is present in state, but not in plan, we need to delete it - actions = append(actions, meraki.ActionModel{ - Operation: "update", - Resource: plan.getItemPath(itemState.Number.ValueString()), - Body: plan.toDestroyBody(ctx), - }) - } - } // Check for new and updated items for i := range plan.Items { found := false @@ -775,22 +754,6 @@ func (r *WirelessSSIDsResource) Delete(ctx context.Context, req resource.DeleteR } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - actions := make([]meraki.ActionModel, len(state.Items)) - - for i, item := range state.Items { - actions[i] = meraki.ActionModel{ - Operation: "update", - Resource: state.getItemPath(item.Number.ValueString()), - Body: state.toDestroyBody(ctx), - } - } - if len(actions) > 0 { - res, err := r.client.Batch(state.OrganizationId.ValueString(), actions) - if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure objects (Action Batch), got error: %s, %s", err, res.String())) - return - } - } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_meraki_wireless_zigbee.go b/internal/provider/resource_meraki_wireless_zigbee.go index f597c16e..f1562c72 100644 --- a/internal/provider/resource_meraki_wireless_zigbee.go +++ b/internal/provider/resource_meraki_wireless_zigbee.go @@ -269,6 +269,7 @@ func (r *WirelessZigbeeResource) Delete(ctx context.Context, req resource.Delete tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_zigbee_device.go b/internal/provider/resource_meraki_wireless_zigbee_device.go index 5b1a9a4a..546ad5e9 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_device.go +++ b/internal/provider/resource_meraki_wireless_zigbee_device.go @@ -236,6 +236,7 @@ func (r *WirelessZigbeeDeviceResource) Delete(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } diff --git a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go index 254830c7..8da0df1c 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go +++ b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go @@ -232,6 +232,7 @@ func (r *WirelessZigbeeDoorLockResource) Delete(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) // If the resource is a singleton, we need to restore the initial state jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { return } From de75804406a6cd39c5fad9c8fca83a485a5a091e Mon Sep 17 00:00:00 2001 From: danischm Date: Mon, 15 Sep 2025 21:14:40 +0200 Subject: [PATCH 3/7] Fix appliance traffic shaping uplink selection --- .../appliance_traffic_shaping_uplink_selection.yaml | 1 + ...aki_appliance_traffic_shaping_uplink_selection.go | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml index 20945814..39435f5e 100644 --- a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml +++ b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml @@ -1,3 +1,4 @@ +# Customize Delete() to implement custom logic name: Appliance Traffic Shaping Uplink Selection spec_endpoint: /networks/{networkId}/appliance/trafficShaping/uplinkSelection rest_endpoint: /networks/%v/appliance/trafficShaping/uplinkSelection diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go index 582d3b26..becb267f 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_selection.go @@ -33,6 +33,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/netascode/go-meraki" + "github.com/tidwall/sjson" ) // End of section. //template:end imports @@ -400,9 +401,14 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Delete(ctx context.Cont } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) + // If the resource is a singleton, we need to restore the initial state + jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) + jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } - body := state.addDeleteValues(ctx, "") - res, err := r.client.Put(state.getPath(), body) + res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return @@ -416,7 +422,7 @@ func (r *ApplianceTrafficShapingUplinkSelectionResource) Delete(ctx context.Cont sdwanInternetPolicies := ApplianceSDWANInternetPolicies{ NetworkId: state.NetworkId, } - body = sdwanInternetPolicies.addDeleteValues(ctx, "") + body, _ := sjson.Set("", "wanTrafficUplinkPreferences", []interface{}{}) res, err = r.client.Put(sdwanInternetPolicies.getPath(), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to clear Appliance Traffic Shaping Uplink Preferences wan_traffic_uplink_preferences via Appliance SDWAN Internet Policies endpoint (PUT), got error: %s, %s", err, res.String())) From 33d86864a450b6aed4f6c7c3b7696fb895cd82f3 Mon Sep 17 00:00:00 2001 From: danischm Date: Tue, 16 Sep 2025 07:54:52 +0200 Subject: [PATCH 4/7] Fix auth user test data --- docs/resources/network_meraki_auth_user.md | 2 +- docs/resources/network_meraki_auth_users.md | 2 +- .../resources/meraki_network_meraki_auth_user/resource.tf | 2 +- .../resources/meraki_network_meraki_auth_users/resource.tf | 2 +- gen/definitions/network_meraki_auth_user.yaml | 2 +- .../data_source_meraki_network_meraki_auth_user_test.go | 6 +++--- .../resource_meraki_network_meraki_auth_user_test.go | 6 +++--- .../resource_meraki_network_meraki_auth_users_test.go | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/resources/network_meraki_auth_user.md b/docs/resources/network_meraki_auth_user.md index 949da560..586a213d 100644 --- a/docs/resources/network_meraki_auth_user.md +++ b/docs/resources/network_meraki_auth_user.md @@ -16,7 +16,7 @@ This resource can manage the `Network Meraki Auth User` configuration. resource "meraki_network_meraki_auth_user" "example" { network_id = "L_123456" account_type = "802.1X" - email = "miles@meraki.com" + email = "miles321@meraki.com" email_password_to_user = false is_admin = false name = "Miles Meraki" diff --git a/docs/resources/network_meraki_auth_users.md b/docs/resources/network_meraki_auth_users.md index d3a96a23..2ca1e15c 100644 --- a/docs/resources/network_meraki_auth_users.md +++ b/docs/resources/network_meraki_auth_users.md @@ -24,7 +24,7 @@ resource "meraki_network_meraki_auth_users" "example" { organization_id = "123456" items = [{ account_type = "802.1X" - email = "miles@meraki.com" + email = "miles321@meraki.com" email_password_to_user = false is_admin = false name = "Miles Meraki" diff --git a/examples/resources/meraki_network_meraki_auth_user/resource.tf b/examples/resources/meraki_network_meraki_auth_user/resource.tf index 01fc1f2c..3e7233ee 100644 --- a/examples/resources/meraki_network_meraki_auth_user/resource.tf +++ b/examples/resources/meraki_network_meraki_auth_user/resource.tf @@ -1,7 +1,7 @@ resource "meraki_network_meraki_auth_user" "example" { network_id = "L_123456" account_type = "802.1X" - email = "miles@meraki.com" + email = "miles321@meraki.com" email_password_to_user = false is_admin = false name = "Miles Meraki" diff --git a/examples/resources/meraki_network_meraki_auth_users/resource.tf b/examples/resources/meraki_network_meraki_auth_users/resource.tf index 22ec8316..58fbc9ae 100644 --- a/examples/resources/meraki_network_meraki_auth_users/resource.tf +++ b/examples/resources/meraki_network_meraki_auth_users/resource.tf @@ -3,7 +3,7 @@ resource "meraki_network_meraki_auth_users" "example" { organization_id = "123456" items = [{ account_type = "802.1X" - email = "miles@meraki.com" + email = "miles321@meraki.com" email_password_to_user = false is_admin = false name = "Miles Meraki" diff --git a/gen/definitions/network_meraki_auth_user.yaml b/gen/definitions/network_meraki_auth_user.yaml index eb4fdc33..476bf221 100644 --- a/gen/definitions/network_meraki_auth_user.yaml +++ b/gen/definitions/network_meraki_auth_user.yaml @@ -23,7 +23,7 @@ attributes: bulk_id: true mandatory: true description: Email address of the user - example: miles@meraki.com + example: miles321@meraki.com - model_name: emailPasswordToUser type: Bool write_only: true diff --git a/internal/provider/data_source_meraki_network_meraki_auth_user_test.go b/internal/provider/data_source_meraki_network_meraki_auth_user_test.go index 68d582d2..d6d1e263 100644 --- a/internal/provider/data_source_meraki_network_meraki_auth_user_test.go +++ b/internal/provider/data_source_meraki_network_meraki_auth_user_test.go @@ -35,7 +35,7 @@ func TestAccDataSourceMerakiNetworkMerakiAuthUser(t *testing.T) { } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "account_type", "802.1X")) - checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "email", "miles@meraki.com")) + checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "email", "miles321@meraki.com")) checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "is_admin", "false")) checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "name", "Miles Meraki")) checks = append(checks, resource.TestCheckResourceAttr("data.meraki_network_meraki_auth_user.test", "authorizations.0.expires_at", "2018-03-13T00:00:00.090210Z")) @@ -84,7 +84,7 @@ func testAccDataSourceMerakiNetworkMerakiAuthUserConfig() string { config := `resource "meraki_network_meraki_auth_user" "test" {` + "\n" config += ` network_id = meraki_network.test.id` + "\n" config += ` account_type = "802.1X"` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` email_password_to_user = false` + "\n" config += ` is_admin = false` + "\n" config += ` name = "Miles Meraki"` + "\n" @@ -109,7 +109,7 @@ func testAccNamedDataSourceMerakiNetworkMerakiAuthUserConfig() string { config := `resource "meraki_network_meraki_auth_user" "test" {` + "\n" config += ` network_id = meraki_network.test.id` + "\n" config += ` account_type = "802.1X"` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` email_password_to_user = false` + "\n" config += ` is_admin = false` + "\n" config += ` name = "Miles Meraki"` + "\n" diff --git a/internal/provider/resource_meraki_network_meraki_auth_user_test.go b/internal/provider/resource_meraki_network_meraki_auth_user_test.go index ad4dafb5..760bcc27 100644 --- a/internal/provider/resource_meraki_network_meraki_auth_user_test.go +++ b/internal/provider/resource_meraki_network_meraki_auth_user_test.go @@ -37,7 +37,7 @@ func TestAccMerakiNetworkMerakiAuthUser(t *testing.T) { } var checks []resource.TestCheckFunc checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "account_type", "802.1X")) - checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "email", "miles@meraki.com")) + checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "email", "miles321@meraki.com")) checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "is_admin", "false")) checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "name", "Miles Meraki")) checks = append(checks, resource.TestCheckResourceAttr("meraki_network_meraki_auth_user.test", "authorizations.0.expires_at", "2018-03-13T00:00:00.090210Z")) @@ -114,7 +114,7 @@ resource "meraki_wireless_ssid" "test" { func testAccMerakiNetworkMerakiAuthUserConfig_minimum() string { config := `resource "meraki_network_meraki_auth_user" "test" {` + "\n" config += ` network_id = meraki_network.test.id` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` name = "Miles Meraki"` + "\n" config += ` password = "Cisco123456&"` + "\n" config += ` authorizations = [{` + "\n" @@ -132,7 +132,7 @@ func testAccMerakiNetworkMerakiAuthUserConfig_all() string { config := `resource "meraki_network_meraki_auth_user" "test" {` + "\n" config += ` network_id = meraki_network.test.id` + "\n" config += ` account_type = "802.1X"` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` email_password_to_user = false` + "\n" config += ` is_admin = false` + "\n" config += ` name = "Miles Meraki"` + "\n" diff --git a/internal/provider/resource_meraki_network_meraki_auth_users_test.go b/internal/provider/resource_meraki_network_meraki_auth_users_test.go index e27e4fb4..5974ee5e 100644 --- a/internal/provider/resource_meraki_network_meraki_auth_users_test.go +++ b/internal/provider/resource_meraki_network_meraki_auth_users_test.go @@ -106,7 +106,7 @@ func testAccMerakiNetworkMerakiAuthUsersConfig_minimum() string { config += ` network_id = meraki_network.test.id` + "\n" config += ` organization_id = data.meraki_organization.test.id` + "\n" config += ` items = [{` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` name = "Miles Meraki"` + "\n" config += ` password = "Cisco123456&"` + "\n" config += ` authorizations = [{` + "\n" @@ -127,7 +127,7 @@ func testAccMerakiNetworkMerakiAuthUsersConfig_all() string { config += ` organization_id = data.meraki_organization.test.id` + "\n" config += ` items = [{` + "\n" config += ` account_type = "802.1X"` + "\n" - config += ` email = "miles@meraki.com"` + "\n" + config += ` email = "miles321@meraki.com"` + "\n" config += ` email_password_to_user = false` + "\n" config += ` is_admin = false` + "\n" config += ` name = "Miles Meraki"` + "\n" From 48410b02bf5805f8fb2f57cd6e78034fd256e2cc Mon Sep 17 00:00:00 2001 From: danischm Date: Tue, 16 Sep 2025 08:58:05 +0200 Subject: [PATCH 5/7] Introduce write_empty_list attribute --- gen/definitions/appliance_traffic_shaping_rules.yaml | 2 ++ .../appliance_traffic_shaping_uplink_selection.yaml | 1 + .../appliance_traffic_shaping_vpn_exclusions.yaml | 2 ++ gen/definitions/wireless_ssid_l3_firewall_rules.yaml | 1 + gen/definitions/wireless_ssid_l7_firewall_rules.yaml | 2 ++ gen/definitions/wireless_ssid_traffic_shaping_rules.yaml | 2 ++ gen/schema/schema.yaml | 1 + gen/templates/model.go | 6 +++--- gen/yamlconfig/main.go | 5 +++++ .../model_meraki_appliance_traffic_shaping_rules.go | 3 ++- ...del_meraki_appliance_traffic_shaping_uplink_selection.go | 2 +- ...model_meraki_appliance_traffic_shaping_vpn_exclusions.go | 4 ++-- .../model_meraki_wireless_ssid_l3_firewall_rules.go | 2 +- .../model_meraki_wireless_ssid_l7_firewall_rules.go | 3 ++- .../model_meraki_wireless_ssid_traffic_shaping_rules.go | 3 ++- 15 files changed, 29 insertions(+), 10 deletions(-) diff --git a/gen/definitions/appliance_traffic_shaping_rules.yaml b/gen/definitions/appliance_traffic_shaping_rules.yaml index fa711929..e18f76bc 100644 --- a/gen/definitions/appliance_traffic_shaping_rules.yaml +++ b/gen/definitions/appliance_traffic_shaping_rules.yaml @@ -1,3 +1,4 @@ +# Customize toBody(), fromBody(), fromBodyPartial() to handle application and applicationCategory types name: Appliance Traffic Shaping Rules spec_endpoint: /networks/{networkId}/appliance/trafficShaping/rules rest_endpoint: /networks/%v/appliance/trafficShaping/rules @@ -19,6 +20,7 @@ attributes: example: "true" - model_name: rules type: List + write_empty_list: true description: An array of traffic shaping rules. Rules are applied in the order that they are specified in. An empty list (or null) means no rules. Note that you are allowed a maximum of 8 rules. ordered_list: true attributes: diff --git a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml index 39435f5e..81e23c4f 100644 --- a/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml +++ b/gen/definitions/appliance_traffic_shaping_uplink_selection.yaml @@ -35,6 +35,7 @@ attributes: example: "true" - model_name: vpnTrafficUplinkPreferences type: List + write_empty_list: true exclude_test: true description: Array of uplink preference rules for VPN traffic ordered_list: true diff --git a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml index 9162eb74..773b4663 100644 --- a/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml +++ b/gen/definitions/appliance_traffic_shaping_vpn_exclusions.yaml @@ -21,6 +21,7 @@ attributes: test_value: meraki_network.test.id - model_name: custom type: List + write_empty_list: true description: Custom VPN exclusion rules. Pass an empty array to clear existing rules. ordered_list: true attributes: @@ -40,6 +41,7 @@ attributes: enum_values: [any, dns, icmp, tcp, udp] - model_name: majorApplications type: List + write_empty_list: true description: Major Application based VPN exclusion rules. Pass an empty array to clear existing rules. attributes: - model_name: id diff --git a/gen/definitions/wireless_ssid_l3_firewall_rules.yaml b/gen/definitions/wireless_ssid_l3_firewall_rules.yaml index 8062f5dc..edda2375 100644 --- a/gen/definitions/wireless_ssid_l3_firewall_rules.yaml +++ b/gen/definitions/wireless_ssid_l3_firewall_rules.yaml @@ -27,6 +27,7 @@ attributes: minimum_test_value: "false" - model_name: rules type: List + write_empty_list: true description: An ordered array of the firewall rules for this SSID (not including the local LAN access rule or the default rule). ordered_list: true attributes: diff --git a/gen/definitions/wireless_ssid_l7_firewall_rules.yaml b/gen/definitions/wireless_ssid_l7_firewall_rules.yaml index f169ab8e..65d9c8ff 100644 --- a/gen/definitions/wireless_ssid_l7_firewall_rules.yaml +++ b/gen/definitions/wireless_ssid_l7_firewall_rules.yaml @@ -1,3 +1,4 @@ +# Customize toBody(), fromBody(), fromBodyPartial() to handle application and applicationCategory types name: Wireless SSID L7 Firewall Rules spec_endpoint: /networks/{networkId}/wireless/ssids/{number}/firewall/l7FirewallRules rest_endpoint: /networks/%v/wireless/ssids/%v/firewall/l7FirewallRules @@ -22,6 +23,7 @@ attributes: test_value: meraki_wireless_ssid.test.id - model_name: rules type: List + write_empty_list: true description: An array of L7 firewall rules for this SSID. Rules will get applied in the same order user has specified in request. Empty array will clear the L7 firewall rule configuration. ordered_list: true attributes: diff --git a/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml b/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml index ddba2e13..2afee82f 100644 --- a/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml +++ b/gen/definitions/wireless_ssid_traffic_shaping_rules.yaml @@ -1,3 +1,4 @@ +# Customize toBody(), fromBody(), fromBodyPartial() to handle application and applicationCategory types name: Wireless SSID Traffic Shaping Rules spec_endpoint: /networks/{networkId}/wireless/ssids/{number}/trafficShaping/rules rest_endpoint: /networks/%v/wireless/ssids/%v/trafficShaping/rules @@ -29,6 +30,7 @@ attributes: example: "true" - model_name: rules type: List + write_empty_list: true description: An array of traffic shaping rules. Rules are applied in the order that they are specified in. An empty list (or null) means no rules. Note that you are allowed a maximum of 8 rules. ordered_list: true attributes: diff --git a/gen/schema/schema.yaml b/gen/schema/schema.yaml index 732d443a..ad5d9279 100644 --- a/gen/schema/schema.yaml +++ b/gen/schema/schema.yaml @@ -43,6 +43,7 @@ attribute: mandatory: bool(required=False) # Set to true if the attribute is mandatory write_only: bool(required=False) # Set to true if the attribute is write-only, meaning we cannot read the value write_changes_only: bool(required=False) # Set to true if the attribute should only be written (included in PUT payload) if it has changed + write_empty_list: bool(required=False) # Set to true if the attribute should be written as an empty list if it is not set, only relevant if type is "List" or "Set" exclude_test: bool(required=False) # Exclude attribute from example (documentation) and acceptance test exclude_example: bool(required=False) # Exclude attribute from acceptance test only (example/documentation is still generated) allow_import_changes: bool(required=False) # Allow changes to the attribute during import diff --git a/gen/templates/model.go b/gen/templates/model.go index 30ee3eb5..553eb8bf 100644 --- a/gen/templates/model.go +++ b/gen/templates/model.go @@ -157,7 +157,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N body, _ = sjson.Set(body, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(data.{{toGoName .TfName}}) > 0 {{end}}{ + {{if and (not .Mandatory) (not .WriteEmptyList)}}if len(data.{{toGoName .TfName}}) > 0 {{end}}{ {{- if isNestedMap .}} body, _ = sjson.Set(body, "{{getFullModelName . true}}", map[string]interface{}{}) for key, item := range data.{{toGoName .TfName}} { @@ -182,7 +182,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N itemBody, _ = sjson.Set(itemBody, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(item.{{toGoName .TfName}}) > 0 {{end}}{ + {{if and (not .Mandatory) (not .WriteEmptyList)}}if len(item.{{toGoName .TfName}}) > 0 {{end}}{ {{- if isNestedMap .}} itemBody, _ = sjson.Set(itemBody, "{{getFullModelName . true}}", map[string]interface{}{}) for key, childItem := range item.{{toGoName .TfName}} { @@ -207,7 +207,7 @@ func (data {{camelCase .Name}}) toBody(ctx context.Context, state {{camelCase .N itemChildBody, _ = sjson.Set(itemChildBody, "{{getFullModelName . true}}", values) } {{- else if isNestedListSetMap .}} - {{if not .Mandatory}}if len(childItem.{{toGoName .TfName}}) > 0 {{end}}{ + {{if and (not .Mandatory) (not .WriteEmptyList)}}if len(childItem.{{toGoName .TfName}}) > 0 {{end}}{ {{- if isNestedMap .}} itemChildBody, _ = sjson.Set(itemChildBody, "{{getFullModelName . true}}", map[string]interface{}{}) for key, childChildItem := range childItem.{{toGoName .TfName}} { diff --git a/gen/yamlconfig/main.go b/gen/yamlconfig/main.go index dade738f..7045b32a 100644 --- a/gen/yamlconfig/main.go +++ b/gen/yamlconfig/main.go @@ -96,6 +96,7 @@ type YamlConfigAttribute struct { Mandatory bool `yaml:"mandatory,omitempty"` WriteOnly bool `yaml:"write_only,omitempty"` WriteChangesOnly bool `yaml:"write_changes_only,omitempty"` + WriteEmptyList bool `yaml:"write_empty_list,omitempty"` ExcludeTest bool `yaml:"exclude_test,omitempty"` ExcludeExample bool `yaml:"exclude_example,omitempty"` AllowImportChanges bool `yaml:"allow_import_changes,omitempty"` @@ -139,6 +140,7 @@ type YamlConfigAttributeP struct { Mandatory *bool `yaml:"mandatory,omitempty"` WriteOnly *bool `yaml:"write_only,omitempty"` WriteChangesOnly *bool `yaml:"write_changes_only,omitempty"` + WriteEmptyList *bool `yaml:"write_empty_list,omitempty"` ExcludeTest *bool `yaml:"exclude_test,omitempty"` ExcludeExample *bool `yaml:"exclude_example,omitempty"` AllowImportChanges *bool `yaml:"allow_import_changes,omitempty"` @@ -889,6 +891,9 @@ func MergeYamlConfigAttribute(existing *YamlConfigAttributeP, new *YamlConfigAtt if existing.WriteChangesOnly != nil { new.WriteChangesOnly = existing.WriteChangesOnly } + if existing.WriteEmptyList != nil { + new.WriteEmptyList = existing.WriteEmptyList + } if existing.ExcludeTest != nil { new.ExcludeTest = existing.ExcludeTest } diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go index 824fec35..72b17806 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_rules.go @@ -65,12 +65,13 @@ func (data ApplianceTrafficShapingRules) getPath() string { } // End of section. //template:end getPath + func (data ApplianceTrafficShapingRules) toBody(ctx context.Context, state ApplianceTrafficShapingRules) string { body := "" if !data.DefaultRulesEnabled.IsNull() { body, _ = sjson.Set(body, "defaultRulesEnabled", data.DefaultRulesEnabled.ValueBool()) } - if len(data.Rules) > 0 { + { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go index 2c73c5e2..32ae1d4a 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_uplink_selection.go @@ -114,7 +114,7 @@ func (data ApplianceTrafficShapingUplinkSelection) toBody(ctx context.Context, s if !data.FailoverAndFailbackImmediateEnabled.IsNull() { body, _ = sjson.Set(body, "failoverAndFailback.immediate.enabled", data.FailoverAndFailbackImmediateEnabled.ValueBool()) } - if len(data.VpnTrafficUplinkPreferences) > 0 { + { body, _ = sjson.Set(body, "vpnTrafficUplinkPreferences", []interface{}{}) for _, item := range data.VpnTrafficUplinkPreferences { itemBody := "" diff --git a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go index 509ec835..d9e12755 100644 --- a/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/model_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -67,7 +67,7 @@ func (data ApplianceTrafficShapingVPNExclusions) getPath() string { func (data ApplianceTrafficShapingVPNExclusions) toBody(ctx context.Context, state ApplianceTrafficShapingVPNExclusions) string { body := "" - if len(data.Custom) > 0 { + { body, _ = sjson.Set(body, "custom", []interface{}{}) for _, item := range data.Custom { itemBody := "" @@ -83,7 +83,7 @@ func (data ApplianceTrafficShapingVPNExclusions) toBody(ctx context.Context, sta body, _ = sjson.SetRaw(body, "custom.-1", itemBody) } } - if len(data.MajorApplications) > 0 { + { body, _ = sjson.Set(body, "majorApplications", []interface{}{}) for _, item := range data.MajorApplications { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go index 254f527b..c7fedcef 100644 --- a/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l3_firewall_rules.go @@ -68,7 +68,7 @@ func (data WirelessSSIDL3FirewallRules) toBody(ctx context.Context, state Wirele if !data.AllowLanAccess.IsNull() { body, _ = sjson.Set(body, "allowLanAccess", data.AllowLanAccess.ValueBool()) } - if len(data.Rules) > 0 { + { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go index 630cce62..0d482df0 100644 --- a/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_l7_firewall_rules.go @@ -56,9 +56,10 @@ func (data WirelessSSIDL7FirewallRules) getPath() string { } // End of section. //template:end getPath + func (data WirelessSSIDL7FirewallRules) toBody(ctx context.Context, state WirelessSSIDL7FirewallRules) string { body := "" - if len(data.Rules) > 0 { + { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" diff --git a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go index 5f4e7ca8..12da72f3 100644 --- a/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/model_meraki_wireless_ssid_traffic_shaping_rules.go @@ -67,6 +67,7 @@ func (data WirelessSSIDTrafficShapingRules) getPath() string { } // End of section. //template:end getPath + func (data WirelessSSIDTrafficShapingRules) toBody(ctx context.Context, state WirelessSSIDTrafficShapingRules) string { body := "" if !data.DefaultRulesEnabled.IsNull() { @@ -75,7 +76,7 @@ func (data WirelessSSIDTrafficShapingRules) toBody(ctx context.Context, state Wi if !data.TrafficShapingEnabled.IsNull() { body, _ = sjson.Set(body, "trafficShapingEnabled", data.TrafficShapingEnabled.ValueBool()) } - if len(data.Rules) > 0 { + { body, _ = sjson.Set(body, "rules", []interface{}{}) for _, item := range data.Rules { itemBody := "" From b67b74188db5c282110ead3f4381ddc1c26c8f76 Mon Sep 17 00:00:00 2001 From: danischm Date: Tue, 16 Sep 2025 10:33:39 +0200 Subject: [PATCH 6/7] Add notes about missing customizations --- gen/definitions/appliance_dns_local_profile_assignments.yaml | 1 + gen/definitions/appliance_dns_split_profile_assignments.yaml | 1 + gen/definitions/appliance_vlan_dhcp.yaml | 1 + gen/definitions/network_device_claim.yaml | 1 + gen/definitions/network_vlan_profile.yaml | 1 + gen/definitions/organization_inventory_claim.yaml | 1 + .../switch_organization_ports_profiles_automation.yaml | 1 + gen/definitions/switch_ports.yaml | 1 + gen/definitions/switch_stack.yaml | 1 + gen/definitions/wireless_air_marshal_rule.yaml | 1 + gen/definitions/wireless_ethernet_port_profile_assign.yaml | 1 + gen/definitions/wireless_ethernet_port_profile_default.yaml | 1 + 12 files changed, 12 insertions(+) diff --git a/gen/definitions/appliance_dns_local_profile_assignments.yaml b/gen/definitions/appliance_dns_local_profile_assignments.yaml index 677390dc..82df065a 100644 --- a/gen/definitions/appliance_dns_local_profile_assignments.yaml +++ b/gen/definitions/appliance_dns_local_profile_assignments.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update(), Delete() to support custom endpoint paths name: Appliance DNS Local Profile Assignments spec_endpoint: /organizations/{organizationId}/appliance/dns/local/profiles/assignments/bulkCreate rest_endpoint: /organizations/%v/appliance/dns/local/profiles/assignments/bulkCreate diff --git a/gen/definitions/appliance_dns_split_profile_assignments.yaml b/gen/definitions/appliance_dns_split_profile_assignments.yaml index e5f8f499..02b87836 100644 --- a/gen/definitions/appliance_dns_split_profile_assignments.yaml +++ b/gen/definitions/appliance_dns_split_profile_assignments.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update(), Delete() to support custom endpoint paths name: Appliance DNS Split Profile Assignments spec_endpoint: /organizations/{organizationId}/appliance/dns/split/profiles/assignments/bulkCreate rest_endpoint: /organizations/%v/appliance/dns/split/profiles/assignments/bulkCreate diff --git a/gen/definitions/appliance_vlan_dhcp.yaml b/gen/definitions/appliance_vlan_dhcp.yaml index 365a3dfe..12e26743 100644 --- a/gen/definitions/appliance_vlan_dhcp.yaml +++ b/gen/definitions/appliance_vlan_dhcp.yaml @@ -1,3 +1,4 @@ +# Customize Create(), Read(), Update() name: Appliance VLAN DHCP rest_endpoint: /networks/%v/appliance/vlans put_create: true diff --git a/gen/definitions/network_device_claim.yaml b/gen/definitions/network_device_claim.yaml index 8cc6956a..62c60c82 100644 --- a/gen/definitions/network_device_claim.yaml +++ b/gen/definitions/network_device_claim.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update(), Delete() to support procedural endpoints name: Network Device Claim spec_endpoint: /networks/{networkId}/devices/claim rest_endpoint: /networks/%v/devices/claim diff --git a/gen/definitions/network_vlan_profile.yaml b/gen/definitions/network_vlan_profile.yaml index 37505c8e..b920e4ca 100644 --- a/gen/definitions/network_vlan_profile.yaml +++ b/gen/definitions/network_vlan_profile.yaml @@ -1,3 +1,4 @@ +# Customize Create(), Delete() to support default VLAN profile name: Network VLAN Profile spec_endpoint: /networks/{networkId}/vlanProfiles/{iname} rest_endpoint: /networks/%v/vlanProfiles diff --git a/gen/definitions/organization_inventory_claim.yaml b/gen/definitions/organization_inventory_claim.yaml index 906ecaba..812a2d92 100644 --- a/gen/definitions/organization_inventory_claim.yaml +++ b/gen/definitions/organization_inventory_claim.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update(), Delete() to support procedural endpoints name: Organization Inventory Claim spec_endpoint: /organizations/{organizationId}/inventory/claim rest_endpoint: /organizations/%v/inventory/claim diff --git a/gen/definitions/switch_organization_ports_profiles_automation.yaml b/gen/definitions/switch_organization_ports_profiles_automation.yaml index b04697ca..e5302516 100644 --- a/gen/definitions/switch_organization_ports_profiles_automation.yaml +++ b/gen/definitions/switch_organization_ports_profiles_automation.yaml @@ -1,3 +1,4 @@ +# Customize Read() name: Switch Organization Ports Profiles Automation spec_endpoint: /organizations/{organizationId}/switch/ports/profiles/automations/{id} rest_endpoint: /organizations/%v/switch/ports/profiles/automations diff --git a/gen/definitions/switch_ports.yaml b/gen/definitions/switch_ports.yaml index 5fbc5cf9..6b2c542d 100644 --- a/gen/definitions/switch_ports.yaml +++ b/gen/definitions/switch_ports.yaml @@ -1,3 +1,4 @@ +# Customize Update(), Delete() name: Switch Ports bulk_name: Switch Ports spec_endpoint: /devices/{serial}/switch/ports diff --git a/gen/definitions/switch_stack.yaml b/gen/definitions/switch_stack.yaml index a94c0176..8332cf0a 100644 --- a/gen/definitions/switch_stack.yaml +++ b/gen/definitions/switch_stack.yaml @@ -1,3 +1,4 @@ +# Customize Update() to support procedural endpoints name: Switch Stack spec_endpoint: /networks/{networkId}/switch/stacks/{switchStackId} rest_endpoint: /networks/%v/switch/stacks diff --git a/gen/definitions/wireless_air_marshal_rule.yaml b/gen/definitions/wireless_air_marshal_rule.yaml index 35506d40..7845f3c9 100644 --- a/gen/definitions/wireless_air_marshal_rule.yaml +++ b/gen/definitions/wireless_air_marshal_rule.yaml @@ -1,3 +1,4 @@ +# Customize Read() to support org level endpoint name: Wireless Air Marshal Rule spec_endpoint: /networks/{networkId}/wireless/airMarshal/rules/{ruleId} rest_endpoint: /networks/%v/wireless/airMarshal/rules diff --git a/gen/definitions/wireless_ethernet_port_profile_assign.yaml b/gen/definitions/wireless_ethernet_port_profile_assign.yaml index e015435a..fdfe39c7 100644 --- a/gen/definitions/wireless_ethernet_port_profile_assign.yaml +++ b/gen/definitions/wireless_ethernet_port_profile_assign.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update() to support procedural endpoints name: Wireless Ethernet Port Profile Assign spec_endpoint: /networks/{networkId}/wireless/ethernet/ports/profiles/assign rest_endpoint: /networks/%v/wireless/ethernet/ports/profiles/assign diff --git a/gen/definitions/wireless_ethernet_port_profile_default.yaml b/gen/definitions/wireless_ethernet_port_profile_default.yaml index 86be6ed0..e64beda1 100644 --- a/gen/definitions/wireless_ethernet_port_profile_default.yaml +++ b/gen/definitions/wireless_ethernet_port_profile_default.yaml @@ -1,3 +1,4 @@ +# Customize Read(), Update(), Delete() to support custom endpoints name: Wireless Ethernet Port Profile Default spec_endpoint: /networks/{networkId}/wireless/ethernet/ports/profiles/setDefault rest_endpoint: /networks/%v/wireless/ethernet/ports/profiles/setDefault From e74404989045d851a064e17002d1d1a83ed00614 Mon Sep 17 00:00:00 2001 From: danischm Date: Tue, 16 Sep 2025 13:18:03 +0200 Subject: [PATCH 7/7] Issue warning instead of error if initial state cannot be restored --- .../appliance_sdwan_internet_policies.yaml | 1 + gen/definitions/appliance_vlan_dhcp.yaml | 2 +- gen/templates/resource.go | 2 +- gen/yamlconfig/main.go | 2 +- ...eraki_appliance_sdwan_internet_policies.go | 1 + ...eraki_appliance_cellular_firewall_rules.go | 2 +- ...ce_connectivity_monitoring_destinations.go | 2 +- ...urce_meraki_appliance_content_filtering.go | 2 +- ...appliance_firewall_multicast_forwarding.go | 2 +- ...urce_meraki_appliance_firewall_settings.go | 2 +- ...rce_meraki_appliance_firewalled_service.go | 2 +- ...pliance_inbound_cellular_firewall_rules.go | 2 +- ...meraki_appliance_inbound_firewall_rules.go | 2 +- ...urce_meraki_appliance_l3_firewall_rules.go | 2 +- ...urce_meraki_appliance_l7_firewall_rules.go | 2 +- ...ki_appliance_network_security_intrusion.go | 2 +- ..._meraki_appliance_one_to_many_nat_rules.go | 2 +- ...e_meraki_appliance_one_to_one_nat_rules.go | 2 +- ...pliance_organization_security_intrusion.go | 2 +- .../resource_meraki_appliance_port.go | 2 +- ..._meraki_appliance_port_forwarding_rules.go | 2 +- ...esource_meraki_appliance_radio_settings.go | 2 +- ...eraki_appliance_sdwan_internet_policies.go | 20 +++---------------- ...ource_meraki_appliance_security_malware.go | 2 +- .../resource_meraki_appliance_settings.go | 2 +- .../resource_meraki_appliance_single_lan.go | 2 +- ...ource_meraki_appliance_site_to_site_vpn.go | 2 +- .../resource_meraki_appliance_ssid.go | 2 +- ..._meraki_appliance_third_party_vpn_peers.go | 2 +- ...source_meraki_appliance_traffic_shaping.go | 2 +- ..._meraki_appliance_traffic_shaping_rules.go | 2 +- ...liance_traffic_shaping_uplink_bandwidth.go | 2 +- ...ppliance_traffic_shaping_vpn_exclusions.go | 2 +- ...ource_meraki_appliance_uplinks_settings.go | 2 +- .../resource_meraki_appliance_vlan_dhcp.go | 16 --------------- ...esource_meraki_appliance_vlans_settings.go | 2 +- .../resource_meraki_appliance_vpn_bgp.go | 2 +- ...rce_meraki_appliance_vpn_firewall_rules.go | 2 +- ...iance_vpn_site_to_site_ipsec_peers_slas.go | 2 +- .../resource_meraki_appliance_warm_spare.go | 2 +- ...resource_meraki_camera_custom_analytics.go | 2 +- ...esource_meraki_camera_quality_retention.go | 2 +- .../provider/resource_meraki_camera_sense.go | 2 +- .../resource_meraki_camera_video_settings.go | 2 +- ...ay_connectivity_monitoring_destinations.go | 2 +- .../resource_meraki_cellular_gateway_dhcp.go | 2 +- .../resource_meraki_cellular_gateway_lan.go | 2 +- ..._cellular_gateway_port_forwarding_rules.go | 2 +- ...rce_meraki_cellular_gateway_subnet_pool.go | 2 +- ...resource_meraki_cellular_gateway_uplink.go | 2 +- internal/provider/resource_meraki_device.go | 2 +- .../resource_meraki_device_cellular_sims.go | 2 +- ...urce_meraki_device_management_interface.go | 2 +- ...resource_meraki_network_alerts_settings.go | 2 +- .../resource_meraki_network_client_policy.go | 2 +- ...work_client_splash_authorization_status.go | 2 +- ...source_meraki_network_firmware_upgrades.go | 2 +- .../resource_meraki_network_netflow.go | 2 +- .../resource_meraki_network_settings.go | 2 +- .../provider/resource_meraki_network_snmp.go | 2 +- .../resource_meraki_network_syslog_servers.go | 2 +- ...esource_meraki_network_traffic_analysis.go | 2 +- ...i_organization_adaptive_policy_settings.go | 2 +- ...ganization_branding_policies_priorities.go | 2 +- .../resource_meraki_organization_license.go | 2 +- ...urce_meraki_organization_login_security.go | 2 +- .../resource_meraki_organization_saml.go | 2 +- .../resource_meraki_organization_snmp.go | 2 +- .../resource_meraki_sensor_mqtt_broker.go | 2 +- .../resource_meraki_sensor_relationships.go | 2 +- ...urce_meraki_switch_access_control_lists.go | 2 +- ...i_switch_alternate_management_interface.go | 2 +- ...source_meraki_switch_dhcp_server_policy.go | 2 +- ...urce_meraki_switch_dscp_to_cos_mappings.go | 2 +- .../provider/resource_meraki_switch_mtu.go | 2 +- .../provider/resource_meraki_switch_port.go | 2 +- .../resource_meraki_switch_qos_rule_order.go | 2 +- ...ce_meraki_switch_routing_interface_dhcp.go | 2 +- ...esource_meraki_switch_routing_multicast.go | 2 +- .../resource_meraki_switch_routing_ospf.go | 2 +- .../resource_meraki_switch_settings.go | 2 +- ...aki_switch_stack_routing_interface_dhcp.go | 2 +- .../resource_meraki_switch_storm_control.go | 2 +- .../provider/resource_meraki_switch_stp.go | 2 +- .../resource_meraki_switch_warm_spare.go | 2 +- ...ce_meraki_wireless_air_marshal_settings.go | 2 +- ...wireless_alternate_management_interface.go | 2 +- .../resource_meraki_wireless_billing.go | 2 +- ...raki_wireless_device_bluetooth_settings.go | 2 +- ..._wireless_device_electronic_shelf_label.go | 2 +- ...ource_meraki_wireless_location_scanning.go | 2 +- ...aki_wireless_network_bluetooth_settings.go | 2 +- ...wireless_network_electronic_shelf_label.go | 2 +- ...resource_meraki_wireless_radio_settings.go | 2 +- .../resource_meraki_wireless_settings.go | 2 +- .../provider/resource_meraki_wireless_ssid.go | 2 +- ...meraki_wireless_ssid_bonjour_forwarding.go | 2 +- ...ireless_ssid_device_type_group_policies.go | 2 +- ...ource_meraki_wireless_ssid_eap_override.go | 2 +- ...esource_meraki_wireless_ssid_hotspot_20.go | 2 +- ..._meraki_wireless_ssid_l3_firewall_rules.go | 2 +- ..._meraki_wireless_ssid_l7_firewall_rules.go | 2 +- ...resource_meraki_wireless_ssid_schedules.go | 2 +- ...ce_meraki_wireless_ssid_splash_settings.go | 2 +- ...aki_wireless_ssid_traffic_shaping_rules.go | 2 +- .../resource_meraki_wireless_ssid_vpn.go | 2 +- .../resource_meraki_wireless_zigbee.go | 2 +- .../resource_meraki_wireless_zigbee_device.go | 2 +- ...source_meraki_wireless_zigbee_door_lock.go | 2 +- 109 files changed, 110 insertions(+), 138 deletions(-) diff --git a/gen/definitions/appliance_sdwan_internet_policies.yaml b/gen/definitions/appliance_sdwan_internet_policies.yaml index 0859653c..5ca779e0 100644 --- a/gen/definitions/appliance_sdwan_internet_policies.yaml +++ b/gen/definitions/appliance_sdwan_internet_policies.yaml @@ -21,6 +21,7 @@ attributes: mandatory: true description: 'Policies with respective traffic filters for an MX network. Note: these policies are shared (merged) with meraki_appliance_traffic_shaping_uplink_selection resource''s wan_traffic_uplink_preferences attribute. It is recommended to only use one resource for them, not both at the same time: Deleting this resource clears preferences created in meraki_appliance_traffic_shaping_uplink_selection, which is detected as a change by the provider on a subsequent apply. The same happens the other way around, but the change is not detected in sdwan_internet_policies.' ordered_list: true + destroy_value: '[]interface{}{}' attributes: - model_name: failOverCriterion type: String diff --git a/gen/definitions/appliance_vlan_dhcp.yaml b/gen/definitions/appliance_vlan_dhcp.yaml index 12e26743..a7dce41a 100644 --- a/gen/definitions/appliance_vlan_dhcp.yaml +++ b/gen/definitions/appliance_vlan_dhcp.yaml @@ -1,4 +1,4 @@ -# Customize Create(), Read(), Update() +# Customize Create(), Read(), Update(), Delete() name: Appliance VLAN DHCP rest_endpoint: /networks/%v/appliance/vlans put_create: true diff --git a/gen/templates/resource.go b/gen/templates/resource.go index c344ba1a..219e621d 100644 --- a/gen/templates/resource.go +++ b/gen/templates/resource.go @@ -589,7 +589,7 @@ func (r *{{camelCase .Name}}Resource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } {{- else if hasDestroyValues .Attributes}} diff --git a/gen/yamlconfig/main.go b/gen/yamlconfig/main.go index 7045b32a..4cc62a4a 100644 --- a/gen/yamlconfig/main.go +++ b/gen/yamlconfig/main.go @@ -538,7 +538,7 @@ func GetBulkItemIdTfName(config YamlConfig) string { // IsSingleton returns true if the resource is a singleton func IsSingleton(config YamlConfig) bool { - return config.PutCreate && config.NoDelete + return config.PutCreate && config.NoDelete && !config.NoRead } // Map of templating functions diff --git a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go index 40226c95..54346dc5 100644 --- a/internal/provider/model_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/model_meraki_appliance_sdwan_internet_policies.go @@ -463,6 +463,7 @@ func (data *ApplianceSDWANInternetPolicies) fromBodyUnknowns(ctx context.Context // Section below is generated&owned by "gen/generator.go". //template:begin addDeleteValues func (data ApplianceSDWANInternetPolicies) addDeleteValues(ctx context.Context, body string) string { + body, _ = sjson.Set(body, "wanTrafficUplinkPreferences", []interface{}{}) return body } diff --git a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go index 4046e6e9..7d68a81a 100644 --- a/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_cellular_firewall_rules.go @@ -276,7 +276,7 @@ func (r *ApplianceCellularFirewallRulesResource) Delete(ctx context.Context, req res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go index a1277347..6c5bf7c1 100644 --- a/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_appliance_connectivity_monitoring_destinations.go @@ -248,7 +248,7 @@ func (r *ApplianceConnectivityMonitoringDestinationsResource) Delete(ctx context res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_content_filtering.go b/internal/provider/resource_meraki_appliance_content_filtering.go index 37c17022..3e20993b 100644 --- a/internal/provider/resource_meraki_appliance_content_filtering.go +++ b/internal/provider/resource_meraki_appliance_content_filtering.go @@ -253,7 +253,7 @@ func (r *ApplianceContentFilteringResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go index 68c4eb59..ed525108 100644 --- a/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go +++ b/internal/provider/resource_meraki_appliance_firewall_multicast_forwarding.go @@ -265,7 +265,7 @@ func (r *ApplianceFirewallMulticastForwardingResource) Delete(ctx context.Contex res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_firewall_settings.go b/internal/provider/resource_meraki_appliance_firewall_settings.go index b4b156d4..92f04740 100644 --- a/internal/provider/resource_meraki_appliance_firewall_settings.go +++ b/internal/provider/resource_meraki_appliance_firewall_settings.go @@ -237,7 +237,7 @@ func (r *ApplianceFirewallSettingsResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_firewalled_service.go b/internal/provider/resource_meraki_appliance_firewalled_service.go index 6d838594..dd756fda 100644 --- a/internal/provider/resource_meraki_appliance_firewalled_service.go +++ b/internal/provider/resource_meraki_appliance_firewalled_service.go @@ -253,7 +253,7 @@ func (r *ApplianceFirewalledServiceResource) Delete(ctx context.Context, req res res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go index 3d091636..b6e8248b 100644 --- a/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_cellular_firewall_rules.go @@ -276,7 +276,7 @@ func (r *ApplianceInboundCellularFirewallRulesResource) Delete(ctx context.Conte res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go index 097192b7..9e871811 100644 --- a/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_inbound_firewall_rules.go @@ -280,7 +280,7 @@ func (r *ApplianceInboundFirewallRulesResource) Delete(ctx context.Context, req res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go index 3d3e7d17..525eca18 100644 --- a/internal/provider/resource_meraki_appliance_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l3_firewall_rules.go @@ -280,7 +280,7 @@ func (r *ApplianceL3FirewallRulesResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go index d9b0f5d0..689a26fa 100644 --- a/internal/provider/resource_meraki_appliance_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_l7_firewall_rules.go @@ -262,7 +262,7 @@ func (r *ApplianceL7FirewallRulesResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_network_security_intrusion.go b/internal/provider/resource_meraki_appliance_network_security_intrusion.go index cd2c8f2e..fbffbd53 100644 --- a/internal/provider/resource_meraki_appliance_network_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_network_security_intrusion.go @@ -259,7 +259,7 @@ func (r *ApplianceNetworkSecurityIntrusionResource) Delete(ctx context.Context, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go index bfb3724c..e144a31e 100644 --- a/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_many_nat_rules.go @@ -286,7 +286,7 @@ func (r *ApplianceOneToManyNATRulesResource) Delete(ctx context.Context, req res res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go index fb48ce1e..0a11a5e2 100644 --- a/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go +++ b/internal/provider/resource_meraki_appliance_one_to_one_nat_rules.go @@ -283,7 +283,7 @@ func (r *ApplianceOneToOneNATRulesResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go index c2769c16..f2422519 100644 --- a/internal/provider/resource_meraki_appliance_organization_security_intrusion.go +++ b/internal/provider/resource_meraki_appliance_organization_security_intrusion.go @@ -244,7 +244,7 @@ func (r *ApplianceOrganizationSecurityIntrusionResource) Delete(ctx context.Cont res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_port.go b/internal/provider/resource_meraki_appliance_port.go index a069145b..f39cd271 100644 --- a/internal/provider/resource_meraki_appliance_port.go +++ b/internal/provider/resource_meraki_appliance_port.go @@ -259,7 +259,7 @@ func (r *AppliancePortResource) Delete(ctx context.Context, req resource.DeleteR res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go index 4ca5772b..270d0b3b 100644 --- a/internal/provider/resource_meraki_appliance_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_appliance_port_forwarding_rules.go @@ -274,7 +274,7 @@ func (r *AppliancePortForwardingRulesResource) Delete(ctx context.Context, req r res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_radio_settings.go b/internal/provider/resource_meraki_appliance_radio_settings.go index 827d0c20..65347ea5 100644 --- a/internal/provider/resource_meraki_appliance_radio_settings.go +++ b/internal/provider/resource_meraki_appliance_radio_settings.go @@ -252,7 +252,7 @@ func (r *ApplianceRadioSettingsResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go index 17b7d2f6..803c3262 100644 --- a/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go +++ b/internal/provider/resource_meraki_appliance_sdwan_internet_policies.go @@ -197,7 +197,7 @@ func (r *ApplianceSDWANInternetPoliciesResource) Configure(_ context.Context, re // Section below is generated&owned by "gen/generator.go". //template:begin create func (r *ApplianceSDWANInternetPoliciesResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - var plan, initialState ApplianceSDWANInternetPolicies + var plan ApplianceSDWANInternetPolicies // Read plan diags := req.Plan.Get(ctx, &plan) @@ -206,14 +206,6 @@ func (r *ApplianceSDWANInternetPoliciesResource) Create(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Create", plan.Id.ValueString())) - // If the resource is a singleton, we need to read and save the initial state - gres, err := r.client.Get(plan.getPath()) - if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to retrieve object (GET), got error: %s, %s", err, gres.String())) - return - } - initialState.fromBody(ctx, gres) - helpers.SetJsonInitialState(ctx, initialState.toBody(ctx, ApplianceSDWANInternetPolicies{}), resp.Private, &resp.Diagnostics) // Create object body := plan.toBody(ctx, ApplianceSDWANInternetPolicies{}) @@ -304,14 +296,8 @@ func (r *ApplianceSDWANInternetPoliciesResource) Delete(ctx context.Context, req } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - // If the resource is a singleton, we need to restore the initial state - jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) - jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) - if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { - return - } - - res, err := r.client.Put(state.getPath(), jsonInitialState) + body := state.addDeleteValues(ctx, "") + res, err := r.client.Put(state.getPath(), body) if err != nil { resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return diff --git a/internal/provider/resource_meraki_appliance_security_malware.go b/internal/provider/resource_meraki_appliance_security_malware.go index b566202f..2cc7d1a5 100644 --- a/internal/provider/resource_meraki_appliance_security_malware.go +++ b/internal/provider/resource_meraki_appliance_security_malware.go @@ -269,7 +269,7 @@ func (r *ApplianceSecurityMalwareResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_settings.go b/internal/provider/resource_meraki_appliance_settings.go index 3a71ff04..c21019e9 100644 --- a/internal/provider/resource_meraki_appliance_settings.go +++ b/internal/provider/resource_meraki_appliance_settings.go @@ -252,7 +252,7 @@ func (r *ApplianceSettingsResource) Delete(ctx context.Context, req resource.Del res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_single_lan.go b/internal/provider/resource_meraki_appliance_single_lan.go index bd4bce53..d1922033 100644 --- a/internal/provider/resource_meraki_appliance_single_lan.go +++ b/internal/provider/resource_meraki_appliance_single_lan.go @@ -279,7 +279,7 @@ func (r *ApplianceSingleLANResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go index d5536107..b3e98d55 100644 --- a/internal/provider/resource_meraki_appliance_site_to_site_vpn.go +++ b/internal/provider/resource_meraki_appliance_site_to_site_vpn.go @@ -281,7 +281,7 @@ func (r *ApplianceSiteToSiteVPNResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_ssid.go b/internal/provider/resource_meraki_appliance_ssid.go index 3e9c93dc..aeb553d0 100644 --- a/internal/provider/resource_meraki_appliance_ssid.go +++ b/internal/provider/resource_meraki_appliance_ssid.go @@ -310,7 +310,7 @@ func (r *ApplianceSSIDResource) Delete(ctx context.Context, req resource.DeleteR res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go index 130e26b8..51ec7d75 100644 --- a/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go +++ b/internal/provider/resource_meraki_appliance_third_party_vpn_peers.go @@ -397,7 +397,7 @@ func (r *ApplianceThirdPartyVPNPeersResource) Delete(ctx context.Context, req re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping.go b/internal/provider/resource_meraki_appliance_traffic_shaping.go index 32047016..71df38fe 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping.go @@ -236,7 +236,7 @@ func (r *ApplianceTrafficShapingResource) Delete(ctx context.Context, req resour res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go index 72e040b6..b7e0c520 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_rules.go @@ -281,7 +281,7 @@ func (r *ApplianceTrafficShapingRulesResource) Delete(ctx context.Context, req r res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go index dbd8a81c..2dde83bb 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_uplink_bandwidth.go @@ -252,7 +252,7 @@ func (r *ApplianceTrafficShapingUplinkBandwidthResource) Delete(ctx context.Cont res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go index 66a2e11a..e8039927 100644 --- a/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go +++ b/internal/provider/resource_meraki_appliance_traffic_shaping_vpn_exclusions.go @@ -287,7 +287,7 @@ func (r *ApplianceTrafficShapingVPNExclusionsResource) Delete(ctx context.Contex res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_uplinks_settings.go b/internal/provider/resource_meraki_appliance_uplinks_settings.go index 9d558228..a918d911 100644 --- a/internal/provider/resource_meraki_appliance_uplinks_settings.go +++ b/internal/provider/resource_meraki_appliance_uplinks_settings.go @@ -367,7 +367,7 @@ func (r *ApplianceUplinksSettingsResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_vlan_dhcp.go b/internal/provider/resource_meraki_appliance_vlan_dhcp.go index 2a3520e6..e2c5cfcd 100644 --- a/internal/provider/resource_meraki_appliance_vlan_dhcp.go +++ b/internal/provider/resource_meraki_appliance_vlan_dhcp.go @@ -278,8 +278,6 @@ func (r *ApplianceVLANDHCPResource) Update(ctx context.Context, req resource.Upd resp.Diagnostics.Append(diags...) } -// Section below is generated&owned by "gen/generator.go". //template:begin delete - func (r *ApplianceVLANDHCPResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state ApplianceVLANDHCP @@ -290,25 +288,11 @@ func (r *ApplianceVLANDHCPResource) Delete(ctx context.Context, req resource.Del } tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Delete", state.Id.ValueString())) - // If the resource is a singleton, we need to restore the initial state - jsonInitialState, diags := helpers.GetJsonInitialState(ctx, req) - jsonInitialState = state.addDeleteValues(ctx, jsonInitialState) - if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { - return - } - - res, err := r.client.Put(state.getPath(), jsonInitialState) - if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) - return - } tflog.Debug(ctx, fmt.Sprintf("%s: Delete finished successfully", state.Id.ValueString())) resp.State.RemoveResource(ctx) } -// End of section. //template:end delete - // Section below is generated&owned by "gen/generator.go". //template:begin import // End of section. //template:end import diff --git a/internal/provider/resource_meraki_appliance_vlans_settings.go b/internal/provider/resource_meraki_appliance_vlans_settings.go index 85930f0a..40e252b2 100644 --- a/internal/provider/resource_meraki_appliance_vlans_settings.go +++ b/internal/provider/resource_meraki_appliance_vlans_settings.go @@ -232,7 +232,7 @@ func (r *ApplianceVLANsSettingsResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_vpn_bgp.go b/internal/provider/resource_meraki_appliance_vpn_bgp.go index a67e18a3..7f3e5960 100644 --- a/internal/provider/resource_meraki_appliance_vpn_bgp.go +++ b/internal/provider/resource_meraki_appliance_vpn_bgp.go @@ -306,7 +306,7 @@ func (r *ApplianceVPNBGPResource) Delete(ctx context.Context, req resource.Delet res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go index e717877b..b3a46f47 100644 --- a/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go +++ b/internal/provider/resource_meraki_appliance_vpn_firewall_rules.go @@ -280,7 +280,7 @@ func (r *ApplianceVPNFirewallRulesResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go index d3d5fe15..007cd086 100644 --- a/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go +++ b/internal/provider/resource_meraki_appliance_vpn_site_to_site_ipsec_peers_slas.go @@ -244,7 +244,7 @@ func (r *ApplianceVPNSiteToSiteIPsecPeersSLAsResource) Delete(ctx context.Contex res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_appliance_warm_spare.go b/internal/provider/resource_meraki_appliance_warm_spare.go index dcc2a3a6..4f954f86 100644 --- a/internal/provider/resource_meraki_appliance_warm_spare.go +++ b/internal/provider/resource_meraki_appliance_warm_spare.go @@ -248,7 +248,7 @@ func (r *ApplianceWarmSpareResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_camera_custom_analytics.go b/internal/provider/resource_meraki_camera_custom_analytics.go index 52d13144..ae5867aa 100644 --- a/internal/provider/resource_meraki_camera_custom_analytics.go +++ b/internal/provider/resource_meraki_camera_custom_analytics.go @@ -252,7 +252,7 @@ func (r *CameraCustomAnalyticsResource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_camera_quality_retention.go b/internal/provider/resource_meraki_camera_quality_retention.go index 0e05ea94..054215aa 100644 --- a/internal/provider/resource_meraki_camera_quality_retention.go +++ b/internal/provider/resource_meraki_camera_quality_retention.go @@ -264,7 +264,7 @@ func (r *CameraQualityRetentionResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_camera_sense.go b/internal/provider/resource_meraki_camera_sense.go index 4322d94b..7a6a525b 100644 --- a/internal/provider/resource_meraki_camera_sense.go +++ b/internal/provider/resource_meraki_camera_sense.go @@ -244,7 +244,7 @@ func (r *CameraSenseResource) Delete(ctx context.Context, req resource.DeleteReq res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_camera_video_settings.go b/internal/provider/resource_meraki_camera_video_settings.go index 474e6d8b..c2d13e9d 100644 --- a/internal/provider/resource_meraki_camera_video_settings.go +++ b/internal/provider/resource_meraki_camera_video_settings.go @@ -232,7 +232,7 @@ func (r *CameraVideoSettingsResource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go index 93a5f4f6..afa6f0f8 100644 --- a/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go +++ b/internal/provider/resource_meraki_cellular_gateway_connectivity_monitoring_destinations.go @@ -248,7 +248,7 @@ func (r *CellularGatewayConnectivityMonitoringDestinationsResource) Delete(ctx c res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_dhcp.go b/internal/provider/resource_meraki_cellular_gateway_dhcp.go index 03182e12..d0ed5d23 100644 --- a/internal/provider/resource_meraki_cellular_gateway_dhcp.go +++ b/internal/provider/resource_meraki_cellular_gateway_dhcp.go @@ -242,7 +242,7 @@ func (r *CellularGatewayDHCPResource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_lan.go b/internal/provider/resource_meraki_cellular_gateway_lan.go index 74d2398d..d58afab2 100644 --- a/internal/provider/resource_meraki_cellular_gateway_lan.go +++ b/internal/provider/resource_meraki_cellular_gateway_lan.go @@ -268,7 +268,7 @@ func (r *CellularGatewayLANResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go index af8a2cbd..6bc49a3d 100644 --- a/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go +++ b/internal/provider/resource_meraki_cellular_gateway_port_forwarding_rules.go @@ -266,7 +266,7 @@ func (r *CellularGatewayPortForwardingRulesResource) Delete(ctx context.Context, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go index 1d3e1059..078d3862 100644 --- a/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go +++ b/internal/provider/resource_meraki_cellular_gateway_subnet_pool.go @@ -236,7 +236,7 @@ func (r *CellularGatewaySubnetPoolResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_cellular_gateway_uplink.go b/internal/provider/resource_meraki_cellular_gateway_uplink.go index 4bd1bf86..b76c4d38 100644 --- a/internal/provider/resource_meraki_cellular_gateway_uplink.go +++ b/internal/provider/resource_meraki_cellular_gateway_uplink.go @@ -236,7 +236,7 @@ func (r *CellularGatewayUplinkResource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_device.go b/internal/provider/resource_meraki_device.go index 62f52feb..8a398438 100644 --- a/internal/provider/resource_meraki_device.go +++ b/internal/provider/resource_meraki_device.go @@ -266,7 +266,7 @@ func (r *DeviceResource) Delete(ctx context.Context, req resource.DeleteRequest, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_device_cellular_sims.go b/internal/provider/resource_meraki_device_cellular_sims.go index 1f116801..48d9fdec 100644 --- a/internal/provider/resource_meraki_device_cellular_sims.go +++ b/internal/provider/resource_meraki_device_cellular_sims.go @@ -296,7 +296,7 @@ func (r *DeviceCellularSIMsResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_device_management_interface.go b/internal/provider/resource_meraki_device_management_interface.go index 13497b0d..8846736f 100644 --- a/internal/provider/resource_meraki_device_management_interface.go +++ b/internal/provider/resource_meraki_device_management_interface.go @@ -295,7 +295,7 @@ func (r *DeviceManagementInterfaceResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_alerts_settings.go b/internal/provider/resource_meraki_network_alerts_settings.go index c9825260..d86f261c 100644 --- a/internal/provider/resource_meraki_network_alerts_settings.go +++ b/internal/provider/resource_meraki_network_alerts_settings.go @@ -376,7 +376,7 @@ func (r *NetworkAlertsSettingsResource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_client_policy.go b/internal/provider/resource_meraki_network_client_policy.go index 0e264994..4eb882ca 100644 --- a/internal/provider/resource_meraki_network_client_policy.go +++ b/internal/provider/resource_meraki_network_client_policy.go @@ -243,7 +243,7 @@ func (r *NetworkClientPolicyResource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_client_splash_authorization_status.go b/internal/provider/resource_meraki_network_client_splash_authorization_status.go index 7adfadbf..fddaf36e 100644 --- a/internal/provider/resource_meraki_network_client_splash_authorization_status.go +++ b/internal/provider/resource_meraki_network_client_splash_authorization_status.go @@ -295,7 +295,7 @@ func (r *NetworkClientSplashAuthorizationStatusResource) Delete(ctx context.Cont res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_firmware_upgrades.go b/internal/provider/resource_meraki_network_firmware_upgrades.go index cc5b2624..02b8ec0a 100644 --- a/internal/provider/resource_meraki_network_firmware_upgrades.go +++ b/internal/provider/resource_meraki_network_firmware_upgrades.go @@ -356,7 +356,7 @@ func (r *NetworkFirmwareUpgradesResource) Delete(ctx context.Context, req resour res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_netflow.go b/internal/provider/resource_meraki_network_netflow.go index bc91c706..203ab2a9 100644 --- a/internal/provider/resource_meraki_network_netflow.go +++ b/internal/provider/resource_meraki_network_netflow.go @@ -248,7 +248,7 @@ func (r *NetworkNetflowResource) Delete(ctx context.Context, req resource.Delete res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_settings.go b/internal/provider/resource_meraki_network_settings.go index c04009d3..0eeaad4a 100644 --- a/internal/provider/resource_meraki_network_settings.go +++ b/internal/provider/resource_meraki_network_settings.go @@ -256,7 +256,7 @@ func (r *NetworkSettingsResource) Delete(ctx context.Context, req resource.Delet res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_snmp.go b/internal/provider/resource_meraki_network_snmp.go index 7ff620e3..0736966a 100644 --- a/internal/provider/resource_meraki_network_snmp.go +++ b/internal/provider/resource_meraki_network_snmp.go @@ -257,7 +257,7 @@ func (r *NetworkSNMPResource) Delete(ctx context.Context, req resource.DeleteReq res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_syslog_servers.go b/internal/provider/resource_meraki_network_syslog_servers.go index 28a11b92..f0feb98b 100644 --- a/internal/provider/resource_meraki_network_syslog_servers.go +++ b/internal/provider/resource_meraki_network_syslog_servers.go @@ -250,7 +250,7 @@ func (r *NetworkSyslogServersResource) Delete(ctx context.Context, req resource. res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_network_traffic_analysis.go b/internal/provider/resource_meraki_network_traffic_analysis.go index 1b65f21c..41ae744a 100644 --- a/internal/provider/resource_meraki_network_traffic_analysis.go +++ b/internal/provider/resource_meraki_network_traffic_analysis.go @@ -260,7 +260,7 @@ func (r *NetworkTrafficAnalysisResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go index c7f4e75b..de94a921 100644 --- a/internal/provider/resource_meraki_organization_adaptive_policy_settings.go +++ b/internal/provider/resource_meraki_organization_adaptive_policy_settings.go @@ -234,7 +234,7 @@ func (r *OrganizationAdaptivePolicySettingsResource) Delete(ctx context.Context, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_branding_policies_priorities.go b/internal/provider/resource_meraki_organization_branding_policies_priorities.go index 38381d6e..10e10e73 100644 --- a/internal/provider/resource_meraki_organization_branding_policies_priorities.go +++ b/internal/provider/resource_meraki_organization_branding_policies_priorities.go @@ -234,7 +234,7 @@ func (r *OrganizationBrandingPoliciesPrioritiesResource) Delete(ctx context.Cont res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_license.go b/internal/provider/resource_meraki_organization_license.go index a949dea5..52503d80 100644 --- a/internal/provider/resource_meraki_organization_license.go +++ b/internal/provider/resource_meraki_organization_license.go @@ -239,7 +239,7 @@ func (r *OrganizationLicenseResource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_login_security.go b/internal/provider/resource_meraki_organization_login_security.go index 9e4a36a5..734a6d4b 100644 --- a/internal/provider/resource_meraki_organization_login_security.go +++ b/internal/provider/resource_meraki_organization_login_security.go @@ -296,7 +296,7 @@ func (r *OrganizationLoginSecurityResource) Delete(ctx context.Context, req reso res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_saml.go b/internal/provider/resource_meraki_organization_saml.go index 5d59cb73..69bc4ccb 100644 --- a/internal/provider/resource_meraki_organization_saml.go +++ b/internal/provider/resource_meraki_organization_saml.go @@ -232,7 +232,7 @@ func (r *OrganizationSAMLResource) Delete(ctx context.Context, req resource.Dele res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_organization_snmp.go b/internal/provider/resource_meraki_organization_snmp.go index ffd591ad..1fede594 100644 --- a/internal/provider/resource_meraki_organization_snmp.go +++ b/internal/provider/resource_meraki_organization_snmp.go @@ -266,7 +266,7 @@ func (r *OrganizationSNMPResource) Delete(ctx context.Context, req resource.Dele res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_sensor_mqtt_broker.go b/internal/provider/resource_meraki_sensor_mqtt_broker.go index 9cdb297e..8086a9d0 100644 --- a/internal/provider/resource_meraki_sensor_mqtt_broker.go +++ b/internal/provider/resource_meraki_sensor_mqtt_broker.go @@ -239,7 +239,7 @@ func (r *SensorMQTTBrokerResource) Delete(ctx context.Context, req resource.Dele res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_sensor_relationships.go b/internal/provider/resource_meraki_sensor_relationships.go index 1236a72a..3863328a 100644 --- a/internal/provider/resource_meraki_sensor_relationships.go +++ b/internal/provider/resource_meraki_sensor_relationships.go @@ -240,7 +240,7 @@ func (r *SensorRelationshipsResource) Delete(ctx context.Context, req resource.D res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_access_control_lists.go b/internal/provider/resource_meraki_switch_access_control_lists.go index 36825f3d..3044cacc 100644 --- a/internal/provider/resource_meraki_switch_access_control_lists.go +++ b/internal/provider/resource_meraki_switch_access_control_lists.go @@ -283,7 +283,7 @@ func (r *SwitchAccessControlListsResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_alternate_management_interface.go b/internal/provider/resource_meraki_switch_alternate_management_interface.go index 6c68533e..32ee2283 100644 --- a/internal/provider/resource_meraki_switch_alternate_management_interface.go +++ b/internal/provider/resource_meraki_switch_alternate_management_interface.go @@ -266,7 +266,7 @@ func (r *SwitchAlternateManagementInterfaceResource) Delete(ctx context.Context, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_dhcp_server_policy.go b/internal/provider/resource_meraki_switch_dhcp_server_policy.go index d9654751..3b9f07ba 100644 --- a/internal/provider/resource_meraki_switch_dhcp_server_policy.go +++ b/internal/provider/resource_meraki_switch_dhcp_server_policy.go @@ -256,7 +256,7 @@ func (r *SwitchDHCPServerPolicyResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go index 124c1ff7..9107b2ad 100644 --- a/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go +++ b/internal/provider/resource_meraki_switch_dscp_to_cos_mappings.go @@ -248,7 +248,7 @@ func (r *SwitchDSCPToCoSMappingsResource) Delete(ctx context.Context, req resour res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_mtu.go b/internal/provider/resource_meraki_switch_mtu.go index 68787abc..d4e50d6a 100644 --- a/internal/provider/resource_meraki_switch_mtu.go +++ b/internal/provider/resource_meraki_switch_mtu.go @@ -255,7 +255,7 @@ func (r *SwitchMTUResource) Delete(ctx context.Context, req resource.DeleteReque res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_port.go b/internal/provider/resource_meraki_switch_port.go index b042731c..2c7d8f8a 100644 --- a/internal/provider/resource_meraki_switch_port.go +++ b/internal/provider/resource_meraki_switch_port.go @@ -369,7 +369,7 @@ func (r *SwitchPortResource) Delete(ctx context.Context, req resource.DeleteRequ res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_qos_rule_order.go b/internal/provider/resource_meraki_switch_qos_rule_order.go index d9ced4ea..8e2b2cfe 100644 --- a/internal/provider/resource_meraki_switch_qos_rule_order.go +++ b/internal/provider/resource_meraki_switch_qos_rule_order.go @@ -234,7 +234,7 @@ func (r *SwitchQoSRuleOrderResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go index 06f4f050..90a6dc4f 100644 --- a/internal/provider/resource_meraki_switch_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_routing_interface_dhcp.go @@ -344,7 +344,7 @@ func (r *SwitchRoutingInterfaceDHCPResource) Delete(ctx context.Context, req res res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_routing_multicast.go b/internal/provider/resource_meraki_switch_routing_multicast.go index 5ae486ed..05857f86 100644 --- a/internal/provider/resource_meraki_switch_routing_multicast.go +++ b/internal/provider/resource_meraki_switch_routing_multicast.go @@ -268,7 +268,7 @@ func (r *SwitchRoutingMulticastResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_routing_ospf.go b/internal/provider/resource_meraki_switch_routing_ospf.go index ade0a9d1..769237b0 100644 --- a/internal/provider/resource_meraki_switch_routing_ospf.go +++ b/internal/provider/resource_meraki_switch_routing_ospf.go @@ -312,7 +312,7 @@ func (r *SwitchRoutingOSPFResource) Delete(ctx context.Context, req resource.Del res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_settings.go b/internal/provider/resource_meraki_switch_settings.go index 38cd7afe..1b8b8e9f 100644 --- a/internal/provider/resource_meraki_switch_settings.go +++ b/internal/provider/resource_meraki_switch_settings.go @@ -265,7 +265,7 @@ func (r *SwitchSettingsResource) Delete(ctx context.Context, req resource.Delete res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go index c8e44650..efd99592 100644 --- a/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go +++ b/internal/provider/resource_meraki_switch_stack_routing_interface_dhcp.go @@ -351,7 +351,7 @@ func (r *SwitchStackRoutingInterfaceDHCPResource) Delete(ctx context.Context, re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_storm_control.go b/internal/provider/resource_meraki_switch_storm_control.go index 5d5313aa..02cccbbf 100644 --- a/internal/provider/resource_meraki_switch_storm_control.go +++ b/internal/provider/resource_meraki_switch_storm_control.go @@ -246,7 +246,7 @@ func (r *SwitchStormControlResource) Delete(ctx context.Context, req resource.De res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_stp.go b/internal/provider/resource_meraki_switch_stp.go index 8e26cc45..9a3fd9bc 100644 --- a/internal/provider/resource_meraki_switch_stp.go +++ b/internal/provider/resource_meraki_switch_stp.go @@ -260,7 +260,7 @@ func (r *SwitchSTPResource) Delete(ctx context.Context, req resource.DeleteReque res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_switch_warm_spare.go b/internal/provider/resource_meraki_switch_warm_spare.go index e7a61e21..00b5230c 100644 --- a/internal/provider/resource_meraki_switch_warm_spare.go +++ b/internal/provider/resource_meraki_switch_warm_spare.go @@ -236,7 +236,7 @@ func (r *SwitchWarmSpareResource) Delete(ctx context.Context, req resource.Delet res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_air_marshal_settings.go b/internal/provider/resource_meraki_wireless_air_marshal_settings.go index 13366721..1d3b1e8a 100644 --- a/internal/provider/resource_meraki_wireless_air_marshal_settings.go +++ b/internal/provider/resource_meraki_wireless_air_marshal_settings.go @@ -252,7 +252,7 @@ func (r *WirelessAirMarshalSettingsResource) Delete(ctx context.Context, req res res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_alternate_management_interface.go b/internal/provider/resource_meraki_wireless_alternate_management_interface.go index 41bc054d..717aa063 100644 --- a/internal/provider/resource_meraki_wireless_alternate_management_interface.go +++ b/internal/provider/resource_meraki_wireless_alternate_management_interface.go @@ -274,7 +274,7 @@ func (r *WirelessAlternateManagementInterfaceResource) Delete(ctx context.Contex res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_billing.go b/internal/provider/resource_meraki_wireless_billing.go index 91b4ee1a..ee725dc9 100644 --- a/internal/provider/resource_meraki_wireless_billing.go +++ b/internal/provider/resource_meraki_wireless_billing.go @@ -261,7 +261,7 @@ func (r *WirelessBillingResource) Delete(ctx context.Context, req resource.Delet res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go index 3a8418ee..1e9f2589 100644 --- a/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_device_bluetooth_settings.go @@ -240,7 +240,7 @@ func (r *WirelessDeviceBluetoothSettingsResource) Delete(ctx context.Context, re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go index d6a06d05..35353921 100644 --- a/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_device_electronic_shelf_label.go @@ -236,7 +236,7 @@ func (r *WirelessDeviceElectronicShelfLabelResource) Delete(ctx context.Context, res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_location_scanning.go b/internal/provider/resource_meraki_wireless_location_scanning.go index b3c4666f..c1722de8 100644 --- a/internal/provider/resource_meraki_wireless_location_scanning.go +++ b/internal/provider/resource_meraki_wireless_location_scanning.go @@ -269,7 +269,7 @@ func (r *WirelessLocationScanningResource) Delete(ctx context.Context, req resou res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go index 03596b3c..d956355e 100644 --- a/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go +++ b/internal/provider/resource_meraki_wireless_network_bluetooth_settings.go @@ -257,7 +257,7 @@ func (r *WirelessNetworkBluetoothSettingsResource) Delete(ctx context.Context, r res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go index a3180aa7..c963bcf8 100644 --- a/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go +++ b/internal/provider/resource_meraki_wireless_network_electronic_shelf_label.go @@ -245,7 +245,7 @@ func (r *WirelessNetworkElectronicShelfLabelResource) Delete(ctx context.Context res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_radio_settings.go b/internal/provider/resource_meraki_wireless_radio_settings.go index 771a4d51..a2bed7ca 100644 --- a/internal/provider/resource_meraki_wireless_radio_settings.go +++ b/internal/provider/resource_meraki_wireless_radio_settings.go @@ -252,7 +252,7 @@ func (r *WirelessRadioSettingsResource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_settings.go b/internal/provider/resource_meraki_wireless_settings.go index 1c061254..2c9ebc16 100644 --- a/internal/provider/resource_meraki_wireless_settings.go +++ b/internal/provider/resource_meraki_wireless_settings.go @@ -261,7 +261,7 @@ func (r *WirelessSettingsResource) Delete(ctx context.Context, req resource.Dele res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid.go b/internal/provider/resource_meraki_wireless_ssid.go index 831e4a56..203883d8 100644 --- a/internal/provider/resource_meraki_wireless_ssid.go +++ b/internal/provider/resource_meraki_wireless_ssid.go @@ -717,7 +717,7 @@ func (r *WirelessSSIDResource) Delete(ctx context.Context, req resource.DeleteRe res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go index 041869fa..8167dcb1 100644 --- a/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go +++ b/internal/provider/resource_meraki_wireless_ssid_bonjour_forwarding.go @@ -265,7 +265,7 @@ func (r *WirelessSSIDBonjourForwardingResource) Delete(ctx context.Context, req res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go index 2bfad54b..3d89d2d5 100644 --- a/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go +++ b/internal/provider/resource_meraki_wireless_ssid_device_type_group_policies.go @@ -267,7 +267,7 @@ func (r *WirelessSSIDDeviceTypeGroupPoliciesResource) Delete(ctx context.Context res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_eap_override.go b/internal/provider/resource_meraki_wireless_ssid_eap_override.go index 80ccb797..4b2f2e4d 100644 --- a/internal/provider/resource_meraki_wireless_ssid_eap_override.go +++ b/internal/provider/resource_meraki_wireless_ssid_eap_override.go @@ -259,7 +259,7 @@ func (r *WirelessSSIDEAPOverrideResource) Delete(ctx context.Context, req resour res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go index 17baeafb..e14f7ad3 100644 --- a/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go +++ b/internal/provider/resource_meraki_wireless_ssid_hotspot_20.go @@ -341,7 +341,7 @@ func (r *WirelessSSIDHotspot20Resource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go index 4d3b8e24..3c95b6cc 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l3_firewall_rules.go @@ -282,7 +282,7 @@ func (r *WirelessSSIDL3FirewallRulesResource) Delete(ctx context.Context, req re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go index 2d3d231c..c2beb425 100644 --- a/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_l7_firewall_rules.go @@ -263,7 +263,7 @@ func (r *WirelessSSIDL7FirewallRulesResource) Delete(ctx context.Context, req re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_schedules.go b/internal/provider/resource_meraki_wireless_ssid_schedules.go index 60b3455d..e6fa34c8 100644 --- a/internal/provider/resource_meraki_wireless_ssid_schedules.go +++ b/internal/provider/resource_meraki_wireless_ssid_schedules.go @@ -279,7 +279,7 @@ func (r *WirelessSSIDSchedulesResource) Delete(ctx context.Context, req resource res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go index 8ba97e41..fd266259 100644 --- a/internal/provider/resource_meraki_wireless_ssid_splash_settings.go +++ b/internal/provider/resource_meraki_wireless_ssid_splash_settings.go @@ -389,7 +389,7 @@ func (r *WirelessSSIDSplashSettingsResource) Delete(ctx context.Context, req res res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go index 797342cd..f99696e4 100644 --- a/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go +++ b/internal/provider/resource_meraki_wireless_ssid_traffic_shaping_rules.go @@ -292,7 +292,7 @@ func (r *WirelessSSIDTrafficShapingRulesResource) Delete(ctx context.Context, re res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_ssid_vpn.go b/internal/provider/resource_meraki_wireless_ssid_vpn.go index 55a49d58..20959bda 100644 --- a/internal/provider/resource_meraki_wireless_ssid_vpn.go +++ b/internal/provider/resource_meraki_wireless_ssid_vpn.go @@ -292,7 +292,7 @@ func (r *WirelessSSIDVPNResource) Delete(ctx context.Context, req resource.Delet res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_zigbee.go b/internal/provider/resource_meraki_wireless_zigbee.go index f1562c72..c84aeadf 100644 --- a/internal/provider/resource_meraki_wireless_zigbee.go +++ b/internal/provider/resource_meraki_wireless_zigbee.go @@ -276,7 +276,7 @@ func (r *WirelessZigbeeResource) Delete(ctx context.Context, req resource.Delete res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_zigbee_device.go b/internal/provider/resource_meraki_wireless_zigbee_device.go index 546ad5e9..da2d2a79 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_device.go +++ b/internal/provider/resource_meraki_wireless_zigbee_device.go @@ -243,7 +243,7 @@ func (r *WirelessZigbeeDeviceResource) Delete(ctx context.Context, req resource. res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return } diff --git a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go index 8da0df1c..d9217a16 100644 --- a/internal/provider/resource_meraki_wireless_zigbee_door_lock.go +++ b/internal/provider/resource_meraki_wireless_zigbee_door_lock.go @@ -239,7 +239,7 @@ func (r *WirelessZigbeeDoorLockResource) Delete(ctx context.Context, req resourc res, err := r.client.Put(state.getPath(), jsonInitialState) if err != nil { - resp.Diagnostics.AddError("Client Error", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) + resp.Diagnostics.AddWarning("Failed to restore initial state", fmt.Sprintf("Failed to configure object (PUT), got error: %s, %s", err, res.String())) return }