From b35a25ec9d8161d83fee0c5938b27dfe446838db Mon Sep 17 00:00:00 2001 From: danischm Date: Wed, 17 Jul 2024 13:22:51 +0200 Subject: [PATCH] Fix issue when reading deleted cli config profile parcel resource --- CHANGELOG.md | 4 ++++ docs/guides/changelog.md | 4 ++++ gen/templates/generic/resource.go | 2 +- ...rce_sdwan_advanced_inspection_profile_policy_definition.go | 2 +- ...rce_sdwan_advanced_malware_protection_policy_definition.go | 2 +- .../provider/resource_sdwan_allow_url_list_policy_object.go | 2 +- .../provider/resource_sdwan_app_probe_class_policy_object.go | 2 +- ...ource_sdwan_application_aware_routing_policy_definition.go | 2 +- .../provider/resource_sdwan_application_list_policy_object.go | 2 +- .../resource_sdwan_application_priority_feature_profile.go | 2 +- .../provider/resource_sdwan_as_path_list_policy_object.go | 2 +- .../provider/resource_sdwan_block_url_list_policy_object.go | 2 +- internal/provider/resource_sdwan_centralized_policy.go | 2 +- internal/provider/resource_sdwan_cflowd_policy_definition.go | 2 +- internal/provider/resource_sdwan_class_map_policy_object.go | 2 +- internal/provider/resource_sdwan_cli_config_profile_parcel.go | 2 +- internal/provider/resource_sdwan_cli_device_template.go | 2 +- internal/provider/resource_sdwan_cli_feature_profile.go | 2 +- internal/provider/resource_sdwan_color_list_policy_object.go | 2 +- internal/provider/resource_sdwan_configuration_group.go | 2 +- ...esource_sdwan_custom_control_topology_policy_definition.go | 2 +- .../resource_sdwan_data_fqdn_prefix_list_policy_object.go | 2 +- .../resource_sdwan_data_ipv4_prefix_list_policy_object.go | 2 +- .../resource_sdwan_data_ipv6_prefix_list_policy_object.go | 2 +- .../provider/resource_sdwan_dns_security_policy_definition.go | 2 +- internal/provider/resource_sdwan_domain_list_policy_object.go | 2 +- .../resource_sdwan_expanded_community_list_policy_object.go | 2 +- .../resource_sdwan_extended_community_list_policy_object.go | 2 +- internal/provider/resource_sdwan_feature_device_template.go | 2 +- .../resource_sdwan_geo_location_list_policy_object.go | 2 +- ...resource_sdwan_hub_and_spoke_topology_policy_definition.go | 2 +- .../resource_sdwan_intrusion_prevention_policy_definition.go | 2 +- .../resource_sdwan_ips_signature_list_policy_object.go | 2 +- .../provider/resource_sdwan_ipv4_acl_policy_definition.go | 2 +- .../resource_sdwan_ipv4_device_acl_policy_definition.go | 2 +- .../provider/resource_sdwan_ipv4_prefix_list_policy_object.go | 2 +- .../provider/resource_sdwan_ipv6_acl_policy_definition.go | 2 +- .../resource_sdwan_ipv6_device_acl_policy_definition.go | 2 +- .../provider/resource_sdwan_ipv6_prefix_list_policy_object.go | 2 +- .../resource_sdwan_local_application_list_policy_object.go | 2 +- internal/provider/resource_sdwan_localized_policy.go | 2 +- .../resource_sdwan_mesh_topology_policy_definition.go | 2 +- internal/provider/resource_sdwan_mirror_policy_object.go | 2 +- .../provider/resource_sdwan_object_group_policy_definition.go | 2 +- internal/provider/resource_sdwan_policer_policy_object.go | 2 +- internal/provider/resource_sdwan_port_list_policy_object.go | 2 +- .../resource_sdwan_preferred_color_group_policy_object.go | 2 +- .../provider/resource_sdwan_protocol_list_policy_object.go | 2 +- internal/provider/resource_sdwan_qos_map_policy_definition.go | 2 +- internal/provider/resource_sdwan_region_list_policy_object.go | 2 +- .../provider/resource_sdwan_rewrite_rule_policy_definition.go | 2 +- internal/provider/resource_sdwan_route_policy_definition.go | 2 +- .../provider/resource_sdwan_rule_set_policy_definition.go | 2 +- internal/provider/resource_sdwan_security_policy.go | 2 +- internal/provider/resource_sdwan_service_feature_profile.go | 2 +- internal/provider/resource_sdwan_site_list_policy_object.go | 2 +- internal/provider/resource_sdwan_sla_class_policy_object.go | 2 +- .../resource_sdwan_standard_community_list_policy_object.go | 2 +- internal/provider/resource_sdwan_system_feature_profile.go | 2 +- internal/provider/resource_sdwan_tloc_list_policy_object.go | 2 +- .../resource_sdwan_tls_ssl_decryption_policy_definition.go | 2 +- .../resource_sdwan_tls_ssl_profile_policy_definition.go | 2 +- .../provider/resource_sdwan_traffic_data_policy_definition.go | 2 +- internal/provider/resource_sdwan_transport_feature_profile.go | 2 +- .../resource_sdwan_url_filtering_policy_definition.go | 2 +- internal/provider/resource_sdwan_vpn_list_policy_object.go | 2 +- .../resource_sdwan_vpn_membership_policy_definition.go | 2 +- .../resource_sdwan_zone_based_firewall_policy_definition.go | 2 +- internal/provider/resource_sdwan_zone_list_policy_object.go | 2 +- templates/guides/changelog.md.tmpl | 4 ++++ 70 files changed, 79 insertions(+), 67 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 06ddc186..e2698286 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.3.14 (unreleased) + +- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291) + ## 0.3.13 - Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 776fbd5a..c87e96ed 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.3.14 (unreleased) + +- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291) + ## 0.3.13 - Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated diff --git a/gen/templates/generic/resource.go b/gen/templates/generic/resource.go index 6d8f2ad6..d1e0c94f 100644 --- a/gen/templates/generic/resource.go +++ b/gen/templates/generic/resource.go @@ -466,7 +466,7 @@ func (r *{{camelCase .Name}}Resource) Read(ctx context.Context, req resource.Rea tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get({{if .GetRestEndpoint}}"{{.GetRestEndpoint}}"{{else}}state.getPath(){{end}}{{if not .RemoveId}} + url.QueryEscape(state.Id.ValueString()){{end}}) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go b/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go index 2f2d48dd..8d82f749 100644 --- a/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go +++ b/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go @@ -184,7 +184,7 @@ func (r *AdvancedInspectionProfilePolicyDefinitionResource) Read(ctx context.Con tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go b/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go index 67735041..40f93751 100644 --- a/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go +++ b/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go @@ -208,7 +208,7 @@ func (r *AdvancedMalwareProtectionPolicyDefinitionResource) Read(ctx context.Con tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_allow_url_list_policy_object.go b/internal/provider/resource_sdwan_allow_url_list_policy_object.go index 00eb959a..fbbd4a9f 100644 --- a/internal/provider/resource_sdwan_allow_url_list_policy_object.go +++ b/internal/provider/resource_sdwan_allow_url_list_policy_object.go @@ -156,7 +156,7 @@ func (r *AllowURLListPolicyObjectResource) Read(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_app_probe_class_policy_object.go b/internal/provider/resource_sdwan_app_probe_class_policy_object.go index a78b140c..317df1f5 100644 --- a/internal/provider/resource_sdwan_app_probe_class_policy_object.go +++ b/internal/provider/resource_sdwan_app_probe_class_policy_object.go @@ -168,7 +168,7 @@ func (r *AppProbeClassPolicyObjectResource) Read(ctx context.Context, req resour tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go b/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go index 2a456bfc..ed5032e3 100644 --- a/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go +++ b/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go @@ -345,7 +345,7 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Read(ctx context.Conte tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_application_list_policy_object.go b/internal/provider/resource_sdwan_application_list_policy_object.go index b35dc2f7..2cae596f 100644 --- a/internal/provider/resource_sdwan_application_list_policy_object.go +++ b/internal/provider/resource_sdwan_application_list_policy_object.go @@ -160,7 +160,7 @@ func (r *ApplicationListPolicyObjectResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_application_priority_feature_profile.go b/internal/provider/resource_sdwan_application_priority_feature_profile.go index 4d5230f6..cc7a2dd1 100644 --- a/internal/provider/resource_sdwan_application_priority_feature_profile.go +++ b/internal/provider/resource_sdwan_application_priority_feature_profile.go @@ -138,7 +138,7 @@ func (r *ApplicationPriorityFeatureProfileResource) Read(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_as_path_list_policy_object.go b/internal/provider/resource_sdwan_as_path_list_policy_object.go index d2d1122c..d02cf493 100644 --- a/internal/provider/resource_sdwan_as_path_list_policy_object.go +++ b/internal/provider/resource_sdwan_as_path_list_policy_object.go @@ -156,7 +156,7 @@ func (r *ASPathListPolicyObjectResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_block_url_list_policy_object.go b/internal/provider/resource_sdwan_block_url_list_policy_object.go index 7d1880e7..bb47a4a4 100644 --- a/internal/provider/resource_sdwan_block_url_list_policy_object.go +++ b/internal/provider/resource_sdwan_block_url_list_policy_object.go @@ -156,7 +156,7 @@ func (r *BlockURLListPolicyObjectResource) Read(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_centralized_policy.go b/internal/provider/resource_sdwan_centralized_policy.go index 0ffaa715..0009a438 100644 --- a/internal/provider/resource_sdwan_centralized_policy.go +++ b/internal/provider/resource_sdwan_centralized_policy.go @@ -218,7 +218,7 @@ func (r *CentralizedPolicyResource) Read(ctx context.Context, req resource.ReadR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get("/template/policy/vsmart/definition/" + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_cflowd_policy_definition.go b/internal/provider/resource_sdwan_cflowd_policy_definition.go index fd9d0726..0f47d0b8 100644 --- a/internal/provider/resource_sdwan_cflowd_policy_definition.go +++ b/internal/provider/resource_sdwan_cflowd_policy_definition.go @@ -249,7 +249,7 @@ func (r *CflowdPolicyDefinitionResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_class_map_policy_object.go b/internal/provider/resource_sdwan_class_map_policy_object.go index 5a671ede..56d34ea2 100644 --- a/internal/provider/resource_sdwan_class_map_policy_object.go +++ b/internal/provider/resource_sdwan_class_map_policy_object.go @@ -148,7 +148,7 @@ func (r *ClassMapPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_cli_config_profile_parcel.go b/internal/provider/resource_sdwan_cli_config_profile_parcel.go index b2ee1afd..c2ac4473 100644 --- a/internal/provider/resource_sdwan_cli_config_profile_parcel.go +++ b/internal/provider/resource_sdwan_cli_config_profile_parcel.go @@ -156,7 +156,7 @@ func (r *CLIConfigProfileParcelResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_cli_device_template.go b/internal/provider/resource_sdwan_cli_device_template.go index f2863410..dd6b501b 100644 --- a/internal/provider/resource_sdwan_cli_device_template.go +++ b/internal/provider/resource_sdwan_cli_device_template.go @@ -160,7 +160,7 @@ func (r *CLIDeviceTemplateResource) Read(ctx context.Context, req resource.ReadR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get("/template/device/object/" + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_cli_feature_profile.go b/internal/provider/resource_sdwan_cli_feature_profile.go index b6b69a88..0efdfee1 100644 --- a/internal/provider/resource_sdwan_cli_feature_profile.go +++ b/internal/provider/resource_sdwan_cli_feature_profile.go @@ -138,7 +138,7 @@ func (r *CLIFeatureProfileResource) Read(ctx context.Context, req resource.ReadR tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_color_list_policy_object.go b/internal/provider/resource_sdwan_color_list_policy_object.go index 6a14a1fc..a137034a 100644 --- a/internal/provider/resource_sdwan_color_list_policy_object.go +++ b/internal/provider/resource_sdwan_color_list_policy_object.go @@ -160,7 +160,7 @@ func (r *ColorListPolicyObjectResource) Read(ctx context.Context, req resource.R tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_configuration_group.go b/internal/provider/resource_sdwan_configuration_group.go index 835c5371..e71307e0 100644 --- a/internal/provider/resource_sdwan_configuration_group.go +++ b/internal/provider/resource_sdwan_configuration_group.go @@ -205,7 +205,7 @@ func (r *ConfigurationGroupResource) Read(ctx context.Context, req resource.Read tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go b/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go index 5323b43b..18b7a90a 100644 --- a/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go +++ b/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go @@ -478,7 +478,7 @@ func (r *CustomControlTopologyPolicyDefinitionResource) Read(ctx context.Context tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_data_fqdn_prefix_list_policy_object.go b/internal/provider/resource_sdwan_data_fqdn_prefix_list_policy_object.go index 4f47939a..978cd1cf 100644 --- a/internal/provider/resource_sdwan_data_fqdn_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_data_fqdn_prefix_list_policy_object.go @@ -156,7 +156,7 @@ func (r *DataFQDNPrefixListPolicyObjectResource) Read(ctx context.Context, req r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_data_ipv4_prefix_list_policy_object.go b/internal/provider/resource_sdwan_data_ipv4_prefix_list_policy_object.go index c9445a34..938fda69 100644 --- a/internal/provider/resource_sdwan_data_ipv4_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_data_ipv4_prefix_list_policy_object.go @@ -156,7 +156,7 @@ func (r *DataIPv4PrefixListPolicyObjectResource) Read(ctx context.Context, req r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_data_ipv6_prefix_list_policy_object.go b/internal/provider/resource_sdwan_data_ipv6_prefix_list_policy_object.go index 04ae11b4..d7b3dbf6 100644 --- a/internal/provider/resource_sdwan_data_ipv6_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_data_ipv6_prefix_list_policy_object.go @@ -156,7 +156,7 @@ func (r *DataIPv6PrefixListPolicyObjectResource) Read(ctx context.Context, req r tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_dns_security_policy_definition.go b/internal/provider/resource_sdwan_dns_security_policy_definition.go index 91591b42..8badd786 100644 --- a/internal/provider/resource_sdwan_dns_security_policy_definition.go +++ b/internal/provider/resource_sdwan_dns_security_policy_definition.go @@ -204,7 +204,7 @@ func (r *DNSSecurityPolicyDefinitionResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_domain_list_policy_object.go b/internal/provider/resource_sdwan_domain_list_policy_object.go index ae108756..acba08d7 100644 --- a/internal/provider/resource_sdwan_domain_list_policy_object.go +++ b/internal/provider/resource_sdwan_domain_list_policy_object.go @@ -156,7 +156,7 @@ func (r *DomainListPolicyObjectResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_expanded_community_list_policy_object.go b/internal/provider/resource_sdwan_expanded_community_list_policy_object.go index 3686a21c..c0ebeecd 100644 --- a/internal/provider/resource_sdwan_expanded_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_expanded_community_list_policy_object.go @@ -156,7 +156,7 @@ func (r *ExpandedCommunityListPolicyObjectResource) Read(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_extended_community_list_policy_object.go b/internal/provider/resource_sdwan_extended_community_list_policy_object.go index 02853307..3419b615 100644 --- a/internal/provider/resource_sdwan_extended_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_extended_community_list_policy_object.go @@ -156,7 +156,7 @@ func (r *ExtendedCommunityListPolicyObjectResource) Read(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_feature_device_template.go b/internal/provider/resource_sdwan_feature_device_template.go index 9118b8b6..baa233c3 100644 --- a/internal/provider/resource_sdwan_feature_device_template.go +++ b/internal/provider/resource_sdwan_feature_device_template.go @@ -232,7 +232,7 @@ func (r *FeatureDeviceTemplateResource) Read(ctx context.Context, req resource.R tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get("/template/device/object/" + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_geo_location_list_policy_object.go b/internal/provider/resource_sdwan_geo_location_list_policy_object.go index 1c397505..b1fce60b 100644 --- a/internal/provider/resource_sdwan_geo_location_list_policy_object.go +++ b/internal/provider/resource_sdwan_geo_location_list_policy_object.go @@ -164,7 +164,7 @@ func (r *GeoLocationListPolicyObjectResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_hub_and_spoke_topology_policy_definition.go b/internal/provider/resource_sdwan_hub_and_spoke_topology_policy_definition.go index b64d9945..9f1af940 100644 --- a/internal/provider/resource_sdwan_hub_and_spoke_topology_policy_definition.go +++ b/internal/provider/resource_sdwan_hub_and_spoke_topology_policy_definition.go @@ -229,7 +229,7 @@ func (r *HubAndSpokeTopologyPolicyDefinitionResource) Read(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go b/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go index b3277d4e..9a6dcd9b 100644 --- a/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go +++ b/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go @@ -186,7 +186,7 @@ func (r *IntrusionPreventionPolicyDefinitionResource) Read(ctx context.Context, tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ips_signature_list_policy_object.go b/internal/provider/resource_sdwan_ips_signature_list_policy_object.go index 335e7afd..29f9fe7e 100644 --- a/internal/provider/resource_sdwan_ips_signature_list_policy_object.go +++ b/internal/provider/resource_sdwan_ips_signature_list_policy_object.go @@ -167,7 +167,7 @@ func (r *IPSSignatureListPolicyObjectResource) Read(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go index 8ce41b5f..ae1728c6 100644 --- a/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go @@ -347,7 +347,7 @@ func (r *IPv4ACLPolicyDefinitionResource) Read(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go index 29a0d9aa..c091e2ff 100644 --- a/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go @@ -256,7 +256,7 @@ func (r *IPv4DeviceACLPolicyDefinitionResource) Read(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go b/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go index c2ad8df7..9824add2 100644 --- a/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go @@ -164,7 +164,7 @@ func (r *IPv4PrefixListPolicyObjectResource) Read(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go index 79f69ac4..504f794b 100644 --- a/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go @@ -350,7 +350,7 @@ func (r *IPv6ACLPolicyDefinitionResource) Read(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go index 76448ef6..07d9b203 100644 --- a/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go @@ -256,7 +256,7 @@ func (r *IPv6DeviceACLPolicyDefinitionResource) Read(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go b/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go index ddc8428f..9b4381bf 100644 --- a/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go @@ -164,7 +164,7 @@ func (r *IPv6PrefixListPolicyObjectResource) Read(ctx context.Context, req resou tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_local_application_list_policy_object.go b/internal/provider/resource_sdwan_local_application_list_policy_object.go index 2fb996c2..c7cacb6c 100644 --- a/internal/provider/resource_sdwan_local_application_list_policy_object.go +++ b/internal/provider/resource_sdwan_local_application_list_policy_object.go @@ -160,7 +160,7 @@ func (r *LocalApplicationListPolicyObjectResource) Read(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_localized_policy.go b/internal/provider/resource_sdwan_localized_policy.go index 3f585d31..9b8f83b1 100644 --- a/internal/provider/resource_sdwan_localized_policy.go +++ b/internal/provider/resource_sdwan_localized_policy.go @@ -233,7 +233,7 @@ func (r *LocalizedPolicyResource) Read(ctx context.Context, req resource.ReadReq tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get("/template/policy/vedge/definition/" + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_mesh_topology_policy_definition.go b/internal/provider/resource_sdwan_mesh_topology_policy_definition.go index ec9ddb37..0cfc1eb3 100644 --- a/internal/provider/resource_sdwan_mesh_topology_policy_definition.go +++ b/internal/provider/resource_sdwan_mesh_topology_policy_definition.go @@ -181,7 +181,7 @@ func (r *MeshTopologyPolicyDefinitionResource) Read(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_mirror_policy_object.go b/internal/provider/resource_sdwan_mirror_policy_object.go index daa3134f..e082d4fa 100644 --- a/internal/provider/resource_sdwan_mirror_policy_object.go +++ b/internal/provider/resource_sdwan_mirror_policy_object.go @@ -147,7 +147,7 @@ func (r *MirrorPolicyObjectResource) Read(ctx context.Context, req resource.Read tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_object_group_policy_definition.go b/internal/provider/resource_sdwan_object_group_policy_definition.go index f68becca..8b0b3c72 100644 --- a/internal/provider/resource_sdwan_object_group_policy_definition.go +++ b/internal/provider/resource_sdwan_object_group_policy_definition.go @@ -195,7 +195,7 @@ func (r *ObjectGroupPolicyDefinitionResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_policer_policy_object.go b/internal/provider/resource_sdwan_policer_policy_object.go index 6dd2552d..a4e047b3 100644 --- a/internal/provider/resource_sdwan_policer_policy_object.go +++ b/internal/provider/resource_sdwan_policer_policy_object.go @@ -163,7 +163,7 @@ func (r *PolicerPolicyObjectResource) Read(ctx context.Context, req resource.Rea tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_port_list_policy_object.go b/internal/provider/resource_sdwan_port_list_policy_object.go index b90e21a5..daa3d29b 100644 --- a/internal/provider/resource_sdwan_port_list_policy_object.go +++ b/internal/provider/resource_sdwan_port_list_policy_object.go @@ -160,7 +160,7 @@ func (r *PortListPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_preferred_color_group_policy_object.go b/internal/provider/resource_sdwan_preferred_color_group_policy_object.go index 0d58b9aa..ad2ed79c 100644 --- a/internal/provider/resource_sdwan_preferred_color_group_policy_object.go +++ b/internal/provider/resource_sdwan_preferred_color_group_policy_object.go @@ -174,7 +174,7 @@ func (r *PreferredColorGroupPolicyObjectResource) Read(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_protocol_list_policy_object.go b/internal/provider/resource_sdwan_protocol_list_policy_object.go index de4b28c3..2aac6066 100644 --- a/internal/provider/resource_sdwan_protocol_list_policy_object.go +++ b/internal/provider/resource_sdwan_protocol_list_policy_object.go @@ -156,7 +156,7 @@ func (r *ProtocolListPolicyObjectResource) Read(ctx context.Context, req resourc tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_qos_map_policy_definition.go b/internal/provider/resource_sdwan_qos_map_policy_definition.go index c681200a..d4ff1b07 100644 --- a/internal/provider/resource_sdwan_qos_map_policy_definition.go +++ b/internal/provider/resource_sdwan_qos_map_policy_definition.go @@ -212,7 +212,7 @@ func (r *QoSMapPolicyDefinitionResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_region_list_policy_object.go b/internal/provider/resource_sdwan_region_list_policy_object.go index 14f5ff95..223331a5 100644 --- a/internal/provider/resource_sdwan_region_list_policy_object.go +++ b/internal/provider/resource_sdwan_region_list_policy_object.go @@ -156,7 +156,7 @@ func (r *RegionListPolicyObjectResource) Read(ctx context.Context, req resource. tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go b/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go index 51f8b8e4..7f360757 100644 --- a/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go +++ b/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go @@ -191,7 +191,7 @@ func (r *RewriteRulePolicyDefinitionResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_route_policy_definition.go b/internal/provider/resource_sdwan_route_policy_definition.go index 536754cf..07330d10 100644 --- a/internal/provider/resource_sdwan_route_policy_definition.go +++ b/internal/provider/resource_sdwan_route_policy_definition.go @@ -408,7 +408,7 @@ func (r *RoutePolicyDefinitionResource) Read(ctx context.Context, req resource.R tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_rule_set_policy_definition.go b/internal/provider/resource_sdwan_rule_set_policy_definition.go index e4f60f72..445e6257 100644 --- a/internal/provider/resource_sdwan_rule_set_policy_definition.go +++ b/internal/provider/resource_sdwan_rule_set_policy_definition.go @@ -300,7 +300,7 @@ func (r *RuleSetPolicyDefinitionResource) Read(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_security_policy.go b/internal/provider/resource_sdwan_security_policy.go index fa2a0ac5..3f2bb4bb 100644 --- a/internal/provider/resource_sdwan_security_policy.go +++ b/internal/provider/resource_sdwan_security_policy.go @@ -252,7 +252,7 @@ func (r *SecurityPolicyResource) Read(ctx context.Context, req resource.ReadRequ tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get("/template/policy/security/definition/" + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_service_feature_profile.go b/internal/provider/resource_sdwan_service_feature_profile.go index 5fd8d891..da5788b9 100644 --- a/internal/provider/resource_sdwan_service_feature_profile.go +++ b/internal/provider/resource_sdwan_service_feature_profile.go @@ -138,7 +138,7 @@ func (r *ServiceFeatureProfileResource) Read(ctx context.Context, req resource.R tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_site_list_policy_object.go b/internal/provider/resource_sdwan_site_list_policy_object.go index a8e476ec..886787fe 100644 --- a/internal/provider/resource_sdwan_site_list_policy_object.go +++ b/internal/provider/resource_sdwan_site_list_policy_object.go @@ -156,7 +156,7 @@ func (r *SiteListPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_sla_class_policy_object.go b/internal/provider/resource_sdwan_sla_class_policy_object.go index 6f6e34ac..42020de3 100644 --- a/internal/provider/resource_sdwan_sla_class_policy_object.go +++ b/internal/provider/resource_sdwan_sla_class_policy_object.go @@ -199,7 +199,7 @@ func (r *SLAClassPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_standard_community_list_policy_object.go b/internal/provider/resource_sdwan_standard_community_list_policy_object.go index 6423bb36..6fdb1518 100644 --- a/internal/provider/resource_sdwan_standard_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_standard_community_list_policy_object.go @@ -156,7 +156,7 @@ func (r *StandardCommunityListPolicyObjectResource) Read(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_system_feature_profile.go b/internal/provider/resource_sdwan_system_feature_profile.go index a1ecd4b5..8039baea 100644 --- a/internal/provider/resource_sdwan_system_feature_profile.go +++ b/internal/provider/resource_sdwan_system_feature_profile.go @@ -138,7 +138,7 @@ func (r *SystemFeatureProfileResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_tloc_list_policy_object.go b/internal/provider/resource_sdwan_tloc_list_policy_object.go index 5f3f3eea..248ba79c 100644 --- a/internal/provider/resource_sdwan_tloc_list_policy_object.go +++ b/internal/provider/resource_sdwan_tloc_list_policy_object.go @@ -179,7 +179,7 @@ func (r *TLOCListPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go b/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go index a69d17a0..e6bc77b1 100644 --- a/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go +++ b/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go @@ -312,7 +312,7 @@ func (r *TLSSSLDecryptionPolicyDefinitionResource) Read(ctx context.Context, req tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go b/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go index 7e63a48a..dce66100 100644 --- a/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go +++ b/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go @@ -198,7 +198,7 @@ func (r *TLSSSLProfilePolicyDefinitionResource) Read(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_traffic_data_policy_definition.go b/internal/provider/resource_sdwan_traffic_data_policy_definition.go index 89ecd837..6915bfc3 100644 --- a/internal/provider/resource_sdwan_traffic_data_policy_definition.go +++ b/internal/provider/resource_sdwan_traffic_data_policy_definition.go @@ -584,7 +584,7 @@ func (r *TrafficDataPolicyDefinitionResource) Read(ctx context.Context, req reso tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_transport_feature_profile.go b/internal/provider/resource_sdwan_transport_feature_profile.go index 815adcee..00558c5e 100644 --- a/internal/provider/resource_sdwan_transport_feature_profile.go +++ b/internal/provider/resource_sdwan_transport_feature_profile.go @@ -138,7 +138,7 @@ func (r *TransportFeatureProfileResource) Read(ctx context.Context, req resource tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_url_filtering_policy_definition.go b/internal/provider/resource_sdwan_url_filtering_policy_definition.go index 4c310c40..516d92da 100644 --- a/internal/provider/resource_sdwan_url_filtering_policy_definition.go +++ b/internal/provider/resource_sdwan_url_filtering_policy_definition.go @@ -208,7 +208,7 @@ func (r *URLFilteringPolicyDefinitionResource) Read(ctx context.Context, req res tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_vpn_list_policy_object.go b/internal/provider/resource_sdwan_vpn_list_policy_object.go index 2121546f..b5cbc015 100644 --- a/internal/provider/resource_sdwan_vpn_list_policy_object.go +++ b/internal/provider/resource_sdwan_vpn_list_policy_object.go @@ -156,7 +156,7 @@ func (r *VPNListPolicyObjectResource) Read(ctx context.Context, req resource.Rea tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_vpn_membership_policy_definition.go b/internal/provider/resource_sdwan_vpn_membership_policy_definition.go index bb51031d..824a5750 100644 --- a/internal/provider/resource_sdwan_vpn_membership_policy_definition.go +++ b/internal/provider/resource_sdwan_vpn_membership_policy_definition.go @@ -177,7 +177,7 @@ func (r *VPNMembershipPolicyDefinitionResource) Read(ctx context.Context, req re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go b/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go index 923cbb00..008fa491 100644 --- a/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go +++ b/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go @@ -257,7 +257,7 @@ func (r *ZoneBasedFirewallPolicyDefinitionResource) Read(ctx context.Context, re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/internal/provider/resource_sdwan_zone_list_policy_object.go b/internal/provider/resource_sdwan_zone_list_policy_object.go index 8567b3c5..5ed1d4b0 100644 --- a/internal/provider/resource_sdwan_zone_list_policy_object.go +++ b/internal/provider/resource_sdwan_zone_list_policy_object.go @@ -160,7 +160,7 @@ func (r *ZoneListPolicyObjectResource) Read(ctx context.Context, req resource.Re tflog.Debug(ctx, fmt.Sprintf("%s: Beginning Read", state.Name.String())) res, err := r.client.Get(state.getPath() + url.QueryEscape(state.Id.ValueString())) - if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") { + if strings.Contains(res.Get("error.message").String(), "Failed to find specified resource") || strings.Contains(res.Get("error.message").String(), "Invalid template type") || strings.Contains(res.Get("error.message").String(), "Template definition not found") || strings.Contains(res.Get("error.message").String(), "Invalid Profile Id") || strings.Contains(res.Get("error.message").String(), "Invalid feature Id") { resp.State.RemoveResource(ctx) return } else if err != nil { diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 776fbd5a..c87e96ed 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -7,6 +7,10 @@ description: |- # Changelog +## 0.3.14 (unreleased) + +- Fix issue when reading deleted `sdwan_cli_config_profile_parcel` resource, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/291) + ## 0.3.13 - Add workaround for issue when concurrently deleting security policy objects where the reference count is not updated