diff --git a/CHANGELOG.md b/CHANGELOG.md index e1456e9fd..468bf6f81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## 0.6.3 (unreleased) +- BREAKING CHANGE: Rename `tls_ssl_profile_version` attribute of `sdwan_tls_ssl_decryption_policy_definition` resource to `tls_ssl_profile_policy_version` +- BREAKING CHANGE: Rename `sla_class_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `sla_class_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id` - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) ## 0.6.2 diff --git a/docs/data-sources/application_aware_routing_policy_definition.md b/docs/data-sources/application_aware_routing_policy_definition.md index a79ce23ce..2d6d19aa7 100644 --- a/docs/data-sources/application_aware_routing_policy_definition.md +++ b/docs/data-sources/application_aware_routing_policy_definition.md @@ -62,9 +62,9 @@ Read-Only: Read-Only: - `preferred_color` (String) preferred color (Single value or multiple values separated by spaces) -- `preferred_color_group_list` (String) Preferred color group list ID +- `preferred_color_group_list_id` (String) Preferred color group list ID - `preferred_color_group_list_version` (Number) Preferred color group list version -- `sla_class_list` (String) SLA class list ID +- `sla_class_list_id` (String) SLA class list ID - `sla_class_list_version` (Number) SLA class list version - `type` (String) Type of SLA class parameter diff --git a/docs/data-sources/tls_ssl_decryption_policy_definition.md b/docs/data-sources/tls_ssl_decryption_policy_definition.md index 0130acde0..4bf85e18b 100644 --- a/docs/data-sources/tls_ssl_decryption_policy_definition.md +++ b/docs/data-sources/tls_ssl_decryption_policy_definition.md @@ -77,4 +77,4 @@ Read-Only: - `rule_name` (String) Country - `target_vpns` (Set of String) List of VPN IDs - `tls_ssl_profile_policy_id` (String) TLS SSL Profile Policy ID -- `tls_ssl_profile_version` (Number) TLS SSL Profile Policy version +- `tls_ssl_profile_policy_version` (Number) TLS SSL Profile Policy version diff --git a/docs/data-sources/traffic_data_policy_definition.md b/docs/data-sources/traffic_data_policy_definition.md index fb93d2701..60b096073 100644 --- a/docs/data-sources/traffic_data_policy_definition.md +++ b/docs/data-sources/traffic_data_policy_definition.md @@ -97,7 +97,7 @@ Read-Only: - `next_hop_loose` (Boolean) Use routing table entry to forward the packet in case Next-hop is not available - `policer_list_id` (String) Policer list ID - `policer_list_version` (Number) Policer list version -- `preferred_color_group_list` (String) Preferred color group list ID +- `preferred_color_group_list_id` (String) Preferred color group list ID - `preferred_color_group_list_version` (Number) Preferred color group list version - `service_tloc_color` (String) Service TLOC color - `service_tloc_encapsulation` (String) Service TLOC encapsulation diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index 814a41d9e..9f855d3bc 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -9,6 +9,10 @@ description: |- ## 0.6.3 (unreleased) +- BREAKING CHANGE: Rename `tls_ssl_profile_version` attribute of `sdwan_tls_ssl_decryption_policy_definition` resource to `tls_ssl_profile_policy_version` +- BREAKING CHANGE: Rename `sla_class_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `sla_class_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id` - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) ## 0.6.2 diff --git a/docs/resources/application_aware_routing_policy_definition.md b/docs/resources/application_aware_routing_policy_definition.md index f8b4481ae..a91fc24c6 100644 --- a/docs/resources/application_aware_routing_policy_definition.md +++ b/docs/resources/application_aware_routing_policy_definition.md @@ -95,9 +95,9 @@ Required: Optional: - `preferred_color` (String) preferred color (Single value or multiple values separated by spaces), Attribute conditional on `type` being equal to `preferredColor` -- `preferred_color_group_list` (String) Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup` +- `preferred_color_group_list_id` (String) Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup` - `preferred_color_group_list_version` (Number) Preferred color group list version -- `sla_class_list` (String) SLA class list ID, Attribute conditional on `type` being equal to `name` +- `sla_class_list_id` (String) SLA class list ID, Attribute conditional on `type` being equal to `name` - `sla_class_list_version` (Number) SLA class list version diff --git a/docs/resources/tls_ssl_decryption_policy_definition.md b/docs/resources/tls_ssl_decryption_policy_definition.md index 3927754d5..52fe916ce 100644 --- a/docs/resources/tls_ssl_decryption_policy_definition.md +++ b/docs/resources/tls_ssl_decryption_policy_definition.md @@ -124,7 +124,7 @@ Optional: - `rule_name` (String) Country - `target_vpns` (Set of String) List of VPN IDs - `tls_ssl_profile_policy_id` (String) TLS SSL Profile Policy ID -- `tls_ssl_profile_version` (Number) TLS SSL Profile Policy version +- `tls_ssl_profile_policy_version` (Number) TLS SSL Profile Policy version ## Import diff --git a/docs/resources/traffic_data_policy_definition.md b/docs/resources/traffic_data_policy_definition.md index e7fd2badc..36db07fb7 100644 --- a/docs/resources/traffic_data_policy_definition.md +++ b/docs/resources/traffic_data_policy_definition.md @@ -152,7 +152,7 @@ Optional: - `next_hop_loose` (Boolean) Use routing table entry to forward the packet in case Next-hop is not available, Attribute conditional on `type` being equal to `nextHopLoose` - `policer_list_id` (String) Policer list ID, Attribute conditional on `type` being equal to `policer` - `policer_list_version` (Number) Policer list version -- `preferred_color_group_list` (String) Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup` +- `preferred_color_group_list_id` (String) Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup` - `preferred_color_group_list_version` (Number) Preferred color group list version - `service_tloc_color` (String) Service TLOC color, Attribute conditional on `type` being equal to `service` - `service_tloc_encapsulation` (String) Service TLOC encapsulation, Attribute conditional on `type` being equal to `service` diff --git a/gen/definitions/generic/application_aware_routing_policy_definition.yaml b/gen/definitions/generic/application_aware_routing_policy_definition.yaml index 5bac1b45c..2ddf72c05 100644 --- a/gen/definitions/generic/application_aware_routing_policy_definition.yaml +++ b/gen/definitions/generic/application_aware_routing_policy_definition.yaml @@ -317,7 +317,7 @@ attributes: description: Type of SLA class parameter example: name - model_name: ref - tf_name: sla_class_list + tf_name: sla_class_list_id conditional_attribute: name: type value: name @@ -331,7 +331,7 @@ attributes: description: SLA class list version exclude_test: true - model_name: ref - tf_name: preferred_color_group_list + tf_name: preferred_color_group_list_id conditional_attribute: name: type value: preferredColorGroup diff --git a/gen/definitions/generic/tls_ssl_decryption_policy_definition.yml b/gen/definitions/generic/tls_ssl_decryption_policy_definition.yml index 55f221bc1..6ae00ff52 100644 --- a/gen/definitions/generic/tls_ssl_decryption_policy_definition.yml +++ b/gen/definitions/generic/tls_ssl_decryption_policy_definition.yml @@ -107,7 +107,7 @@ attributes: type: String description: TLS SSL Profile Policy ID example: 2d8cbc1b-f969-4999-a0bd-f77a070ba5f7 - - tf_name: tls_ssl_profile_version + - tf_name: tls_ssl_profile_policy_version tf_only: true type: Version description: TLS SSL Profile Policy version diff --git a/gen/definitions/generic/traffic_data_policy_definition.yaml b/gen/definitions/generic/traffic_data_policy_definition.yaml index 135500687..3a0689dd1 100644 --- a/gen/definitions/generic/traffic_data_policy_definition.yaml +++ b/gen/definitions/generic/traffic_data_policy_definition.yaml @@ -601,7 +601,7 @@ attributes: description: Policer list version exclude_test: true - model_name: ref - tf_name: preferred_color_group_list + tf_name: preferred_color_group_list_id conditional_attribute: name: type value: preferredColorGroup diff --git a/gen/generator.go b/gen/generator.go index 5198476d7..29ee4571d 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -293,6 +293,13 @@ func ToGoName(s string) string { return s } +func ToVersionName(s string) string { + s = ToGoName(s) + m := strings.ReplaceAll(s, "Versions", "Ids") + m = strings.ReplaceAll(m, "Version", "Id") + return m +} + // Templating helper function to convert string to camel case func CamelCase(s string) string { var g []string @@ -397,6 +404,11 @@ func HasReference(attributes []YamlConfigAttribute) bool { return false } +// Templating helper function to return true if UX 2.0 related feature +func IsUx20Feature(config YamlConfig) bool { + return !strings.HasPrefix(config.DocCategory, "(Classic)") +} + // Templating helper function to return number of reference included in attributes func CountReferences(attributes []YamlConfigAttribute) int { count := 0 @@ -547,6 +559,7 @@ func contains(s []string, str string) bool { // Map of templating functions var functions = template.FuncMap{ "toGoName": ToGoName, + "toVersionName": ToVersionName, "camelCase": CamelCase, "snakeCase": SnakeCase, "sprintf": fmt.Sprintf, @@ -561,6 +574,7 @@ var functions = template.FuncMap{ "add": Add, "getGjsonType": GetGjsonType, "getId": GetId, + "isUx20Feature": IsUx20Feature, "isListSet": IsListSet, "isList": IsList, "isSet": IsSet, diff --git a/gen/templates/generic/model.go b/gen/templates/generic/model.go index 92eabfe24..54b1a83c1 100644 --- a/gen/templates/generic/model.go +++ b/gen/templates/generic/model.go @@ -59,6 +59,7 @@ Type types.String `tfsdk:"type"` {{- end}} } + {{ range .Attributes}} {{- if not .Value}} {{- $childName := toGoName .TfName}} @@ -676,3 +677,82 @@ func (data *{{camelCase .Name}}) updateVersions(ctx context.Context, state *{{ca } {{end}} // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *{{camelCase .Name}}) processImport(ctx context.Context) { + {{- if .HasVersion}} + data.Version = types.Int64Value(0) + {{- end}} + {{- if .TypeValue}} + data.Type = types.StringValue("{{ .TypeValue }}") + {{- end}} + {{- range .Attributes}} + {{- $name := toGoName .TfName}} + {{- if not .Value}} + {{- if .Value}} + data.{{toGoName .TfName}} = {{if eq .Type "String"}}types.StringValue("{{ .Value }}"){{else if eq .Type "Bool"}}types.BoolValue({{ .Value }}){{else if eq .Type "List"}}{{ .Value }}{{else}}types.ListNull({{ .Value }}){{end}} + {{- end}} + {{- if eq .Type "Version"}} + if data.{{toVersionName .TfName}} != types.StringNull() { + data.{{toGoName .TfName}} = types.Int64Value(0) + } + {{- else if eq .Type "Versions"}} + if !data.{{toVersionName .TfName}}.IsNull() { + data.{{toGoName .TfName}} = types.ListNull(types.StringType) + } + {{- else if and (isNestedListSet .) (hasVersionAttribute .Attributes)}} + for i := range data.{{toGoName .TfName}} { + + {{- range .Attributes}} + {{- $cname := toGoName .TfName}} + {{- if not .Value}} + {{- if eq .Type "Version"}} + if data.{{$name}}[i].{{toVersionName .TfName}} != types.StringNull() { + data.{{$name}}[i].{{toGoName .TfName}} = types.Int64Value(0) + } + {{- else if eq .Type "Versions"}} + if !data.{{$name}}[i].{{toVersionName .TfName}}.IsNull() { + data.{{$name}}[i].{{toGoName .TfName}} = types.ListNull(types.StringType) + } + {{- else if and (isNestedListSet .) (hasVersionAttribute .Attributes)}} + for ii := range data.{{$name}}[i].{{toGoName .TfName}} { + + {{- range .Attributes}} + {{- $ccname := toGoName .TfName}} + {{- if not .Value}} + {{- if eq .Type "Version"}} + if data.{{$name}}[i].{{$cname}}[ii].{{toVersionName .TfName}} != types.StringNull() { + data.{{$name}}[i].{{$cname}}[ii].{{toGoName .TfName}} = types.Int64Value(0) + } + {{- else if eq .Type "Versions"}} + if !data.{{$name}}[i].{{$cname}}[ii].{{toVersionName .TfName}}.IsNull() { + data.{{$name}}[i].{{$cname}}[ii].{{toGoName .TfName}} = types.ListNull(types.StringType) + } + {{- else if and (isNestedListSet .) (hasVersionAttribute .Attributes)}} + for iii := range data.{{$name}}[i].{{$cname}}[ii].{{toGoName .TfName}} { + + {{- range .Attributes}} + {{- if eq .Type "Version"}} + if data.{{$name}}[i].{{$cname}}[ii].{{$ccname}}[iii].{{toVersionName .TfName}} != types.StringNull() { + data.{{$name}}[i].{{$cname}}[ii].{{$ccname}}[iii].{{toGoName .TfName}} = types.Int64Value(0) + } + {{- else if eq .Type "Versions"}} + if !data.{{$name}}[i].{{$cname}}[ii].{{$ccname}}[iii].{{toVersionName .TfName}}.IsNull() { + data.{{$name}}[i].{{$cname}}[ii].{{$ccname}}[iii].{{toGoName .TfName}} = types.ListNull(types.StringType) + } + {{- end}} + {{- end}} + } + {{- end}} + {{- end}} + {{- end}} + } + {{- end}} + {{- end}} + {{- end}} + } + {{- end}} + {{- end}} + {{- end}} +} +// End of section. //template:end processImport \ No newline at end of file diff --git a/gen/templates/generic/resource.go b/gen/templates/generic/resource.go index e01286f1a..34ade1f6d 100644 --- a/gen/templates/generic/resource.go +++ b/gen/templates/generic/resource.go @@ -497,9 +497,15 @@ func (r *{{camelCase .Name}}Resource) Read(ctx context.Context, req resource.Rea } state.fromBody(ctx, res) - {{- if .HasVersion}} - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + + {{- if and (not .NoImport) (not (isUx20Feature .)) (or (.HasVersion) (.TypeValue) (hasVersionAttribute .Attributes))}} + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } {{- end}} @@ -619,6 +625,8 @@ func (r *{{camelCase .Name}}Resource) ImportState(ctx context.Context, req resou {{- else}} resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) {{- end}} + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } {{- end}} // End of section. //template:end import diff --git a/internal/provider/data_source_sdwan_application_aware_routing_policy_definition.go b/internal/provider/data_source_sdwan_application_aware_routing_policy_definition.go index cd96bf209..48e7aa509 100644 --- a/internal/provider/data_source_sdwan_application_aware_routing_policy_definition.go +++ b/internal/provider/data_source_sdwan_application_aware_routing_policy_definition.go @@ -217,7 +217,7 @@ func (d *ApplicationAwareRoutingPolicyDefinitionDataSource) Schema(ctx context.C MarkdownDescription: "Type of SLA class parameter", Computed: true, }, - "sla_class_list": schema.StringAttribute{ + "sla_class_list_id": schema.StringAttribute{ MarkdownDescription: "SLA class list ID", Computed: true, }, @@ -225,7 +225,7 @@ func (d *ApplicationAwareRoutingPolicyDefinitionDataSource) Schema(ctx context.C MarkdownDescription: "SLA class list version", Computed: true, }, - "preferred_color_group_list": schema.StringAttribute{ + "preferred_color_group_list_id": schema.StringAttribute{ MarkdownDescription: "Preferred color group list ID", Computed: true, }, diff --git a/internal/provider/data_source_sdwan_tls_ssl_decryption_policy_definition.go b/internal/provider/data_source_sdwan_tls_ssl_decryption_policy_definition.go index 327d7c838..b8adcfb80 100644 --- a/internal/provider/data_source_sdwan_tls_ssl_decryption_policy_definition.go +++ b/internal/provider/data_source_sdwan_tls_ssl_decryption_policy_definition.go @@ -140,7 +140,7 @@ func (d *TLSSSLDecryptionPolicyDefinitionDataSource) Schema(ctx context.Context, MarkdownDescription: "TLS SSL Profile Policy ID", Computed: true, }, - "tls_ssl_profile_version": schema.Int64Attribute{ + "tls_ssl_profile_policy_version": schema.Int64Attribute{ MarkdownDescription: "TLS SSL Profile Policy version", Computed: true, }, diff --git a/internal/provider/data_source_sdwan_traffic_data_policy_definition.go b/internal/provider/data_source_sdwan_traffic_data_policy_definition.go index 876d3126b..86e309ac9 100644 --- a/internal/provider/data_source_sdwan_traffic_data_policy_definition.go +++ b/internal/provider/data_source_sdwan_traffic_data_policy_definition.go @@ -325,7 +325,7 @@ func (d *TrafficDataPolicyDefinitionDataSource) Schema(ctx context.Context, req MarkdownDescription: "Policer list version", Computed: true, }, - "preferred_color_group_list": schema.StringAttribute{ + "preferred_color_group_list_id": schema.StringAttribute{ MarkdownDescription: "Preferred color group list ID", Computed: true, }, diff --git a/internal/provider/model_sdwan_activate_centralized_policy.go b/internal/provider/model_sdwan_activate_centralized_policy.go index 547236ea6..d8917d811 100644 --- a/internal/provider/model_sdwan_activate_centralized_policy.go +++ b/internal/provider/model_sdwan_activate_centralized_policy.go @@ -116,3 +116,7 @@ func (data ActivateCentralizedPolicy) getPushBody(ctx context.Context, client *s attachPayload, _ := sjson.Set("", "deviceTemplateList", deviceTemplateList) return attachPayload, nil } + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_advanced_inspection_profile_policy_definition.go b/internal/provider/model_sdwan_advanced_inspection_profile_policy_definition.go index a57463839..6c01d919b 100644 --- a/internal/provider/model_sdwan_advanced_inspection_profile_policy_definition.go +++ b/internal/provider/model_sdwan_advanced_inspection_profile_policy_definition.go @@ -168,3 +168,22 @@ func (data *AdvancedInspectionProfilePolicyDefinition) updateVersions(ctx contex } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *AdvancedInspectionProfilePolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.IntrusionPreventionId != types.StringNull() { + data.IntrusionPreventionVersion = types.Int64Value(0) + } + if data.UrlFilteringId != types.StringNull() { + data.UrlFilteringVersion = types.Int64Value(0) + } + if data.AdvancedMalwareProtectionId != types.StringNull() { + data.AdvancedMalwareProtectionVersion = types.Int64Value(0) + } + if data.TlsSslDecryptionId != types.StringNull() { + data.TlsSslDecryptionVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_advanced_malware_protection_policy_definition.go b/internal/provider/model_sdwan_advanced_malware_protection_policy_definition.go index a538af089..453994d19 100644 --- a/internal/provider/model_sdwan_advanced_malware_protection_policy_definition.go +++ b/internal/provider/model_sdwan_advanced_malware_protection_policy_definition.go @@ -236,3 +236,10 @@ func (data *AdvancedMalwareProtectionPolicyDefinition) hasChanges(ctx context.Co // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *AdvancedMalwareProtectionPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_allow_url_list_policy_object.go b/internal/provider/model_sdwan_allow_url_list_policy_object.go index 4e114fb84..e43265a6e 100644 --- a/internal/provider/model_sdwan_allow_url_list_policy_object.go +++ b/internal/provider/model_sdwan_allow_url_list_policy_object.go @@ -124,3 +124,10 @@ func (data *AllowURLListPolicyObject) hasChanges(ctx context.Context, state *All // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *AllowURLListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_app_probe_class_policy_object.go b/internal/provider/model_sdwan_app_probe_class_policy_object.go index e4421c953..4c70a9e98 100644 --- a/internal/provider/model_sdwan_app_probe_class_policy_object.go +++ b/internal/provider/model_sdwan_app_probe_class_policy_object.go @@ -148,3 +148,10 @@ func (data *AppProbeClassPolicyObject) hasChanges(ctx context.Context, state *Ap // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *AppProbeClassPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_application_aware_routing_policy_definition.go b/internal/provider/model_sdwan_application_aware_routing_policy_definition.go index e59622657..47781d087 100644 --- a/internal/provider/model_sdwan_application_aware_routing_policy_definition.go +++ b/internal/provider/model_sdwan_application_aware_routing_policy_definition.go @@ -80,9 +80,9 @@ type ApplicationAwareRoutingPolicyDefinitionSequencesActionEntries struct { type ApplicationAwareRoutingPolicyDefinitionSequencesActionEntriesSlaClassParameters struct { Type types.String `tfsdk:"type"` - SlaClassList types.String `tfsdk:"sla_class_list"` + SlaClassListId types.String `tfsdk:"sla_class_list_id"` SlaClassListVersion types.Int64 `tfsdk:"sla_class_list_version"` - PreferredColorGroupList types.String `tfsdk:"preferred_color_group_list"` + PreferredColorGroupListId types.String `tfsdk:"preferred_color_group_list_id"` PreferredColorGroupListVersion types.Int64 `tfsdk:"preferred_color_group_list_version"` PreferredColor types.String `tfsdk:"preferred_color"` } @@ -209,11 +209,11 @@ func (data ApplicationAwareRoutingPolicyDefinition) toBody(ctx context.Context) if !childChildItem.Type.IsNull() { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "field", childChildItem.Type.ValueString()) } - if !childChildItem.SlaClassList.IsNull() && childChildItem.Type.ValueString() == "name" { - itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.SlaClassList.ValueString()) + if !childChildItem.SlaClassListId.IsNull() && childChildItem.Type.ValueString() == "name" { + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.SlaClassListId.ValueString()) } - if !childChildItem.PreferredColorGroupList.IsNull() && childChildItem.Type.ValueString() == "preferredColorGroup" { - itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.PreferredColorGroupList.ValueString()) + if !childChildItem.PreferredColorGroupListId.IsNull() && childChildItem.Type.ValueString() == "preferredColorGroup" { + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.PreferredColorGroupListId.ValueString()) } if !childChildItem.PreferredColor.IsNull() && childChildItem.Type.ValueString() == "preferredColor" { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "value", childChildItem.PreferredColor.ValueString()) @@ -399,14 +399,14 @@ func (data *ApplicationAwareRoutingPolicyDefinition) fromBody(ctx context.Contex ccItem.Type = types.StringNull() } if cccValue := ccv.Get("ref"); cccValue.Exists() && ccItem.Type.ValueString() == "name" { - ccItem.SlaClassList = types.StringValue(cccValue.String()) + ccItem.SlaClassListId = types.StringValue(cccValue.String()) } else { - ccItem.SlaClassList = types.StringNull() + ccItem.SlaClassListId = types.StringNull() } if cccValue := ccv.Get("ref"); cccValue.Exists() && ccItem.Type.ValueString() == "preferredColorGroup" { - ccItem.PreferredColorGroupList = types.StringValue(cccValue.String()) + ccItem.PreferredColorGroupListId = types.StringValue(cccValue.String()) } else { - ccItem.PreferredColorGroupList = types.StringNull() + ccItem.PreferredColorGroupListId = types.StringNull() } if cccValue := ccv.Get("value"); cccValue.Exists() && ccItem.Type.ValueString() == "preferredColor" { ccItem.PreferredColor = types.StringValue(cccValue.String()) @@ -544,10 +544,10 @@ func (data *ApplicationAwareRoutingPolicyDefinition) hasChanges(ctx context.Cont if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].Type.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].Type) { hasChanges = true } - if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassList.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassList) { + if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassListId.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassListId) { hasChanges = true } - if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupList.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupList) { + if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupListId.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupListId) { hasChanges = true } if !data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColor.Equal(state.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColor) { @@ -650,3 +650,37 @@ func (data *ApplicationAwareRoutingPolicyDefinition) updateVersions(ctx context. } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ApplicationAwareRoutingPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("appRoute") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].ApplicationListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ApplicationListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DnsApplicationListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DnsApplicationListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].SourceDataPrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataPrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataPrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataPrefixListVersion = types.Int64Value(0) + } + } + for ii := range data.Sequences[i].ActionEntries { + for iii := range data.Sequences[i].ActionEntries[ii].SlaClassParameters { + if data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].SlaClassListVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SlaClassParameters[iii].PreferredColorGroupListVersion = types.Int64Value(0) + } + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_application_list_policy_object.go b/internal/provider/model_sdwan_application_list_policy_object.go index c89604a9d..e4a09adcb 100644 --- a/internal/provider/model_sdwan_application_list_policy_object.go +++ b/internal/provider/model_sdwan_application_list_policy_object.go @@ -136,3 +136,10 @@ func (data *ApplicationListPolicyObject) hasChanges(ctx context.Context, state * // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ApplicationListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_application_priority_feature_profile.go b/internal/provider/model_sdwan_application_priority_feature_profile.go index 6217dafcd..9e23b597c 100644 --- a/internal/provider/model_sdwan_application_priority_feature_profile.go +++ b/internal/provider/model_sdwan_application_priority_feature_profile.go @@ -91,3 +91,9 @@ func (data *ApplicationPriorityFeatureProfile) hasChanges(ctx context.Context, s // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ApplicationPriorityFeatureProfile) processImport(ctx context.Context) { +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_as_path_list_policy_object.go b/internal/provider/model_sdwan_as_path_list_policy_object.go index f72198197..6de58b753 100644 --- a/internal/provider/model_sdwan_as_path_list_policy_object.go +++ b/internal/provider/model_sdwan_as_path_list_policy_object.go @@ -124,3 +124,10 @@ func (data *ASPathListPolicyObject) hasChanges(ctx context.Context, state *ASPat // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ASPathListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_attach_feature_device_template.go b/internal/provider/model_sdwan_attach_feature_device_template.go index 77870619c..b9b7b60d3 100644 --- a/internal/provider/model_sdwan_attach_feature_device_template.go +++ b/internal/provider/model_sdwan_attach_feature_device_template.go @@ -326,3 +326,7 @@ func (data *AttachFeatureDeviceTemplate) getUpdatedDevices(ctx context.Context, } return updatedDevices } + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_block_url_list_policy_object.go b/internal/provider/model_sdwan_block_url_list_policy_object.go index daa916b32..f75d3c7e5 100644 --- a/internal/provider/model_sdwan_block_url_list_policy_object.go +++ b/internal/provider/model_sdwan_block_url_list_policy_object.go @@ -124,3 +124,10 @@ func (data *BlockURLListPolicyObject) hasChanges(ctx context.Context, state *Blo // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *BlockURLListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_centralized_policy.go b/internal/provider/model_sdwan_centralized_policy.go index de66c32ba..a1d629a3a 100644 --- a/internal/provider/model_sdwan_centralized_policy.go +++ b/internal/provider/model_sdwan_centralized_policy.go @@ -300,3 +300,26 @@ func (data *CentralizedPolicy) updateVersions(ctx context.Context, state *Centra } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *CentralizedPolicy) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + for i := range data.Definitions { + if data.Definitions[i].Id != types.StringNull() { + data.Definitions[i].Version = types.Int64Value(0) + } + for ii := range data.Definitions[i].Entries { + if !data.Definitions[i].Entries[ii].SiteListIds.IsNull() { + data.Definitions[i].Entries[ii].SiteListVersions = types.ListNull(types.StringType) + } + if !data.Definitions[i].Entries[ii].VpnListIds.IsNull() { + data.Definitions[i].Entries[ii].VpnListVersions = types.ListNull(types.StringType) + } + if !data.Definitions[i].Entries[ii].RegionListIds.IsNull() { + data.Definitions[i].Entries[ii].RegionListVersions = types.ListNull(types.StringType) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_cflowd_policy_definition.go b/internal/provider/model_sdwan_cflowd_policy_definition.go index 358f24ba5..363dcc15e 100644 --- a/internal/provider/model_sdwan_cflowd_policy_definition.go +++ b/internal/provider/model_sdwan_cflowd_policy_definition.go @@ -330,3 +330,11 @@ func (data *CflowdPolicyDefinition) hasChanges(ctx context.Context, state *Cflow // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *CflowdPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("cflowd") +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_class_map_policy_object.go b/internal/provider/model_sdwan_class_map_policy_object.go index 502144545..4bd5fb6cc 100644 --- a/internal/provider/model_sdwan_class_map_policy_object.go +++ b/internal/provider/model_sdwan_class_map_policy_object.go @@ -96,3 +96,10 @@ func (data *ClassMapPolicyObject) hasChanges(ctx context.Context, state *ClassMa // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ClassMapPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_cli_device_template.go b/internal/provider/model_sdwan_cli_device_template.go index 66663cc6b..cfa8d421e 100644 --- a/internal/provider/model_sdwan_cli_device_template.go +++ b/internal/provider/model_sdwan_cli_device_template.go @@ -134,3 +134,10 @@ func (data *CLIDeviceTemplate) hasChanges(ctx context.Context, state *CLIDeviceT // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *CLIDeviceTemplate) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_color_list_policy_object.go b/internal/provider/model_sdwan_color_list_policy_object.go index dded11d08..3f2a148cb 100644 --- a/internal/provider/model_sdwan_color_list_policy_object.go +++ b/internal/provider/model_sdwan_color_list_policy_object.go @@ -124,3 +124,10 @@ func (data *ColorListPolicyObject) hasChanges(ctx context.Context, state *ColorL // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ColorListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_custom_control_topology_policy_definition.go b/internal/provider/model_sdwan_custom_control_topology_policy_definition.go index af177fb37..eb49ee628 100644 --- a/internal/provider/model_sdwan_custom_control_topology_policy_definition.go +++ b/internal/provider/model_sdwan_custom_control_topology_policy_definition.go @@ -878,3 +878,49 @@ func (data *CustomControlTopologyPolicyDefinition) updateVersions(ctx context.Co } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *CustomControlTopologyPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("control") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].ColorListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ColorListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].CommunityListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].CommunityListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].ExpandedCommunityListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ExpandedCommunityListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].SiteListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SiteListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].TlocListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].TlocListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].VpnListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].VpnListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].PrefixListVersion = types.Int64Value(0) + } + } + for ii := range data.Sequences[i].ActionEntries { + for iii := range data.Sequences[i].ActionEntries[ii].SetParameters { + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].ServiceTlocListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].ServiceTlocListVersion = types.Int64Value(0) + } + } + if data.Sequences[i].ActionEntries[ii].ExportToVpnListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].ExportToVpnListVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_data_fqdn_prefix_list_policy_object.go b/internal/provider/model_sdwan_data_fqdn_prefix_list_policy_object.go index 1a6be6507..8b800bea7 100644 --- a/internal/provider/model_sdwan_data_fqdn_prefix_list_policy_object.go +++ b/internal/provider/model_sdwan_data_fqdn_prefix_list_policy_object.go @@ -124,3 +124,10 @@ func (data *DataFQDNPrefixListPolicyObject) hasChanges(ctx context.Context, stat // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *DataFQDNPrefixListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_data_ipv4_prefix_list_policy_object.go b/internal/provider/model_sdwan_data_ipv4_prefix_list_policy_object.go index 7a659fa23..d287e63d6 100644 --- a/internal/provider/model_sdwan_data_ipv4_prefix_list_policy_object.go +++ b/internal/provider/model_sdwan_data_ipv4_prefix_list_policy_object.go @@ -124,3 +124,10 @@ func (data *DataIPv4PrefixListPolicyObject) hasChanges(ctx context.Context, stat // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *DataIPv4PrefixListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_data_ipv6_prefix_list_policy_object.go b/internal/provider/model_sdwan_data_ipv6_prefix_list_policy_object.go index 3a03f1619..019a0e60e 100644 --- a/internal/provider/model_sdwan_data_ipv6_prefix_list_policy_object.go +++ b/internal/provider/model_sdwan_data_ipv6_prefix_list_policy_object.go @@ -124,3 +124,10 @@ func (data *DataIPv6PrefixListPolicyObject) hasChanges(ctx context.Context, stat // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *DataIPv6PrefixListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_dns_security_policy_definition.go b/internal/provider/model_sdwan_dns_security_policy_definition.go index 13a71415d..1ee1bd4a1 100644 --- a/internal/provider/model_sdwan_dns_security_policy_definition.go +++ b/internal/provider/model_sdwan_dns_security_policy_definition.go @@ -316,3 +316,16 @@ func (data *DNSSecurityPolicyDefinition) updateVersions(ctx context.Context, sta } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *DNSSecurityPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.DomainListId != types.StringNull() { + data.DomainListVersion = types.Int64Value(0) + } + if data.CiscoSigCredentialsFeatureTemplateId != types.StringNull() { + data.CiscoSigCredentialsFeatureTemplateVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_domain_list_policy_object.go b/internal/provider/model_sdwan_domain_list_policy_object.go index 9a160a948..f6c21514f 100644 --- a/internal/provider/model_sdwan_domain_list_policy_object.go +++ b/internal/provider/model_sdwan_domain_list_policy_object.go @@ -124,3 +124,10 @@ func (data *DomainListPolicyObject) hasChanges(ctx context.Context, state *Domai // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *DomainListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_expanded_community_list_policy_object.go b/internal/provider/model_sdwan_expanded_community_list_policy_object.go index 867719742..786166cdc 100644 --- a/internal/provider/model_sdwan_expanded_community_list_policy_object.go +++ b/internal/provider/model_sdwan_expanded_community_list_policy_object.go @@ -124,3 +124,10 @@ func (data *ExpandedCommunityListPolicyObject) hasChanges(ctx context.Context, s // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ExpandedCommunityListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_extended_community_list_policy_object.go b/internal/provider/model_sdwan_extended_community_list_policy_object.go index d09175c4f..2f6ad222a 100644 --- a/internal/provider/model_sdwan_extended_community_list_policy_object.go +++ b/internal/provider/model_sdwan_extended_community_list_policy_object.go @@ -124,3 +124,10 @@ func (data *ExtendedCommunityListPolicyObject) hasChanges(ctx context.Context, s // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ExtendedCommunityListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_feature_device_template.go b/internal/provider/model_sdwan_feature_device_template.go index 1a123c02e..65feb0b12 100644 --- a/internal/provider/model_sdwan_feature_device_template.go +++ b/internal/provider/model_sdwan_feature_device_template.go @@ -373,3 +373,31 @@ func (data *FeatureDeviceTemplate) updateVersions(ctx context.Context, state *Fe } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *FeatureDeviceTemplate) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.PolicyId != types.StringNull() { + data.PolicyVersion = types.Int64Value(0) + } + if data.SecurityPolicyId != types.StringNull() { + data.SecurityPolicyVersion = types.Int64Value(0) + } + for i := range data.GeneralTemplates { + if data.GeneralTemplates[i].Id != types.StringNull() { + data.GeneralTemplates[i].Version = types.Int64Value(0) + } + for ii := range data.GeneralTemplates[i].SubTemplates { + if data.GeneralTemplates[i].SubTemplates[ii].Id != types.StringNull() { + data.GeneralTemplates[i].SubTemplates[ii].Version = types.Int64Value(0) + } + for iii := range data.GeneralTemplates[i].SubTemplates[ii].SubTemplates { + if data.GeneralTemplates[i].SubTemplates[ii].SubTemplates[iii].Id != types.StringNull() { + data.GeneralTemplates[i].SubTemplates[ii].SubTemplates[iii].Version = types.Int64Value(0) + } + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_geo_location_list_policy_object.go b/internal/provider/model_sdwan_geo_location_list_policy_object.go index 5566c6982..5595e3fcd 100644 --- a/internal/provider/model_sdwan_geo_location_list_policy_object.go +++ b/internal/provider/model_sdwan_geo_location_list_policy_object.go @@ -136,3 +136,10 @@ func (data *GeoLocationListPolicyObject) hasChanges(ctx context.Context, state * // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *GeoLocationListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_hub_and_spoke_topology_policy_definition.go b/internal/provider/model_sdwan_hub_and_spoke_topology_policy_definition.go index ea947eea8..1bab42c2c 100644 --- a/internal/provider/model_sdwan_hub_and_spoke_topology_policy_definition.go +++ b/internal/provider/model_sdwan_hub_and_spoke_topology_policy_definition.go @@ -381,3 +381,26 @@ func (data *HubAndSpokeTopologyPolicyDefinition) updateVersions(ctx context.Cont } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *HubAndSpokeTopologyPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("hubAndSpoke") + if data.VpnListId != types.StringNull() { + data.VpnListVersion = types.Int64Value(0) + } + for i := range data.Topologies { + for ii := range data.Topologies[i].Spokes { + if data.Topologies[i].Spokes[ii].SiteListId != types.StringNull() { + data.Topologies[i].Spokes[ii].SiteListVersion = types.Int64Value(0) + } + for iii := range data.Topologies[i].Spokes[ii].Hubs { + if data.Topologies[i].Spokes[ii].Hubs[iii].SiteListId != types.StringNull() { + data.Topologies[i].Spokes[ii].Hubs[iii].SiteListVersion = types.Int64Value(0) + } + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_intrusion_prevention_policy_definition.go b/internal/provider/model_sdwan_intrusion_prevention_policy_definition.go index 418e51535..142b45637 100644 --- a/internal/provider/model_sdwan_intrusion_prevention_policy_definition.go +++ b/internal/provider/model_sdwan_intrusion_prevention_policy_definition.go @@ -250,3 +250,13 @@ func (data *IntrusionPreventionPolicyDefinition) updateVersions(ctx context.Cont } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IntrusionPreventionPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.IpsSignatureListId != types.StringNull() { + data.IpsSignatureListVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ips_signature_list_policy_object.go b/internal/provider/model_sdwan_ips_signature_list_policy_object.go index 4f4802b20..99211f124 100644 --- a/internal/provider/model_sdwan_ips_signature_list_policy_object.go +++ b/internal/provider/model_sdwan_ips_signature_list_policy_object.go @@ -137,3 +137,10 @@ func (data *IPSSignatureListPolicyObject) hasChanges(ctx context.Context, state // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPSSignatureListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv4_acl_policy_definition.go b/internal/provider/model_sdwan_ipv4_acl_policy_definition.go index 03c8a10b1..257077405 100644 --- a/internal/provider/model_sdwan_ipv4_acl_policy_definition.go +++ b/internal/provider/model_sdwan_ipv4_acl_policy_definition.go @@ -645,3 +645,35 @@ func (data *IPv4ACLPolicyDefinition) updateVersions(ctx context.Context, state * } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv4ACLPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("acl") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].ClassMapId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ClassMapVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].SourceDataIpv4PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataIpv4PrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataIpv4PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataIpv4PrefixListVersion = types.Int64Value(0) + } + } + for ii := range data.Sequences[i].ActionEntries { + if data.Sequences[i].ActionEntries[ii].ClassMapId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].ClassMapVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].MirrorId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].MirrorVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].PolicerId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].PolicerVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv4_device_acl_policy_definition.go b/internal/provider/model_sdwan_ipv4_device_acl_policy_definition.go index cd97568e6..0ff8886ee 100644 --- a/internal/provider/model_sdwan_ipv4_device_acl_policy_definition.go +++ b/internal/provider/model_sdwan_ipv4_device_acl_policy_definition.go @@ -407,3 +407,21 @@ func (data *IPv4DeviceACLPolicyDefinition) updateVersions(ctx context.Context, s } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv4DeviceACLPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("deviceAccessPolicy") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].SourceDataIpv4PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataIpv4PrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataIpv4PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataIpv4PrefixListVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv4_prefix_list_policy_object.go b/internal/provider/model_sdwan_ipv4_prefix_list_policy_object.go index 5e38b50b3..c7d83e480 100644 --- a/internal/provider/model_sdwan_ipv4_prefix_list_policy_object.go +++ b/internal/provider/model_sdwan_ipv4_prefix_list_policy_object.go @@ -149,3 +149,10 @@ func (data *IPv4PrefixListPolicyObject) hasChanges(ctx context.Context, state *I // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv4PrefixListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv6_acl_policy_definition.go b/internal/provider/model_sdwan_ipv6_acl_policy_definition.go index 0f09b143e..0bb32898b 100644 --- a/internal/provider/model_sdwan_ipv6_acl_policy_definition.go +++ b/internal/provider/model_sdwan_ipv6_acl_policy_definition.go @@ -612,3 +612,35 @@ func (data *IPv6ACLPolicyDefinition) updateVersions(ctx context.Context, state * } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv6ACLPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("aclv6") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].ClassMapId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ClassMapVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].SourceDataIpv6PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataIpv6PrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataIpv6PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataIpv6PrefixListVersion = types.Int64Value(0) + } + } + for ii := range data.Sequences[i].ActionEntries { + if data.Sequences[i].ActionEntries[ii].ClassMapId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].ClassMapVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].MirrorId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].MirrorVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].PolicerId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].PolicerVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv6_device_acl_policy_definition.go b/internal/provider/model_sdwan_ipv6_device_acl_policy_definition.go index ab8482c9e..f7b657980 100644 --- a/internal/provider/model_sdwan_ipv6_device_acl_policy_definition.go +++ b/internal/provider/model_sdwan_ipv6_device_acl_policy_definition.go @@ -386,3 +386,21 @@ func (data *IPv6DeviceACLPolicyDefinition) updateVersions(ctx context.Context, s } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv6DeviceACLPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("deviceAccessPolicyv6") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].SourceDataIpv6PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataIpv6PrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataIpv6PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataIpv6PrefixListVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_ipv6_prefix_list_policy_object.go b/internal/provider/model_sdwan_ipv6_prefix_list_policy_object.go index 6772b0bec..14918161d 100644 --- a/internal/provider/model_sdwan_ipv6_prefix_list_policy_object.go +++ b/internal/provider/model_sdwan_ipv6_prefix_list_policy_object.go @@ -149,3 +149,10 @@ func (data *IPv6PrefixListPolicyObject) hasChanges(ctx context.Context, state *I // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *IPv6PrefixListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_local_application_list_policy_object.go b/internal/provider/model_sdwan_local_application_list_policy_object.go index 0aeba1b80..c1663bef4 100644 --- a/internal/provider/model_sdwan_local_application_list_policy_object.go +++ b/internal/provider/model_sdwan_local_application_list_policy_object.go @@ -136,3 +136,10 @@ func (data *LocalApplicationListPolicyObject) hasChanges(ctx context.Context, st // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *LocalApplicationListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_localized_policy.go b/internal/provider/model_sdwan_localized_policy.go index 1a5c4ecb3..b24c94340 100644 --- a/internal/provider/model_sdwan_localized_policy.go +++ b/internal/provider/model_sdwan_localized_policy.go @@ -347,3 +347,15 @@ func (data *LocalizedPolicy) updateVersions(ctx context.Context, state *Localize } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *LocalizedPolicy) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + for i := range data.Definitions { + if data.Definitions[i].Id != types.StringNull() { + data.Definitions[i].Version = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_mesh_topology_policy_definition.go b/internal/provider/model_sdwan_mesh_topology_policy_definition.go index d76fe1148..ea468407a 100644 --- a/internal/provider/model_sdwan_mesh_topology_policy_definition.go +++ b/internal/provider/model_sdwan_mesh_topology_policy_definition.go @@ -189,3 +189,19 @@ func (data *MeshTopologyPolicyDefinition) updateVersions(ctx context.Context, st } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *MeshTopologyPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("mesh") + if data.VpnListId != types.StringNull() { + data.VpnListVersion = types.Int64Value(0) + } + for i := range data.Regions { + if !data.Regions[i].SiteListIds.IsNull() { + data.Regions[i].SiteListVersions = types.ListNull(types.StringType) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_mirror_policy_object.go b/internal/provider/model_sdwan_mirror_policy_object.go index 44a0a77f9..b510f66ad 100644 --- a/internal/provider/model_sdwan_mirror_policy_object.go +++ b/internal/provider/model_sdwan_mirror_policy_object.go @@ -107,3 +107,10 @@ func (data *MirrorPolicyObject) hasChanges(ctx context.Context, state *MirrorPol // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *MirrorPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_object_group_policy_definition.go b/internal/provider/model_sdwan_object_group_policy_definition.go index d7c134daf..bbae06db8 100644 --- a/internal/provider/model_sdwan_object_group_policy_definition.go +++ b/internal/provider/model_sdwan_object_group_policy_definition.go @@ -216,3 +216,22 @@ func (data *ObjectGroupPolicyDefinition) updateVersions(ctx context.Context, sta } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ObjectGroupPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.DataIpv4PrefixListId != types.StringNull() { + data.DataIpv4PrefixListVersion = types.Int64Value(0) + } + if data.DataFqdnPrefixListId != types.StringNull() { + data.DataFqdnPrefixListVersion = types.Int64Value(0) + } + if data.PortListId != types.StringNull() { + data.PortListVersion = types.Int64Value(0) + } + if data.GeoLocationListId != types.StringNull() { + data.GeoLocationListVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_other_feature_profile.go b/internal/provider/model_sdwan_other_feature_profile.go index 18866e160..9ecdb9cde 100644 --- a/internal/provider/model_sdwan_other_feature_profile.go +++ b/internal/provider/model_sdwan_other_feature_profile.go @@ -91,3 +91,9 @@ func (data *OtherFeatureProfile) hasChanges(ctx context.Context, state *OtherFea // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *OtherFeatureProfile) processImport(ctx context.Context) { +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_policer_policy_object.go b/internal/provider/model_sdwan_policer_policy_object.go index 9fddb634f..dda9fa147 100644 --- a/internal/provider/model_sdwan_policer_policy_object.go +++ b/internal/provider/model_sdwan_policer_policy_object.go @@ -120,3 +120,10 @@ func (data *PolicerPolicyObject) hasChanges(ctx context.Context, state *PolicerP // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *PolicerPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_port_list_policy_object.go b/internal/provider/model_sdwan_port_list_policy_object.go index eaae4bb04..b47f75306 100644 --- a/internal/provider/model_sdwan_port_list_policy_object.go +++ b/internal/provider/model_sdwan_port_list_policy_object.go @@ -125,3 +125,10 @@ func (data *PortListPolicyObject) hasChanges(ctx context.Context, state *PortLis // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *PortListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_preferred_color_group_policy_object.go b/internal/provider/model_sdwan_preferred_color_group_policy_object.go index aee75650a..4c01af82b 100644 --- a/internal/provider/model_sdwan_preferred_color_group_policy_object.go +++ b/internal/provider/model_sdwan_preferred_color_group_policy_object.go @@ -155,3 +155,10 @@ func (data *PreferredColorGroupPolicyObject) hasChanges(ctx context.Context, sta // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *PreferredColorGroupPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_protocol_list_policy_object.go b/internal/provider/model_sdwan_protocol_list_policy_object.go index eacb335d8..21a8d1704 100644 --- a/internal/provider/model_sdwan_protocol_list_policy_object.go +++ b/internal/provider/model_sdwan_protocol_list_policy_object.go @@ -124,3 +124,10 @@ func (data *ProtocolListPolicyObject) hasChanges(ctx context.Context, state *Pro // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ProtocolListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_qos_map_policy_definition.go b/internal/provider/model_sdwan_qos_map_policy_definition.go index 99d6b76a0..e508cc1fc 100644 --- a/internal/provider/model_sdwan_qos_map_policy_definition.go +++ b/internal/provider/model_sdwan_qos_map_policy_definition.go @@ -232,3 +232,16 @@ func (data *QoSMapPolicyDefinition) updateVersions(ctx context.Context, state *Q } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *QoSMapPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("qosMap") + for i := range data.QosSchedulers { + if data.QosSchedulers[i].ClassMapId != types.StringNull() { + data.QosSchedulers[i].ClassMapVersion = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_region_list_policy_object.go b/internal/provider/model_sdwan_region_list_policy_object.go index 616dca0fe..29ab66e54 100644 --- a/internal/provider/model_sdwan_region_list_policy_object.go +++ b/internal/provider/model_sdwan_region_list_policy_object.go @@ -124,3 +124,10 @@ func (data *RegionListPolicyObject) hasChanges(ctx context.Context, state *Regio // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *RegionListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_rewrite_rule_policy_definition.go b/internal/provider/model_sdwan_rewrite_rule_policy_definition.go index c2e824f16..5fc40fbe9 100644 --- a/internal/provider/model_sdwan_rewrite_rule_policy_definition.go +++ b/internal/provider/model_sdwan_rewrite_rule_policy_definition.go @@ -196,3 +196,16 @@ func (data *RewriteRulePolicyDefinition) updateVersions(ctx context.Context, sta } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *RewriteRulePolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("rewriteRule") + for i := range data.Rules { + if data.Rules[i].ClassMapId != types.StringNull() { + data.Rules[i].ClassMapVersion = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_route_policy_definition.go b/internal/provider/model_sdwan_route_policy_definition.go index 33b03f9e5..200d3ff72 100644 --- a/internal/provider/model_sdwan_route_policy_definition.go +++ b/internal/provider/model_sdwan_route_policy_definition.go @@ -729,3 +729,33 @@ func (data *RoutePolicyDefinition) updateVersions(ctx context.Context, state *Ro } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *RoutePolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("vedgeRoute") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].PrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].PrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].AsPathListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].AsPathListVersion = types.Int64Value(0) + } + if !data.Sequences[i].MatchEntries[ii].CommunityListIds.IsNull() { + data.Sequences[i].MatchEntries[ii].CommunityListVersions = types.ListNull(types.StringType) + } + if data.Sequences[i].MatchEntries[ii].ExpandedCommunityListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ExpandedCommunityListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].ExtendedCommunityListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ExtendedCommunityListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].NextHopPrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].NextHopPrefixListVersion = types.Int64Value(0) + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_rule_set_policy_definition.go b/internal/provider/model_sdwan_rule_set_policy_definition.go index a30b55d95..a60a1a1fa 100644 --- a/internal/provider/model_sdwan_rule_set_policy_definition.go +++ b/internal/provider/model_sdwan_rule_set_policy_definition.go @@ -510,3 +510,45 @@ func (data *RuleSetPolicyDefinition) updateVersions(ctx context.Context, state * } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *RuleSetPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + for i := range data.Rules { + if data.Rules[i].SourceObjectGroupId != types.StringNull() { + data.Rules[i].SourceObjectGroupVersion = types.Int64Value(0) + } + if data.Rules[i].SourceDataIpv4PrefixListId != types.StringNull() { + data.Rules[i].SourceDataIpv4PrefixListVersion = types.Int64Value(0) + } + if data.Rules[i].SourceDataFqdnPrefixListId != types.StringNull() { + data.Rules[i].SourceDataFqdnPrefixListVersion = types.Int64Value(0) + } + if data.Rules[i].SourcePortListId != types.StringNull() { + data.Rules[i].SourcePortListVersion = types.Int64Value(0) + } + if data.Rules[i].SourceGeoLocationListId != types.StringNull() { + data.Rules[i].SourceGeoLocationListVersion = types.Int64Value(0) + } + if data.Rules[i].DestinationObjectGroupId != types.StringNull() { + data.Rules[i].DestinationObjectGroupVersion = types.Int64Value(0) + } + if data.Rules[i].DestinationDataIpv4PrefixListId != types.StringNull() { + data.Rules[i].DestinationDataIpv4PrefixListVersion = types.Int64Value(0) + } + if data.Rules[i].DestinationDataFqdnPrefixListId != types.StringNull() { + data.Rules[i].DestinationDataFqdnPrefixListVersion = types.Int64Value(0) + } + if data.Rules[i].DestinationPortListId != types.StringNull() { + data.Rules[i].DestinationPortListVersion = types.Int64Value(0) + } + if data.Rules[i].DestinationGeoLocationListId != types.StringNull() { + data.Rules[i].DestinationGeoLocationListVersion = types.Int64Value(0) + } + if data.Rules[i].ProtocolListId != types.StringNull() { + data.Rules[i].ProtocolListVersion = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_security_policy.go b/internal/provider/model_sdwan_security_policy.go index 7f1635811..ceccc15d4 100644 --- a/internal/provider/model_sdwan_security_policy.go +++ b/internal/provider/model_sdwan_security_policy.go @@ -488,3 +488,15 @@ func (data *SecurityPolicy) updateVersions(ctx context.Context, state *SecurityP } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *SecurityPolicy) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + for i := range data.Definitions { + if data.Definitions[i].Id != types.StringNull() { + data.Definitions[i].Version = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_site_list_policy_object.go b/internal/provider/model_sdwan_site_list_policy_object.go index dacb566bc..bd5efbf17 100644 --- a/internal/provider/model_sdwan_site_list_policy_object.go +++ b/internal/provider/model_sdwan_site_list_policy_object.go @@ -124,3 +124,10 @@ func (data *SiteListPolicyObject) hasChanges(ctx context.Context, state *SiteLis // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *SiteListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_sla_class_policy_object.go b/internal/provider/model_sdwan_sla_class_policy_object.go index 2580fa953..3da0dd163 100644 --- a/internal/provider/model_sdwan_sla_class_policy_object.go +++ b/internal/provider/model_sdwan_sla_class_policy_object.go @@ -187,3 +187,13 @@ func (data *SLAClassPolicyObject) updateVersions(ctx context.Context, state *SLA } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *SLAClassPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.AppProbeClassId != types.StringNull() { + data.AppProbeClassVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_standard_community_list_policy_object.go b/internal/provider/model_sdwan_standard_community_list_policy_object.go index 9dfe9202f..ffb7dec09 100644 --- a/internal/provider/model_sdwan_standard_community_list_policy_object.go +++ b/internal/provider/model_sdwan_standard_community_list_policy_object.go @@ -124,3 +124,10 @@ func (data *StandardCommunityListPolicyObject) hasChanges(ctx context.Context, s // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *StandardCommunityListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_tloc_list_policy_object.go b/internal/provider/model_sdwan_tloc_list_policy_object.go index e88c7ad67..26f6c0018 100644 --- a/internal/provider/model_sdwan_tloc_list_policy_object.go +++ b/internal/provider/model_sdwan_tloc_list_policy_object.go @@ -161,3 +161,10 @@ func (data *TLOCListPolicyObject) hasChanges(ctx context.Context, state *TLOCLis // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *TLOCListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_tls_ssl_decryption_policy_definition.go b/internal/provider/model_sdwan_tls_ssl_decryption_policy_definition.go index afd74d7af..5c351ba59 100644 --- a/internal/provider/model_sdwan_tls_ssl_decryption_policy_definition.go +++ b/internal/provider/model_sdwan_tls_ssl_decryption_policy_definition.go @@ -63,10 +63,10 @@ type TLSSSLDecryptionPolicyDefinitionNetworkRules struct { } type TLSSSLDecryptionPolicyDefinitionUrlRules struct { - RuleName types.String `tfsdk:"rule_name"` - TargetVpns types.Set `tfsdk:"target_vpns"` - TlsSslProfilePolicyId types.String `tfsdk:"tls_ssl_profile_policy_id"` - TlsSslProfileVersion types.Int64 `tfsdk:"tls_ssl_profile_version"` + RuleName types.String `tfsdk:"rule_name"` + TargetVpns types.Set `tfsdk:"target_vpns"` + TlsSslProfilePolicyId types.String `tfsdk:"tls_ssl_profile_policy_id"` + TlsSslProfilePolicyVersion types.Int64 `tfsdk:"tls_ssl_profile_policy_version"` } type TLSSSLDecryptionPolicyDefinitionNetworkRulesSourceAndDestinationConfiguration struct { @@ -495,11 +495,23 @@ func (data *TLSSSLDecryptionPolicyDefinition) updateVersions(ctx context.Context } } if stateIndex > -1 { - data.UrlRules[i].TlsSslProfileVersion = state.UrlRules[stateIndex].TlsSslProfileVersion + data.UrlRules[i].TlsSslProfilePolicyVersion = state.UrlRules[stateIndex].TlsSslProfilePolicyVersion } else { - data.UrlRules[i].TlsSslProfileVersion = types.Int64Null() + data.UrlRules[i].TlsSslProfilePolicyVersion = types.Int64Null() } } } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *TLSSSLDecryptionPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + for i := range data.UrlRules { + if data.UrlRules[i].TlsSslProfilePolicyId != types.StringNull() { + data.UrlRules[i].TlsSslProfilePolicyVersion = types.Int64Value(0) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_tls_ssl_profile_policy_definition.go b/internal/provider/model_sdwan_tls_ssl_profile_policy_definition.go index 09c8c4e98..cc5bf2322 100644 --- a/internal/provider/model_sdwan_tls_ssl_profile_policy_definition.go +++ b/internal/provider/model_sdwan_tls_ssl_profile_policy_definition.go @@ -235,3 +235,16 @@ func (data *TLSSSLProfilePolicyDefinition) updateVersions(ctx context.Context, s } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *TLSSSLProfilePolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.AllowUrlListId != types.StringNull() { + data.AllowUrlListVersion = types.Int64Value(0) + } + if data.BlockUrlListId != types.StringNull() { + data.BlockUrlListVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_traffic_data_policy_definition.go b/internal/provider/model_sdwan_traffic_data_policy_definition.go index 6f8718841..7a03f3ff9 100644 --- a/internal/provider/model_sdwan_traffic_data_policy_definition.go +++ b/internal/provider/model_sdwan_traffic_data_policy_definition.go @@ -108,7 +108,7 @@ type TrafficDataPolicyDefinitionSequencesActionEntriesSetParameters struct { NextHopLoose types.Bool `tfsdk:"next_hop_loose"` PolicerListId types.String `tfsdk:"policer_list_id"` PolicerListVersion types.Int64 `tfsdk:"policer_list_version"` - PreferredColorGroupList types.String `tfsdk:"preferred_color_group_list"` + PreferredColorGroupListId types.String `tfsdk:"preferred_color_group_list_id"` PreferredColorGroupListVersion types.Int64 `tfsdk:"preferred_color_group_list_version"` TlocListId types.String `tfsdk:"tloc_list_id"` TlocListVersion types.Int64 `tfsdk:"tloc_list_version"` @@ -343,8 +343,8 @@ func (data TrafficDataPolicyDefinition) toBody(ctx context.Context) string { if !childChildItem.PolicerListId.IsNull() && childChildItem.Type.ValueString() == "policer" { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.PolicerListId.ValueString()) } - if !childChildItem.PreferredColorGroupList.IsNull() && childChildItem.Type.ValueString() == "preferredColorGroup" { - itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.PreferredColorGroupList.ValueString()) + if !childChildItem.PreferredColorGroupListId.IsNull() && childChildItem.Type.ValueString() == "preferredColorGroup" { + itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.PreferredColorGroupListId.ValueString()) } if !childChildItem.TlocListId.IsNull() && childChildItem.Type.ValueString() == "tlocList" { itemChildChildBody, _ = sjson.Set(itemChildChildBody, "ref", childChildItem.TlocListId.ValueString()) @@ -734,9 +734,9 @@ func (data *TrafficDataPolicyDefinition) fromBody(ctx context.Context, res gjson ccItem.PolicerListId = types.StringNull() } if cccValue := ccv.Get("ref"); cccValue.Exists() && ccItem.Type.ValueString() == "preferredColorGroup" { - ccItem.PreferredColorGroupList = types.StringValue(cccValue.String()) + ccItem.PreferredColorGroupListId = types.StringValue(cccValue.String()) } else { - ccItem.PreferredColorGroupList = types.StringNull() + ccItem.PreferredColorGroupListId = types.StringNull() } if cccValue := ccv.Get("ref"); cccValue.Exists() && ccItem.Type.ValueString() == "tlocList" { ccItem.TlocListId = types.StringValue(cccValue.String()) @@ -1047,7 +1047,7 @@ func (data *TrafficDataPolicyDefinition) hasChanges(ctx context.Context, state * if !data.Sequences[i].ActionEntries[ii].SetParameters[iii].PolicerListId.Equal(state.Sequences[i].ActionEntries[ii].SetParameters[iii].PolicerListId) { hasChanges = true } - if !data.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupList.Equal(state.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupList) { + if !data.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupListId.Equal(state.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupListId) { hasChanges = true } if !data.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListId.Equal(state.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListId) { @@ -1211,3 +1211,43 @@ func (data *TrafficDataPolicyDefinition) updateVersions(ctx context.Context, sta } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *TrafficDataPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("data") + for i := range data.Sequences { + for ii := range data.Sequences[i].MatchEntries { + if data.Sequences[i].MatchEntries[ii].ApplicationListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].ApplicationListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DnsApplicationListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DnsApplicationListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].SourceDataPrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].SourceDataPrefixListVersion = types.Int64Value(0) + } + if data.Sequences[i].MatchEntries[ii].DestinationDataPrefixListId != types.StringNull() { + data.Sequences[i].MatchEntries[ii].DestinationDataPrefixListVersion = types.Int64Value(0) + } + } + for ii := range data.Sequences[i].ActionEntries { + for iii := range data.Sequences[i].ActionEntries[ii].SetParameters { + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].PolicerListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].PolicerListVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].PreferredColorGroupListVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].TlocListVersion = types.Int64Value(0) + } + if data.Sequences[i].ActionEntries[ii].SetParameters[iii].ServiceTlocListId != types.StringNull() { + data.Sequences[i].ActionEntries[ii].SetParameters[iii].ServiceTlocListVersion = types.Int64Value(0) + } + } + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_url_filtering_policy_definition.go b/internal/provider/model_sdwan_url_filtering_policy_definition.go index 750f7ac3d..51a6abcd2 100644 --- a/internal/provider/model_sdwan_url_filtering_policy_definition.go +++ b/internal/provider/model_sdwan_url_filtering_policy_definition.go @@ -284,3 +284,16 @@ func (data *URLFilteringPolicyDefinition) updateVersions(ctx context.Context, st } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *URLFilteringPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + if data.AllowUrlListId != types.StringNull() { + data.AllowUrlListVersion = types.Int64Value(0) + } + if data.BlockUrlListId != types.StringNull() { + data.BlockUrlListVersion = types.Int64Value(0) + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_vpn_list_policy_object.go b/internal/provider/model_sdwan_vpn_list_policy_object.go index 62a0763e4..909663cfd 100644 --- a/internal/provider/model_sdwan_vpn_list_policy_object.go +++ b/internal/provider/model_sdwan_vpn_list_policy_object.go @@ -124,3 +124,10 @@ func (data *VPNListPolicyObject) hasChanges(ctx context.Context, state *VPNListP // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *VPNListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_vpn_membership_policy_definition.go b/internal/provider/model_sdwan_vpn_membership_policy_definition.go index d3dec0b57..746b8470b 100644 --- a/internal/provider/model_sdwan_vpn_membership_policy_definition.go +++ b/internal/provider/model_sdwan_vpn_membership_policy_definition.go @@ -181,3 +181,19 @@ func (data *VPNMembershipPolicyDefinition) updateVersions(ctx context.Context, s } // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *VPNMembershipPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) + data.Type = types.StringValue("vpnMembershipGroup") + for i := range data.Sites { + if data.Sites[i].SiteListId != types.StringNull() { + data.Sites[i].SiteListVersion = types.Int64Value(0) + } + if !data.Sites[i].VpnListIds.IsNull() { + data.Sites[i].VpnListVersions = types.ListNull(types.StringType) + } + } +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_zone_based_firewall_policy_definition.go b/internal/provider/model_sdwan_zone_based_firewall_policy_definition.go index 3a4c5df00..a3128bc6f 100644 --- a/internal/provider/model_sdwan_zone_based_firewall_policy_definition.go +++ b/internal/provider/model_sdwan_zone_based_firewall_policy_definition.go @@ -369,3 +369,10 @@ func (data *ZoneBasedFirewallPolicyDefinition) hasChanges(ctx context.Context, s // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ZoneBasedFirewallPolicyDefinition) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport diff --git a/internal/provider/model_sdwan_zone_list_policy_object.go b/internal/provider/model_sdwan_zone_list_policy_object.go index db5011fda..7028541f5 100644 --- a/internal/provider/model_sdwan_zone_list_policy_object.go +++ b/internal/provider/model_sdwan_zone_list_policy_object.go @@ -136,3 +136,10 @@ func (data *ZoneListPolicyObject) hasChanges(ctx context.Context, state *ZoneLis // Section below is generated&owned by "gen/generator.go". //template:begin updateVersions // End of section. //template:end updateVersions + +// Section below is generated&owned by "gen/generator.go". //template:begin processImport +func (data *ZoneListPolicyObject) processImport(ctx context.Context) { + data.Version = types.Int64Value(0) +} + +// End of section. //template:end processImport 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 a988c3b10..0a6cae22e 100644 --- a/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go +++ b/internal/provider/resource_sdwan_advanced_inspection_profile_policy_definition.go @@ -193,8 +193,13 @@ func (r *AdvancedInspectionProfilePolicyDefinitionResource) Read(ctx context.Con } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -282,6 +287,8 @@ func (r *AdvancedInspectionProfilePolicyDefinitionResource) Delete(ctx context.C // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *AdvancedInspectionProfilePolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 9f99f6e7a..fc1f61941 100644 --- a/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go +++ b/internal/provider/resource_sdwan_advanced_malware_protection_policy_definition.go @@ -217,8 +217,13 @@ func (r *AdvancedMalwareProtectionPolicyDefinitionResource) Read(ctx context.Con } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -306,6 +311,8 @@ func (r *AdvancedMalwareProtectionPolicyDefinitionResource) Delete(ctx context.C // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *AdvancedMalwareProtectionPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 f4ee0b66d..01eafd2ff 100644 --- a/internal/provider/resource_sdwan_allow_url_list_policy_object.go +++ b/internal/provider/resource_sdwan_allow_url_list_policy_object.go @@ -165,8 +165,13 @@ func (r *AllowURLListPolicyObjectResource) Read(ctx context.Context, req resourc } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *AllowURLListPolicyObjectResource) Delete(ctx context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *AllowURLListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 f19ebf487..6345f5d9b 100644 --- a/internal/provider/resource_sdwan_app_probe_class_policy_object.go +++ b/internal/provider/resource_sdwan_app_probe_class_policy_object.go @@ -177,8 +177,13 @@ func (r *AppProbeClassPolicyObjectResource) Read(ctx context.Context, req resour } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -265,6 +270,8 @@ func (r *AppProbeClassPolicyObjectResource) Delete(ctx context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *AppProbeClassPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 1ba9b2576..2cf67bde4 100644 --- a/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go +++ b/internal/provider/resource_sdwan_application_aware_routing_policy_definition.go @@ -254,7 +254,7 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Schema(ctx context.Con stringvalidator.OneOf("name", "preferredColor", "preferredColorGroup", "strict", "fallbackToBestPath"), }, }, - "sla_class_list": schema.StringAttribute{ + "sla_class_list_id": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("SLA class list ID, Attribute conditional on `type` being equal to `name`").String, Optional: true, }, @@ -262,7 +262,7 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Schema(ctx context.Con MarkdownDescription: helpers.NewAttributeDescription("SLA class list version").String, Optional: true, }, - "preferred_color_group_list": schema.StringAttribute{ + "preferred_color_group_list_id": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup`").String, Optional: true, }, @@ -354,8 +354,13 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Read(ctx context.Conte } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -442,6 +447,8 @@ func (r *ApplicationAwareRoutingPolicyDefinitionResource) Delete(ctx context.Con // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ApplicationAwareRoutingPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_application_list_policy_object.go b/internal/provider/resource_sdwan_application_list_policy_object.go index ef4134dec..86a1c98b2 100644 --- a/internal/provider/resource_sdwan_application_list_policy_object.go +++ b/internal/provider/resource_sdwan_application_list_policy_object.go @@ -169,8 +169,13 @@ func (r *ApplicationListPolicyObjectResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *ApplicationListPolicyObjectResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ApplicationListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_application_priority_feature_profile.go b/internal/provider/resource_sdwan_application_priority_feature_profile.go index e49a9637b..5962b836f 100644 --- a/internal/provider/resource_sdwan_application_priority_feature_profile.go +++ b/internal/provider/resource_sdwan_application_priority_feature_profile.go @@ -231,6 +231,8 @@ func (r *ApplicationPriorityFeatureProfileResource) Delete(ctx context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ApplicationPriorityFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 271c9930f..f9e7e4db3 100644 --- a/internal/provider/resource_sdwan_as_path_list_policy_object.go +++ b/internal/provider/resource_sdwan_as_path_list_policy_object.go @@ -165,8 +165,13 @@ func (r *ASPathListPolicyObjectResource) Read(ctx context.Context, req resource. } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *ASPathListPolicyObjectResource) Delete(ctx context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ASPathListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 0b9f6642d..bb146ee97 100644 --- a/internal/provider/resource_sdwan_block_url_list_policy_object.go +++ b/internal/provider/resource_sdwan_block_url_list_policy_object.go @@ -165,8 +165,13 @@ func (r *BlockURLListPolicyObjectResource) Read(ctx context.Context, req resourc } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *BlockURLListPolicyObjectResource) Delete(ctx context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *BlockURLListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_centralized_policy.go b/internal/provider/resource_sdwan_centralized_policy.go index ce9c295fd..2343ab49b 100644 --- a/internal/provider/resource_sdwan_centralized_policy.go +++ b/internal/provider/resource_sdwan_centralized_policy.go @@ -227,8 +227,13 @@ func (r *CentralizedPolicyResource) Read(ctx context.Context, req resource.ReadR } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -315,6 +320,8 @@ func (r *CentralizedPolicyResource) Delete(ctx context.Context, req resource.Del // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CentralizedPolicyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_cflowd_policy_definition.go b/internal/provider/resource_sdwan_cflowd_policy_definition.go index b0e86ff1c..78b3c90e8 100644 --- a/internal/provider/resource_sdwan_cflowd_policy_definition.go +++ b/internal/provider/resource_sdwan_cflowd_policy_definition.go @@ -258,8 +258,13 @@ func (r *CflowdPolicyDefinitionResource) Read(ctx context.Context, req resource. } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -346,6 +351,8 @@ func (r *CflowdPolicyDefinitionResource) Delete(ctx context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CflowdPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_class_map_policy_object.go b/internal/provider/resource_sdwan_class_map_policy_object.go index 543c3cf0c..5accd4f2c 100644 --- a/internal/provider/resource_sdwan_class_map_policy_object.go +++ b/internal/provider/resource_sdwan_class_map_policy_object.go @@ -157,8 +157,13 @@ func (r *ClassMapPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -245,6 +250,8 @@ func (r *ClassMapPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ClassMapPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_cli_config_feature.go b/internal/provider/resource_sdwan_cli_config_feature.go index baa6afe2f..71a0f8dfb 100644 --- a/internal/provider/resource_sdwan_cli_config_feature.go +++ b/internal/provider/resource_sdwan_cli_config_feature.go @@ -165,9 +165,6 @@ func (r *CLIConfigFeatureResource) Read(ctx context.Context, req resource.ReadRe } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -265,6 +262,8 @@ func (r *CLIConfigFeatureResource) ImportState(ctx context.Context, req resource resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_cli_device_template.go b/internal/provider/resource_sdwan_cli_device_template.go index 9698a67cd..6de52779a 100644 --- a/internal/provider/resource_sdwan_cli_device_template.go +++ b/internal/provider/resource_sdwan_cli_device_template.go @@ -169,8 +169,13 @@ func (r *CLIDeviceTemplateResource) Read(ctx context.Context, req resource.ReadR } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *CLIDeviceTemplateResource) Delete(ctx context.Context, req resource.Del // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CLIDeviceTemplateResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_cli_feature_profile.go b/internal/provider/resource_sdwan_cli_feature_profile.go index 920db1f9b..7b09aa6dd 100644 --- a/internal/provider/resource_sdwan_cli_feature_profile.go +++ b/internal/provider/resource_sdwan_cli_feature_profile.go @@ -231,6 +231,8 @@ func (r *CLIFeatureProfileResource) Delete(ctx context.Context, req resource.Del // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CLIFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_color_list_policy_object.go b/internal/provider/resource_sdwan_color_list_policy_object.go index fa799b308..0d6bc773c 100644 --- a/internal/provider/resource_sdwan_color_list_policy_object.go +++ b/internal/provider/resource_sdwan_color_list_policy_object.go @@ -169,8 +169,13 @@ func (r *ColorListPolicyObjectResource) Read(ctx context.Context, req resource.R } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *ColorListPolicyObjectResource) Delete(ctx context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ColorListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_configuration_group.go b/internal/provider/resource_sdwan_configuration_group.go index 698c54960..a775e54c1 100644 --- a/internal/provider/resource_sdwan_configuration_group.go +++ b/internal/provider/resource_sdwan_configuration_group.go @@ -552,6 +552,8 @@ func (r *ConfigurationGroupResource) Delete(ctx context.Context, req resource.De // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ConfigurationGroupResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 5a45e5cf6..e92878753 100644 --- a/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go +++ b/internal/provider/resource_sdwan_custom_control_topology_policy_definition.go @@ -487,8 +487,13 @@ func (r *CustomControlTopologyPolicyDefinitionResource) Read(ctx context.Context } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -575,6 +580,8 @@ func (r *CustomControlTopologyPolicyDefinitionResource) Delete(ctx context.Conte // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *CustomControlTopologyPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 274b7fbfc..a8f94143d 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 @@ -165,8 +165,13 @@ func (r *DataFQDNPrefixListPolicyObjectResource) Read(ctx context.Context, req r } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *DataFQDNPrefixListPolicyObjectResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DataFQDNPrefixListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 4e7dd8ead..9f64380e8 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 @@ -165,8 +165,13 @@ func (r *DataIPv4PrefixListPolicyObjectResource) Read(ctx context.Context, req r } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *DataIPv4PrefixListPolicyObjectResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DataIPv4PrefixListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 aabc11f7e..01ffb4cf9 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 @@ -165,8 +165,13 @@ func (r *DataIPv6PrefixListPolicyObjectResource) Read(ctx context.Context, req r } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *DataIPv6PrefixListPolicyObjectResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DataIPv6PrefixListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_dns_security_feature_profile.go b/internal/provider/resource_sdwan_dns_security_feature_profile.go index 7894dcd0e..aa87ddd1a 100644 --- a/internal/provider/resource_sdwan_dns_security_feature_profile.go +++ b/internal/provider/resource_sdwan_dns_security_feature_profile.go @@ -231,6 +231,8 @@ func (r *DNSSecurityFeatureProfileResource) Delete(ctx context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DNSSecurityFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_dns_security_policy_definition.go b/internal/provider/resource_sdwan_dns_security_policy_definition.go index 5d8726ea8..d3717dc1d 100644 --- a/internal/provider/resource_sdwan_dns_security_policy_definition.go +++ b/internal/provider/resource_sdwan_dns_security_policy_definition.go @@ -213,8 +213,13 @@ func (r *DNSSecurityPolicyDefinitionResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -302,6 +307,8 @@ func (r *DNSSecurityPolicyDefinitionResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DNSSecurityPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_domain_list_policy_object.go b/internal/provider/resource_sdwan_domain_list_policy_object.go index f7903fc77..451aee225 100644 --- a/internal/provider/resource_sdwan_domain_list_policy_object.go +++ b/internal/provider/resource_sdwan_domain_list_policy_object.go @@ -165,8 +165,13 @@ func (r *DomainListPolicyObjectResource) Read(ctx context.Context, req resource. } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *DomainListPolicyObjectResource) Delete(ctx context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *DomainListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_embedded_security_feature_profile.go b/internal/provider/resource_sdwan_embedded_security_feature_profile.go index 8266215ba..34a28e914 100644 --- a/internal/provider/resource_sdwan_embedded_security_feature_profile.go +++ b/internal/provider/resource_sdwan_embedded_security_feature_profile.go @@ -231,6 +231,8 @@ func (r *EmbeddedSecurityFeatureProfileResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *EmbeddedSecurityFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 83bda5b4d..925aab728 100644 --- a/internal/provider/resource_sdwan_expanded_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_expanded_community_list_policy_object.go @@ -165,8 +165,13 @@ func (r *ExpandedCommunityListPolicyObjectResource) Read(ctx context.Context, re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *ExpandedCommunityListPolicyObjectResource) Delete(ctx context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ExpandedCommunityListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 feab9b794..bff58b210 100644 --- a/internal/provider/resource_sdwan_extended_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_extended_community_list_policy_object.go @@ -165,8 +165,13 @@ func (r *ExtendedCommunityListPolicyObjectResource) Read(ctx context.Context, re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *ExtendedCommunityListPolicyObjectResource) Delete(ctx context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ExtendedCommunityListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_feature_device_template.go b/internal/provider/resource_sdwan_feature_device_template.go index ca273e018..c2a8609b5 100644 --- a/internal/provider/resource_sdwan_feature_device_template.go +++ b/internal/provider/resource_sdwan_feature_device_template.go @@ -241,8 +241,13 @@ func (r *FeatureDeviceTemplateResource) Read(ctx context.Context, req resource.R } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -329,6 +334,8 @@ func (r *FeatureDeviceTemplateResource) Delete(ctx context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *FeatureDeviceTemplateResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 9a530fdcf..5a4acc007 100644 --- a/internal/provider/resource_sdwan_geo_location_list_policy_object.go +++ b/internal/provider/resource_sdwan_geo_location_list_policy_object.go @@ -173,8 +173,13 @@ func (r *GeoLocationListPolicyObjectResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -261,6 +266,8 @@ func (r *GeoLocationListPolicyObjectResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *GeoLocationListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 7cb269fab..5a3d6df96 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 @@ -238,8 +238,13 @@ func (r *HubAndSpokeTopologyPolicyDefinitionResource) Read(ctx context.Context, } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -326,6 +331,8 @@ func (r *HubAndSpokeTopologyPolicyDefinitionResource) Delete(ctx context.Context // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *HubAndSpokeTopologyPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go b/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go index bfd0d76c0..958660cb0 100644 --- a/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go +++ b/internal/provider/resource_sdwan_intrusion_prevention_policy_definition.go @@ -215,8 +215,13 @@ func (r *IntrusionPreventionPolicyDefinitionResource) Read(ctx context.Context, } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -303,6 +308,8 @@ func (r *IntrusionPreventionPolicyDefinitionResource) Delete(ctx context.Context // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IntrusionPreventionPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 05040344f..6c8a1055c 100644 --- a/internal/provider/resource_sdwan_ips_signature_list_policy_object.go +++ b/internal/provider/resource_sdwan_ips_signature_list_policy_object.go @@ -176,8 +176,13 @@ func (r *IPSSignatureListPolicyObjectResource) Read(ctx context.Context, req res } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -264,6 +269,8 @@ func (r *IPSSignatureListPolicyObjectResource) Delete(ctx context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPSSignatureListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go index 438160265..e9ae656fa 100644 --- a/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv4_acl_policy_definition.go @@ -365,8 +365,13 @@ func (r *IPv4ACLPolicyDefinitionResource) Read(ctx context.Context, req resource } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -454,6 +459,8 @@ func (r *IPv4ACLPolicyDefinitionResource) Delete(ctx context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv4ACLPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 03aa64777..4e4c69c04 100644 --- a/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv4_device_acl_policy_definition.go @@ -273,8 +273,13 @@ func (r *IPv4DeviceACLPolicyDefinitionResource) Read(ctx context.Context, req re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -362,6 +367,8 @@ func (r *IPv4DeviceACLPolicyDefinitionResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv4DeviceACLPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 6767c69a0..f1d2f69f9 100644 --- a/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_ipv4_prefix_list_policy_object.go @@ -173,8 +173,13 @@ func (r *IPv4PrefixListPolicyObjectResource) Read(ctx context.Context, req resou } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -261,6 +266,8 @@ func (r *IPv4PrefixListPolicyObjectResource) Delete(ctx context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv4PrefixListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go b/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go index 137f789ad..316a741c0 100644 --- a/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv6_acl_policy_definition.go @@ -359,8 +359,13 @@ func (r *IPv6ACLPolicyDefinitionResource) Read(ctx context.Context, req resource } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -448,6 +453,8 @@ func (r *IPv6ACLPolicyDefinitionResource) Delete(ctx context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv6ACLPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 54f708c3a..32854885b 100644 --- a/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go +++ b/internal/provider/resource_sdwan_ipv6_device_acl_policy_definition.go @@ -265,8 +265,13 @@ func (r *IPv6DeviceACLPolicyDefinitionResource) Read(ctx context.Context, req re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -354,6 +359,8 @@ func (r *IPv6DeviceACLPolicyDefinitionResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv6DeviceACLPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 0f3ddaae6..16ff6b858 100644 --- a/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go +++ b/internal/provider/resource_sdwan_ipv6_prefix_list_policy_object.go @@ -173,8 +173,13 @@ func (r *IPv6PrefixListPolicyObjectResource) Read(ctx context.Context, req resou } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -261,6 +266,8 @@ func (r *IPv6PrefixListPolicyObjectResource) Delete(ctx context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *IPv6PrefixListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 ee1a0d2c3..454d9c697 100644 --- a/internal/provider/resource_sdwan_local_application_list_policy_object.go +++ b/internal/provider/resource_sdwan_local_application_list_policy_object.go @@ -169,8 +169,13 @@ func (r *LocalApplicationListPolicyObjectResource) Read(ctx context.Context, req } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *LocalApplicationListPolicyObjectResource) Delete(ctx context.Context, r // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *LocalApplicationListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_localized_policy.go b/internal/provider/resource_sdwan_localized_policy.go index 0e0147285..ae18397cf 100644 --- a/internal/provider/resource_sdwan_localized_policy.go +++ b/internal/provider/resource_sdwan_localized_policy.go @@ -227,8 +227,13 @@ func (r *LocalizedPolicyResource) Read(ctx context.Context, req resource.ReadReq } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -318,6 +323,8 @@ func (r *LocalizedPolicyResource) Delete(ctx context.Context, req resource.Delet // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *LocalizedPolicyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_mesh_topology_policy_definition.go b/internal/provider/resource_sdwan_mesh_topology_policy_definition.go index 67a517266..6456bb21d 100644 --- a/internal/provider/resource_sdwan_mesh_topology_policy_definition.go +++ b/internal/provider/resource_sdwan_mesh_topology_policy_definition.go @@ -190,8 +190,13 @@ func (r *MeshTopologyPolicyDefinitionResource) Read(ctx context.Context, req res } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -278,6 +283,8 @@ func (r *MeshTopologyPolicyDefinitionResource) Delete(ctx context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *MeshTopologyPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_mirror_policy_object.go b/internal/provider/resource_sdwan_mirror_policy_object.go index 91190b19c..9d5b0d44c 100644 --- a/internal/provider/resource_sdwan_mirror_policy_object.go +++ b/internal/provider/resource_sdwan_mirror_policy_object.go @@ -156,8 +156,13 @@ func (r *MirrorPolicyObjectResource) Read(ctx context.Context, req resource.Read } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -244,6 +249,8 @@ func (r *MirrorPolicyObjectResource) Delete(ctx context.Context, req resource.De // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *MirrorPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_object_group_policy_definition.go b/internal/provider/resource_sdwan_object_group_policy_definition.go index b291d3b88..96a696f11 100644 --- a/internal/provider/resource_sdwan_object_group_policy_definition.go +++ b/internal/provider/resource_sdwan_object_group_policy_definition.go @@ -204,8 +204,13 @@ func (r *ObjectGroupPolicyDefinitionResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -292,6 +297,8 @@ func (r *ObjectGroupPolicyDefinitionResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ObjectGroupPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_other_feature_profile.go b/internal/provider/resource_sdwan_other_feature_profile.go index 6ed75e1b4..5df7fb6fb 100644 --- a/internal/provider/resource_sdwan_other_feature_profile.go +++ b/internal/provider/resource_sdwan_other_feature_profile.go @@ -231,6 +231,8 @@ func (r *OtherFeatureProfileResource) Delete(ctx context.Context, req resource.D // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *OtherFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_policer_policy_object.go b/internal/provider/resource_sdwan_policer_policy_object.go index 182c24940..fcf89f118 100644 --- a/internal/provider/resource_sdwan_policer_policy_object.go +++ b/internal/provider/resource_sdwan_policer_policy_object.go @@ -172,8 +172,13 @@ func (r *PolicerPolicyObjectResource) Read(ctx context.Context, req resource.Rea } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -260,6 +265,8 @@ func (r *PolicerPolicyObjectResource) Delete(ctx context.Context, req resource.D // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *PolicerPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_policy_object_feature_profile.go b/internal/provider/resource_sdwan_policy_object_feature_profile.go index 94ed2a264..29fc35452 100644 --- a/internal/provider/resource_sdwan_policy_object_feature_profile.go +++ b/internal/provider/resource_sdwan_policy_object_feature_profile.go @@ -233,6 +233,8 @@ func (r *PolicyObjectFeatureProfileResource) Delete(ctx context.Context, req res // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *PolicyObjectFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_port_list_policy_object.go b/internal/provider/resource_sdwan_port_list_policy_object.go index c4ca5d5b3..9c974668d 100644 --- a/internal/provider/resource_sdwan_port_list_policy_object.go +++ b/internal/provider/resource_sdwan_port_list_policy_object.go @@ -169,8 +169,13 @@ func (r *PortListPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *PortListPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *PortListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 be33c36fd..6f155eb23 100644 --- a/internal/provider/resource_sdwan_preferred_color_group_policy_object.go +++ b/internal/provider/resource_sdwan_preferred_color_group_policy_object.go @@ -183,8 +183,13 @@ func (r *PreferredColorGroupPolicyObjectResource) Read(ctx context.Context, req } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -271,6 +276,8 @@ func (r *PreferredColorGroupPolicyObjectResource) Delete(ctx context.Context, re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *PreferredColorGroupPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_protocol_list_policy_object.go b/internal/provider/resource_sdwan_protocol_list_policy_object.go index 78b781cf5..ff7b32ba6 100644 --- a/internal/provider/resource_sdwan_protocol_list_policy_object.go +++ b/internal/provider/resource_sdwan_protocol_list_policy_object.go @@ -165,8 +165,13 @@ func (r *ProtocolListPolicyObjectResource) Read(ctx context.Context, req resourc } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *ProtocolListPolicyObjectResource) Delete(ctx context.Context, req resou // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ProtocolListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_qos_map_policy_definition.go b/internal/provider/resource_sdwan_qos_map_policy_definition.go index 860bb1fad..49fece918 100644 --- a/internal/provider/resource_sdwan_qos_map_policy_definition.go +++ b/internal/provider/resource_sdwan_qos_map_policy_definition.go @@ -221,8 +221,13 @@ func (r *QoSMapPolicyDefinitionResource) Read(ctx context.Context, req resource. } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -310,6 +315,8 @@ func (r *QoSMapPolicyDefinitionResource) Delete(ctx context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *QoSMapPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_region_list_policy_object.go b/internal/provider/resource_sdwan_region_list_policy_object.go index 2f4cb3677..cc411e636 100644 --- a/internal/provider/resource_sdwan_region_list_policy_object.go +++ b/internal/provider/resource_sdwan_region_list_policy_object.go @@ -165,8 +165,13 @@ func (r *RegionListPolicyObjectResource) Read(ctx context.Context, req resource. } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *RegionListPolicyObjectResource) Delete(ctx context.Context, req resourc // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *RegionListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go b/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go index eb379b313..a9d698227 100644 --- a/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go +++ b/internal/provider/resource_sdwan_rewrite_rule_policy_definition.go @@ -200,8 +200,13 @@ func (r *RewriteRulePolicyDefinitionResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -289,6 +294,8 @@ func (r *RewriteRulePolicyDefinitionResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *RewriteRulePolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_route_policy_definition.go b/internal/provider/resource_sdwan_route_policy_definition.go index 2fdaf3d66..8c6437f17 100644 --- a/internal/provider/resource_sdwan_route_policy_definition.go +++ b/internal/provider/resource_sdwan_route_policy_definition.go @@ -425,8 +425,13 @@ func (r *RoutePolicyDefinitionResource) Read(ctx context.Context, req resource.R } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -514,6 +519,8 @@ func (r *RoutePolicyDefinitionResource) Delete(ctx context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *RoutePolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_rule_set_policy_definition.go b/internal/provider/resource_sdwan_rule_set_policy_definition.go index 0e34e2527..ba73be846 100644 --- a/internal/provider/resource_sdwan_rule_set_policy_definition.go +++ b/internal/provider/resource_sdwan_rule_set_policy_definition.go @@ -309,8 +309,13 @@ func (r *RuleSetPolicyDefinitionResource) Read(ctx context.Context, req resource } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -397,6 +402,8 @@ func (r *RuleSetPolicyDefinitionResource) Delete(ctx context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *RuleSetPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_security_policy.go b/internal/provider/resource_sdwan_security_policy.go index b66e9255f..6401c146c 100644 --- a/internal/provider/resource_sdwan_security_policy.go +++ b/internal/provider/resource_sdwan_security_policy.go @@ -305,8 +305,13 @@ func (r *SecurityPolicyResource) Read(ctx context.Context, req resource.ReadRequ } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -396,6 +401,8 @@ func (r *SecurityPolicyResource) Delete(ctx context.Context, req resource.Delete // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *SecurityPolicyResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_feature_profile.go b/internal/provider/resource_sdwan_service_feature_profile.go index a34518d05..8cea90e4e 100644 --- a/internal/provider/resource_sdwan_service_feature_profile.go +++ b/internal/provider/resource_sdwan_service_feature_profile.go @@ -231,6 +231,8 @@ func (r *ServiceFeatureProfileResource) Delete(ctx context.Context, req resource // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ServiceFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_multicast_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_multicast_feature.go index b70457afc..6b8872b7f 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_multicast_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_multicast_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateMulticastFeatureResource) Read(ctx context } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateMulticastFeatureResource) ImportState(ctx resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_bgp_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_bgp_feature.go index 381e0ef4a..27e458efe 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_bgp_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_bgp_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateRoutingBGPFeatureResource) Read(ctx contex } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateRoutingBGPFeatureResource) ImportState(ctx resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_eigrp_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_eigrp_feature.go index 5a0c98ad6..86c86b0af 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_eigrp_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_eigrp_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateRoutingEIGRPFeatureResource) Read(ctx cont } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateRoutingEIGRPFeatureResource) ImportState(c resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospf_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospf_feature.go index eac606aac..460a59cd8 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospf_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospf_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFFeatureResource) Read(ctx conte } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFFeatureResource) ImportState(ct resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go index b7f1fbc10..1bca4b691 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFv3IPv4FeatureResource) Read(ctx } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFv3IPv4FeatureResource) ImportSt resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go index 5c4b25eb2..bb87a047a 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go @@ -154,9 +154,6 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFv3IPv6FeatureResource) Read(ctx } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *ServiceLANVPNFeatureAssociateRoutingOSPFv3IPv6FeatureResource) ImportSt resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_dhcp_server_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_dhcp_server_feature.go index 101206648..4e2b063d4 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_dhcp_server_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_dhcp_server_feature.go @@ -158,9 +158,6 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateDHCPServerFeatureResource } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateDHCPServerFeatureResource resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_feature.go index 5989b1d56..98a0c8e55 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_feature.go @@ -158,9 +158,6 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateTrackerFeatureResource) R } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateTrackerFeatureResource) I resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go index feb842bd0..ede2aefaa 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go @@ -158,9 +158,6 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateTrackerGroupFeatureResour } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *ServiceLANVPNInterfaceEthernetFeatureAssociateTrackerGroupFeatureResour resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_ipsec_feature_associate_dhcp_server_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_ipsec_feature_associate_dhcp_server_feature.go index 63526e628..687a90c1a 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_ipsec_feature_associate_dhcp_server_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_ipsec_feature_associate_dhcp_server_feature.go @@ -158,9 +158,6 @@ func (r *ServiceLANVPNInterfaceIPSecFeatureAssociateDHCPServerFeatureResource) R } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *ServiceLANVPNInterfaceIPSecFeatureAssociateDHCPServerFeatureResource) I resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_interface_ipsec_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_associate_dhcp_server_feature.go b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_associate_dhcp_server_feature.go index 15887732d..6bb1ade50 100644 --- a/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_associate_dhcp_server_feature.go +++ b/internal/provider/resource_sdwan_service_lan_vpn_interface_svi_feature_associate_dhcp_server_feature.go @@ -158,9 +158,6 @@ func (r *ServiceLANVPNInterfaceSVIFeatureAssociateDHCPServerFeatureResource) Rea } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *ServiceLANVPNInterfaceSVIFeatureAssociateDHCPServerFeatureResource) Imp resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("service_lan_vpn_interface_svi_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_sig_security_feature_profile.go b/internal/provider/resource_sdwan_sig_security_feature_profile.go index 6cf092834..dcb9b0352 100644 --- a/internal/provider/resource_sdwan_sig_security_feature_profile.go +++ b/internal/provider/resource_sdwan_sig_security_feature_profile.go @@ -231,6 +231,8 @@ func (r *SIGSecurityFeatureProfileResource) Delete(ctx context.Context, req reso // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *SIGSecurityFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_site_list_policy_object.go b/internal/provider/resource_sdwan_site_list_policy_object.go index b0ff1664d..6bc33fd0b 100644 --- a/internal/provider/resource_sdwan_site_list_policy_object.go +++ b/internal/provider/resource_sdwan_site_list_policy_object.go @@ -165,8 +165,13 @@ func (r *SiteListPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *SiteListPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *SiteListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_sla_class_policy_object.go b/internal/provider/resource_sdwan_sla_class_policy_object.go index 3d10c42cf..655a276f5 100644 --- a/internal/provider/resource_sdwan_sla_class_policy_object.go +++ b/internal/provider/resource_sdwan_sla_class_policy_object.go @@ -208,8 +208,13 @@ func (r *SLAClassPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -296,6 +301,8 @@ func (r *SLAClassPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *SLAClassPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 0eed25b13..b25cad7da 100644 --- a/internal/provider/resource_sdwan_standard_community_list_policy_object.go +++ b/internal/provider/resource_sdwan_standard_community_list_policy_object.go @@ -165,8 +165,13 @@ func (r *StandardCommunityListPolicyObjectResource) Read(ctx context.Context, re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *StandardCommunityListPolicyObjectResource) Delete(ctx context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *StandardCommunityListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_system_feature_profile.go b/internal/provider/resource_sdwan_system_feature_profile.go index 55850be27..7d7b1e9f4 100644 --- a/internal/provider/resource_sdwan_system_feature_profile.go +++ b/internal/provider/resource_sdwan_system_feature_profile.go @@ -231,6 +231,8 @@ func (r *SystemFeatureProfileResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *SystemFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_tag.go b/internal/provider/resource_sdwan_tag.go index f28251f54..b448b3b50 100644 --- a/internal/provider/resource_sdwan_tag.go +++ b/internal/provider/resource_sdwan_tag.go @@ -287,6 +287,8 @@ func (r *TagResource) Delete(ctx context.Context, req resource.DeleteRequest, re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TagResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_tloc_list_policy_object.go b/internal/provider/resource_sdwan_tloc_list_policy_object.go index 04085522b..beae2d726 100644 --- a/internal/provider/resource_sdwan_tloc_list_policy_object.go +++ b/internal/provider/resource_sdwan_tloc_list_policy_object.go @@ -188,8 +188,13 @@ func (r *TLOCListPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -276,6 +281,8 @@ func (r *TLOCListPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TLOCListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 648088809..50ed3d141 100644 --- a/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go +++ b/internal/provider/resource_sdwan_tls_ssl_decryption_policy_definition.go @@ -162,7 +162,7 @@ func (r *TLSSSLDecryptionPolicyDefinitionResource) Schema(ctx context.Context, r MarkdownDescription: helpers.NewAttributeDescription("TLS SSL Profile Policy ID").String, Optional: true, }, - "tls_ssl_profile_version": schema.Int64Attribute{ + "tls_ssl_profile_policy_version": schema.Int64Attribute{ MarkdownDescription: helpers.NewAttributeDescription("TLS SSL Profile Policy version").String, Optional: true, }, @@ -321,8 +321,13 @@ func (r *TLSSSLDecryptionPolicyDefinitionResource) Read(ctx context.Context, req } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -410,6 +415,8 @@ func (r *TLSSSLDecryptionPolicyDefinitionResource) Delete(ctx context.Context, r // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TLSSSLDecryptionPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 5fc7de512..eff1d3373 100644 --- a/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go +++ b/internal/provider/resource_sdwan_tls_ssl_profile_policy_definition.go @@ -207,8 +207,13 @@ func (r *TLSSSLProfilePolicyDefinitionResource) Read(ctx context.Context, req re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -296,6 +301,8 @@ func (r *TLSSSLProfilePolicyDefinitionResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TLSSSLProfilePolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_traffic_data_policy_definition.go b/internal/provider/resource_sdwan_traffic_data_policy_definition.go index eddef5ec4..af402f46e 100644 --- a/internal/provider/resource_sdwan_traffic_data_policy_definition.go +++ b/internal/provider/resource_sdwan_traffic_data_policy_definition.go @@ -405,7 +405,7 @@ func (r *TrafficDataPolicyDefinitionResource) Schema(ctx context.Context, req re MarkdownDescription: helpers.NewAttributeDescription("Policer list version").String, Optional: true, }, - "preferred_color_group_list": schema.StringAttribute{ + "preferred_color_group_list_id": schema.StringAttribute{ MarkdownDescription: helpers.NewAttributeDescription("Preferred color group list ID, Attribute conditional on `type` being equal to `preferredColorGroup`").String, Optional: true, }, @@ -591,8 +591,13 @@ func (r *TrafficDataPolicyDefinitionResource) Read(ctx context.Context, req reso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -679,6 +684,8 @@ func (r *TrafficDataPolicyDefinitionResource) Delete(ctx context.Context, req re // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TrafficDataPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_feature_profile.go b/internal/provider/resource_sdwan_transport_feature_profile.go index ddca0bd82..ae572b824 100644 --- a/internal/provider/resource_sdwan_transport_feature_profile.go +++ b/internal/provider/resource_sdwan_transport_feature_profile.go @@ -231,6 +231,8 @@ func (r *TransportFeatureProfileResource) Delete(ctx context.Context, req resour // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *TransportFeatureProfileResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_bgp_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_bgp_feature.go index 6c90d22f1..968ddc4ef 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_bgp_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_bgp_feature.go @@ -154,9 +154,6 @@ func (r *TransportWANVPNFeatureAssociateRoutingBGPFeatureResource) Read(ctx cont } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *TransportWANVPNFeatureAssociateRoutingBGPFeatureResource) ImportState(c resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospf_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospf_feature.go index 9d552f77e..5dc46f5ca 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospf_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospf_feature.go @@ -154,9 +154,6 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFFeatureResource) Read(ctx con } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFFeatureResource) ImportState( resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go index e5b1860c7..48ca35e6d 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv4_feature.go @@ -154,9 +154,6 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFv3IPv4FeatureResource) Read(c } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFv3IPv4FeatureResource) Import resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go index de47fde4d..dfec88d00 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_feature_associate_routing_ospfv3_ipv6_feature.go @@ -154,9 +154,6 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFv3IPv6FeatureResource) Read(c } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -255,6 +252,8 @@ func (r *TransportWANVPNFeatureAssociateRoutingOSPFv3IPv6FeatureResource) Import resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), parts[0])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_feature.go index 76579dd6f..181bfde50 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceCellularFeatureAssociateTrackerFeatureResource) } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceCellularFeatureAssociateTrackerFeatureResource) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_cellular_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_group_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_group_feature.go index 4de53ee12..34b659556 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_group_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_cellular_feature_associate_tracker_group_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceCellularFeatureAssociateTrackerGroupFeatureReso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceCellularFeatureAssociateTrackerGroupFeatureReso resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_cellular_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_feature.go index 58964c0a7..465eda60f 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateIPv6TrackerFeatureResou } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateIPv6TrackerFeatureResou resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_group_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_group_feature.go index 55aea4319..8221d0af5 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_group_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_ipv6_tracker_group_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateIPv6TrackerGroupFeature } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateIPv6TrackerGroupFeature resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_feature.go index a8b521cb2..b8c54a967 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateTrackerFeatureResource) } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateTrackerFeatureResource) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go index 9656ed55e..ba72a3402 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ethernet_feature_associate_tracker_group_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateTrackerGroupFeatureReso } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceEthernetFeatureAssociateTrackerGroupFeatureReso resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_ethernet_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_gre_feature_associate_tracker_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_gre_feature_associate_tracker_feature.go index 667a5c0b4..10a4e1310 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_gre_feature_associate_tracker_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_gre_feature_associate_tracker_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceGREFeatureAssociateTrackerFeatureResource) Read } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceGREFeatureAssociateTrackerFeatureResource) Impo resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_gre_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ipsec_feature_associate_tracker_feature.go b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ipsec_feature_associate_tracker_feature.go index 462321dfa..f950be0be 100644 --- a/internal/provider/resource_sdwan_transport_wan_vpn_interface_ipsec_feature_associate_tracker_feature.go +++ b/internal/provider/resource_sdwan_transport_wan_vpn_interface_ipsec_feature_associate_tracker_feature.go @@ -158,9 +158,6 @@ func (r *TransportWANVPNInterfaceIPSECFeatureAssociateTrackerFeatureResource) Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) - } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) @@ -260,6 +257,8 @@ func (r *TransportWANVPNInterfaceIPSECFeatureAssociateTrackerFeatureResource) Im resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("feature_profile_id"), parts[1])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_feature_id"), parts[2])...) resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("transport_wan_vpn_interface_ipsec_feature_id"), parts[3])...) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_url_filtering_policy_definition.go b/internal/provider/resource_sdwan_url_filtering_policy_definition.go index fb31bed20..8e9c84a00 100644 --- a/internal/provider/resource_sdwan_url_filtering_policy_definition.go +++ b/internal/provider/resource_sdwan_url_filtering_policy_definition.go @@ -233,8 +233,13 @@ func (r *URLFilteringPolicyDefinitionResource) Read(ctx context.Context, req res } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -322,6 +327,8 @@ func (r *URLFilteringPolicyDefinitionResource) Delete(ctx context.Context, req r // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *URLFilteringPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_vpn_list_policy_object.go b/internal/provider/resource_sdwan_vpn_list_policy_object.go index 15ecfed97..14aa835a7 100644 --- a/internal/provider/resource_sdwan_vpn_list_policy_object.go +++ b/internal/provider/resource_sdwan_vpn_list_policy_object.go @@ -165,8 +165,13 @@ func (r *VPNListPolicyObjectResource) Read(ctx context.Context, req resource.Rea } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -253,6 +258,8 @@ func (r *VPNListPolicyObjectResource) Delete(ctx context.Context, req resource.D // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *VPNListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_vpn_membership_policy_definition.go b/internal/provider/resource_sdwan_vpn_membership_policy_definition.go index b383a1519..5f9475f54 100644 --- a/internal/provider/resource_sdwan_vpn_membership_policy_definition.go +++ b/internal/provider/resource_sdwan_vpn_membership_policy_definition.go @@ -186,8 +186,13 @@ func (r *VPNMembershipPolicyDefinitionResource) Read(ctx context.Context, req re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -274,6 +279,8 @@ func (r *VPNMembershipPolicyDefinitionResource) Delete(ctx context.Context, req // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *VPNMembershipPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import 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 37ad594ca..419fe83a4 100644 --- a/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go +++ b/internal/provider/resource_sdwan_zone_based_firewall_policy_definition.go @@ -263,8 +263,13 @@ func (r *ZoneBasedFirewallPolicyDefinitionResource) Read(ctx context.Context, re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -352,6 +357,8 @@ func (r *ZoneBasedFirewallPolicyDefinitionResource) Delete(ctx context.Context, // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ZoneBasedFirewallPolicyDefinitionResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/internal/provider/resource_sdwan_zone_list_policy_object.go b/internal/provider/resource_sdwan_zone_list_policy_object.go index 28bb49194..40461dab7 100644 --- a/internal/provider/resource_sdwan_zone_list_policy_object.go +++ b/internal/provider/resource_sdwan_zone_list_policy_object.go @@ -169,8 +169,13 @@ func (r *ZoneListPolicyObjectResource) Read(ctx context.Context, req resource.Re } state.fromBody(ctx, res) - if state.Version.IsNull() { - state.Version = types.Int64Value(0) + imp, diags := helpers.IsFlagImporting(ctx, req) + if resp.Diagnostics.Append(diags...); resp.Diagnostics.HasError() { + return + } + + if imp { + state.processImport(ctx) } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Name.ValueString())) @@ -257,6 +262,8 @@ func (r *ZoneListPolicyObjectResource) Delete(ctx context.Context, req resource. // Section below is generated&owned by "gen/generator.go". //template:begin import func (r *ZoneListPolicyObjectResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + helpers.SetFlagImporting(ctx, true, resp.Private, &resp.Diagnostics) } // End of section. //template:end import diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index 814a41d9e..9f855d3bc 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -9,6 +9,10 @@ description: |- ## 0.6.3 (unreleased) +- BREAKING CHANGE: Rename `tls_ssl_profile_version` attribute of `sdwan_tls_ssl_decryption_policy_definition` resource to `tls_ssl_profile_policy_version` +- BREAKING CHANGE: Rename `sla_class_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `sla_class_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_application_aware_routing_policy_definition` resource to `preferred_color_group_list_id` +- BREAKING CHANGE: Rename `preferred_color_group_list` attribute of `sdwan_traffic_data_policy_definition` resource to `preferred_color_group_list_id` - Add missing options under `unsupported_features` attribute of `sdwan_configuration_group`, [link](https://github.com/CiscoDevNet/terraform-provider-sdwan/issues/478) ## 0.6.2