From 470af2493ef3b64ef42675ef21b8cbd5c6e07e9f Mon Sep 17 00:00:00 2001 From: danischm Date: Sat, 20 Jan 2024 21:45:19 +0100 Subject: [PATCH] Fix import --- CHANGELOG.md | 1 + docs/guides/changelog.md | 1 + gen/gen_definition.go | 67 +++++ gen/templates/model.go | 19 ++ gen/templates/resource.go | 7 +- .../provider/model_ise_allowed_protocols.go | 238 ++++++++++++++++++ .../model_ise_allowed_protocols_tacacs.go | 22 ++ .../model_ise_authorization_profile.go | 106 ++++++++ ..._ise_certificate_authentication_profile.go | 28 +++ ...el_ise_device_admin_authentication_rule.go | 61 +++++ ...vice_admin_authorization_exception_rule.go | 55 ++++ ...min_authorization_global_exception_rule.go | 52 ++++ ...del_ise_device_admin_authorization_rule.go | 55 ++++ .../model_ise_device_admin_condition.go | 37 +++ .../model_ise_device_admin_policy_set.go | 52 ++++ ...se_device_admin_time_and_date_condition.go | 46 ++++ .../provider/model_ise_downloadable_acl.go | 19 ++ .../model_ise_endpoint_identity_group.go | 19 ++ .../model_ise_identity_source_sequence.go | 22 ++ internal/provider/model_ise_internal_user.go | 49 ++++ .../provider/model_ise_license_tier_state.go | 10 + ..._ise_network_access_authentication_rule.go | 61 +++++ ...ork_access_authorization_exception_rule.go | 55 ++++ ...ess_authorization_global_exception_rule.go | 52 ++++ ...l_ise_network_access_authorization_rule.go | 55 ++++ .../model_ise_network_access_condition.go | 37 +++ .../model_ise_network_access_dictionary.go | 19 ++ .../model_ise_network_access_policy_set.go | 52 ++++ ..._network_access_time_and_date_condition.go | 46 ++++ internal/provider/model_ise_network_device.go | 133 ++++++++++ .../model_ise_network_device_group.go | 16 ++ internal/provider/model_ise_repository.go | 28 +++ .../provider/model_ise_tacacs_command_set.go | 19 ++ internal/provider/model_ise_tacacs_profile.go | 16 ++ .../model_ise_trustsec_egress_matrix_cell.go | 25 ++ .../model_ise_trustsec_ip_to_sgt_mapping.go | 31 +++ ...el_ise_trustsec_ip_to_sgt_mapping_group.go | 22 ++ .../model_ise_trustsec_security_group.go | 22 ++ .../model_ise_trustsec_security_group_acl.go | 22 ++ .../provider/model_ise_user_identity_group.go | 16 ++ .../resource_ise_allowed_protocols.go | 7 +- .../resource_ise_allowed_protocols_tacacs.go | 7 +- .../resource_ise_authorization_profile.go | 7 +- ..._ise_certificate_authentication_profile.go | 7 +- ...ce_ise_device_admin_authentication_rule.go | 7 +- ...vice_admin_authorization_exception_rule.go | 7 +- ...min_authorization_global_exception_rule.go | 7 +- ...rce_ise_device_admin_authorization_rule.go | 7 +- .../resource_ise_device_admin_condition.go | 7 +- .../resource_ise_device_admin_policy_set.go | 7 +- ...se_device_admin_time_and_date_condition.go | 7 +- .../provider/resource_ise_downloadable_acl.go | 7 +- .../resource_ise_endpoint_identity_group.go | 7 +- .../resource_ise_identity_source_sequence.go | 7 +- .../provider/resource_ise_internal_user.go | 7 +- .../resource_ise_license_tier_state.go | 7 +- ..._ise_network_access_authentication_rule.go | 7 +- ...ork_access_authorization_exception_rule.go | 7 +- ...ess_authorization_global_exception_rule.go | 7 +- ...e_ise_network_access_authorization_rule.go | 7 +- .../resource_ise_network_access_condition.go | 7 +- .../resource_ise_network_access_dictionary.go | 7 +- .../resource_ise_network_access_policy_set.go | 7 +- ..._network_access_time_and_date_condition.go | 7 +- .../provider/resource_ise_network_device.go | 7 +- .../resource_ise_network_device_group.go | 7 +- internal/provider/resource_ise_repository.go | 7 +- .../resource_ise_tacacs_command_set.go | 7 +- .../provider/resource_ise_tacacs_profile.go | 7 +- ...esource_ise_trustsec_egress_matrix_cell.go | 7 +- ...resource_ise_trustsec_ip_to_sgt_mapping.go | 7 +- ...ce_ise_trustsec_ip_to_sgt_mapping_group.go | 7 +- .../resource_ise_trustsec_security_group.go | 7 +- ...esource_ise_trustsec_security_group_acl.go | 7 +- .../resource_ise_user_identity_group.go | 7 +- templates/guides/changelog.md.tmpl | 1 + 76 files changed, 1903 insertions(+), 36 deletions(-) create mode 100644 gen/gen_definition.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 8abae48..5873114 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 0.1.10 (unreleased) - Retry on 400 and 500 HTTP errors when creating or updating objects +- Fix import operation of resources ## 0.1.9 diff --git a/docs/guides/changelog.md b/docs/guides/changelog.md index f70ac36..2d7a646 100644 --- a/docs/guides/changelog.md +++ b/docs/guides/changelog.md @@ -10,6 +10,7 @@ description: |- ## 0.1.10 (unreleased) - Retry on 400 and 500 HTTP errors when creating or updating objects +- Fix import operation of resources ## 0.1.9 diff --git a/gen/gen_definition.go b/gen/gen_definition.go new file mode 100644 index 0000000..00a2133 --- /dev/null +++ b/gen/gen_definition.go @@ -0,0 +1,67 @@ +// Copyright © 2023 Cisco Systems, Inc. and its affiliates. +// All rights reserved. +// +// Licensed under the Mozilla Public License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://mozilla.org/MPL/2.0/ +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// SPDX-License-Identifier: MPL-2.0 + +//go:build ignore + +package main + +import ( + "fmt" + "os" + + "github.com/pb33f/libopenapi" +) + +const ( + modelFile = "./gen/models/ise_320p4_ers.json" + outputFile = "./gen/definition/active_directory.yaml" + endpoint = "/activedirectory/" + schemaElement = "ERSActiveDirectory" +) + +func main() { + modelBytes, err := os.ReadFile(modelFile) + if err != nil { + panic(fmt.Sprintf("Error reading file: %v", err)) + } + + document, err := libopenapi.NewDocument(modelBytes) + if err != nil { + panic(fmt.Sprintf("Cannot create new document: %e", err)) + } + + docModel, errors := document.BuildV3Model() + if len(errors) > 0 { + for i := range errors { + fmt.Printf("error: %e\n", errors[i]) + } + panic(fmt.Sprintf("Cannot create v3 model from document: %d errors reported", len(errors))) + } + + schema, _ := docModel.Model.Components.Schemas.Get(schemaElement) + + prop, _ := schema.Schema().Properties.Get("domain") + + println(prop) + + // write to output file + // f, err := os.Create(outputFile) + // if err != nil { + // log.Fatalf("Error creating output file: %v", err) + // } + // f.Write(output.Bytes()) +} diff --git a/gen/templates/model.go b/gen/templates/model.go index 0679592..a77f834 100644 --- a/gen/templates/model.go +++ b/gen/templates/model.go @@ -525,3 +525,22 @@ func (data *{{camelCase .Name}}) updateFromBody(ctx context.Context, res gjson.R {{- end}} } //template:end updateFromBody + +//template:begin isNull +func (data *{{camelCase .Name}}) isNull(ctx context.Context, res gjson.Result) bool { + {{- range .Attributes}} + {{- if not .Value}} + {{- if or (eq .Type "List") (eq .Type "Set")}} + if len(data.{{toGoName .TfName}}) > 0 { + return false + } + {{- else}} + if !data.{{toGoName .TfName}}.IsNull() { + return false + } + {{- end}} + {{- end}} + {{- end}} + return true +} +//template:end isNull diff --git a/gen/templates/resource.go b/gen/templates/resource.go index ab4f967..92e38b0 100644 --- a/gen/templates/resource.go +++ b/gen/templates/resource.go @@ -452,7 +452,12 @@ func (r *{{camelCase .Name}}Resource) Read(ctx context.Context, req resource.Rea return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/model_ise_allowed_protocols.go b/internal/provider/model_ise_allowed_protocols.go index df651c2..20d702c 100644 --- a/internal/provider/model_ise_allowed_protocols.go +++ b/internal/provider/model_ise_allowed_protocols.go @@ -1131,3 +1131,241 @@ func (data *AllowedProtocols) updateFromBody(ctx context.Context, res gjson.Resu } //template:end updateFromBody + +//template:begin isNull +func (data *AllowedProtocols) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.ProcessHostLookup.IsNull() { + return false + } + if !data.AllowPapAscii.IsNull() { + return false + } + if !data.AllowChap.IsNull() { + return false + } + if !data.AllowMsChapV1.IsNull() { + return false + } + if !data.AllowMsChapV2.IsNull() { + return false + } + if !data.AllowEapMd5.IsNull() { + return false + } + if !data.AllowLeap.IsNull() { + return false + } + if !data.AllowEapTls.IsNull() { + return false + } + if !data.AllowEapTtls.IsNull() { + return false + } + if !data.AllowEapFast.IsNull() { + return false + } + if !data.AllowPeap.IsNull() { + return false + } + if !data.AllowTeap.IsNull() { + return false + } + if !data.AllowPreferredEapProtocol.IsNull() { + return false + } + if !data.PreferredEapProtocol.IsNull() { + return false + } + if !data.EapTlsLBit.IsNull() { + return false + } + if !data.AllowWeakCiphersForEap.IsNull() { + return false + } + if !data.RequireMessageAuth.IsNull() { + return false + } + if !data.EapTlsAllowAuthOfExpiredCerts.IsNull() { + return false + } + if !data.EapTlsEnableStatelessSessionResume.IsNull() { + return false + } + if !data.EapTlsSessionTicketTtl.IsNull() { + return false + } + if !data.EapTlsSessionTicketTtlUnit.IsNull() { + return false + } + if !data.EapTlsSessionTicketPercentage.IsNull() { + return false + } + if !data.PeapAllowPeapEapMsChapV2.IsNull() { + return false + } + if !data.PeapAllowPeapEapMsChapV2PwdChange.IsNull() { + return false + } + if !data.PeapAllowPeapEapMsChapV2PwdChangeRetries.IsNull() { + return false + } + if !data.PeapAllowPeapEapGtc.IsNull() { + return false + } + if !data.PeapAllowPeapEapGtcPwdChange.IsNull() { + return false + } + if !data.PeapAllowPeapEapGtcPwdChangeRetries.IsNull() { + return false + } + if !data.PeapAllowPeapEapTls.IsNull() { + return false + } + if !data.PeapAllowPeapEapTlsAuthOfExpiredCerts.IsNull() { + return false + } + if !data.RequireCryptobinding.IsNull() { + return false + } + if !data.PeapPeapV0.IsNull() { + return false + } + if !data.EapTtlsPapAscii.IsNull() { + return false + } + if !data.EapTtlsChap.IsNull() { + return false + } + if !data.EapTtlsMsChapV1.IsNull() { + return false + } + if !data.EapTtlsMsChapV2.IsNull() { + return false + } + if !data.EapTtlsEapMd5.IsNull() { + return false + } + if !data.EapTtlsEapMsChapV2.IsNull() { + return false + } + if !data.EapTtlsEapMsChapV2PwdChange.IsNull() { + return false + } + if !data.EapTtlsEapMsChapV2PwdChangeRetries.IsNull() { + return false + } + if !data.EapFastEapMsChapV2.IsNull() { + return false + } + if !data.EapFastEapMsChapV2PwdChange.IsNull() { + return false + } + if !data.EapFastEapMsChapV2PwdChangeRetries.IsNull() { + return false + } + if !data.EapFastEapGtc.IsNull() { + return false + } + if !data.EapFastEapGtcPwdChange.IsNull() { + return false + } + if !data.EapFastEapGtcPwdChangeRetries.IsNull() { + return false + } + if !data.EapFastEapTls.IsNull() { + return false + } + if !data.EapFastEapTlsAuthOfExpiredCerts.IsNull() { + return false + } + if !data.EapFastEnableEapChaining.IsNull() { + return false + } + if !data.EapFastUsePacs.IsNull() { + return false + } + if !data.EapFastPacsTunnelPacTtl.IsNull() { + return false + } + if !data.EapFastPacsTunnelPacTtlUnit.IsNull() { + return false + } + if !data.EapFastPacsUseProactivePacUpdatePercentage.IsNull() { + return false + } + if !data.EapFastPacsAllowAnonymousProvisioning.IsNull() { + return false + } + if !data.EapFastPacsAllowAuthenticatedProvisioning.IsNull() { + return false + } + if !data.EapFastPacsServerReturns.IsNull() { + return false + } + if !data.EapFastPacsAllowClientCert.IsNull() { + return false + } + if !data.EapFastPacsAllowMachineAuthentication.IsNull() { + return false + } + if !data.EapFastPacsMachinePacTtl.IsNull() { + return false + } + if !data.EapFastPacsMachinePacTtlUnit.IsNull() { + return false + } + if !data.EapFastPacsStatelessSessionResume.IsNull() { + return false + } + if !data.EapFastPacsAuthorizationPacTtl.IsNull() { + return false + } + if !data.EapFastPacsAuthorizationPacTtlUnit.IsNull() { + return false + } + if !data.EapFastAcceptClientCert.IsNull() { + return false + } + if !data.EapFastAllowMachineAuthentication.IsNull() { + return false + } + if !data.TeapEapMsChapV2.IsNull() { + return false + } + if !data.TeapEapMsChapV2PwdChange.IsNull() { + return false + } + if !data.TeapEapMsChapV2PwdChangeRetries.IsNull() { + return false + } + if !data.TeapEapTls.IsNull() { + return false + } + if !data.TeapEapTlsAuthOfExpiredCerts.IsNull() { + return false + } + if !data.TeapEapAcceptClientCertDuringTunnelEst.IsNull() { + return false + } + if !data.TeapEapChaining.IsNull() { + return false + } + if !data.TeapDowngradeMsk.IsNull() { + return false + } + if !data.TeapRequestBasicPwdAuth.IsNull() { + return false + } + if !data.Allow5g.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_allowed_protocols_tacacs.go b/internal/provider/model_ise_allowed_protocols_tacacs.go index a6ce4b0..96df26c 100644 --- a/internal/provider/model_ise_allowed_protocols_tacacs.go +++ b/internal/provider/model_ise_allowed_protocols_tacacs.go @@ -147,3 +147,25 @@ func (data *AllowedProtocolsTACACS) updateFromBody(ctx context.Context, res gjso } //template:end updateFromBody + +//template:begin isNull +func (data *AllowedProtocolsTACACS) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.AllowPapAscii.IsNull() { + return false + } + if !data.AllowChap.IsNull() { + return false + } + if !data.AllowMsChapV1.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_authorization_profile.go b/internal/provider/model_ise_authorization_profile.go index 07e4cf8..36c83d0 100644 --- a/internal/provider/model_ise_authorization_profile.go +++ b/internal/provider/model_ise_authorization_profile.go @@ -640,3 +640,109 @@ func (data *AuthorizationProfile) updateFromBody(ctx context.Context, res gjson. } //template:end updateFromBody + +//template:begin isNull +func (data *AuthorizationProfile) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.VlanNameId.IsNull() { + return false + } + if !data.VlanTagId.IsNull() { + return false + } + if !data.WebRedirectionType.IsNull() { + return false + } + if !data.WebRedirectionAcl.IsNull() { + return false + } + if !data.WebRedirectionPortalName.IsNull() { + return false + } + if !data.WebRedirectionStaticIpHostNameFqdn.IsNull() { + return false + } + if !data.WebRedirectionDisplayCertificatesRenewalMessages.IsNull() { + return false + } + if !data.AgentlessPosture.IsNull() { + return false + } + if !data.AccessType.IsNull() { + return false + } + if !data.ProfileName.IsNull() { + return false + } + if !data.AirespaceAcl.IsNull() { + return false + } + if !data.Acl.IsNull() { + return false + } + if !data.DaclName.IsNull() { + return false + } + if !data.AutoSmartPort.IsNull() { + return false + } + if !data.InterfaceTemplate.IsNull() { + return false + } + if !data.Ipv6AclFilter.IsNull() { + return false + } + if !data.AvcProfile.IsNull() { + return false + } + if !data.AsaVpn.IsNull() { + return false + } + if !data.UniqueIdentifier.IsNull() { + return false + } + if !data.TrackMovement.IsNull() { + return false + } + if !data.ServiceTemplate.IsNull() { + return false + } + if !data.EasywiredSessionCandidate.IsNull() { + return false + } + if !data.VoiceDomainPermission.IsNull() { + return false + } + if !data.Neat.IsNull() { + return false + } + if !data.WebAuth.IsNull() { + return false + } + if !data.MacSecPolicy.IsNull() { + return false + } + if !data.ReauthenticationConnectivity.IsNull() { + return false + } + if !data.ReauthenticationTimer.IsNull() { + return false + } + if len(data.AdvancedAttributes) > 0 { + return false + } + if !data.Ipv6DaclName.IsNull() { + return false + } + if !data.AirespaceIpv6Acl.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_certificate_authentication_profile.go b/internal/provider/model_ise_certificate_authentication_profile.go index 5cb7d47..8269d79 100644 --- a/internal/provider/model_ise_certificate_authentication_profile.go +++ b/internal/provider/model_ise_certificate_authentication_profile.go @@ -161,3 +161,31 @@ func (data *CertificateAuthenticationProfile) updateFromBody(ctx context.Context } //template:end updateFromBody + +//template:begin isNull +func (data *CertificateAuthenticationProfile) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.AllowedAsUserName.IsNull() { + return false + } + if !data.ExternalIdentityStoreName.IsNull() { + return false + } + if !data.CertificateAttributeName.IsNull() { + return false + } + if !data.MatchMode.IsNull() { + return false + } + if !data.UsernameFrom.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_authentication_rule.go b/internal/provider/model_ise_device_admin_authentication_rule.go index 82c70f3..bc88ec2 100644 --- a/internal/provider/model_ise_device_admin_authentication_rule.go +++ b/internal/provider/model_ise_device_admin_authentication_rule.go @@ -600,3 +600,64 @@ func (data *DeviceAdminAuthenticationRule) updateFromBody(ctx context.Context, r } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminAuthenticationRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.IdentitySourceName.IsNull() { + return false + } + if !data.IfAuthFail.IsNull() { + return false + } + if !data.IfProcessFail.IsNull() { + return false + } + if !data.IfUserNotFound.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_authorization_exception_rule.go b/internal/provider/model_ise_device_admin_authorization_exception_rule.go index 210c54f..ebc2a86 100644 --- a/internal/provider/model_ise_device_admin_authorization_exception_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_exception_rule.go @@ -575,3 +575,58 @@ func (data *DeviceAdminAuthorizationExceptionRule) updateFromBody(ctx context.Co } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminAuthorizationExceptionRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.CommandSets.IsNull() { + return false + } + if !data.Profile.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go b/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go index dbc3989..1681fcb 100644 --- a/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_global_exception_rule.go @@ -573,3 +573,55 @@ func (data *DeviceAdminAuthorizationGlobalExceptionRule) updateFromBody(ctx cont } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminAuthorizationGlobalExceptionRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.CommandSets.IsNull() { + return false + } + if !data.Profile.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_authorization_rule.go b/internal/provider/model_ise_device_admin_authorization_rule.go index 332c4c2..f183e11 100644 --- a/internal/provider/model_ise_device_admin_authorization_rule.go +++ b/internal/provider/model_ise_device_admin_authorization_rule.go @@ -575,3 +575,58 @@ func (data *DeviceAdminAuthorizationRule) updateFromBody(ctx context.Context, re } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminAuthorizationRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.CommandSets.IsNull() { + return false + } + if !data.Profile.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_condition.go b/internal/provider/model_ise_device_admin_condition.go index 1cb3e2b..9cb11c1 100644 --- a/internal/provider/model_ise_device_admin_condition.go +++ b/internal/provider/model_ise_device_admin_condition.go @@ -555,3 +555,40 @@ func (data *DeviceAdminCondition) updateFromBody(ctx context.Context, res gjson. } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminCondition) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.IsNegate.IsNull() { + return false + } + if !data.AttributeName.IsNull() { + return false + } + if !data.AttributeValue.IsNull() { + return false + } + if !data.DictionaryName.IsNull() { + return false + } + if !data.DictionaryValue.IsNull() { + return false + } + if !data.Operator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_policy_set.go b/internal/provider/model_ise_device_admin_policy_set.go index 9fe2c02..153438c 100644 --- a/internal/provider/model_ise_device_admin_policy_set.go +++ b/internal/provider/model_ise_device_admin_policy_set.go @@ -570,3 +570,55 @@ func (data *DeviceAdminPolicySet) updateFromBody(ctx context.Context, res gjson. } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminPolicySet) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.IsProxy.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.ServiceName.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_device_admin_time_and_date_condition.go b/internal/provider/model_ise_device_admin_time_and_date_condition.go index 33682c6..1a22329 100644 --- a/internal/provider/model_ise_device_admin_time_and_date_condition.go +++ b/internal/provider/model_ise_device_admin_time_and_date_condition.go @@ -251,3 +251,49 @@ func (data *DeviceAdminTimeAndDateCondition) updateFromBody(ctx context.Context, } //template:end updateFromBody + +//template:begin isNull +func (data *DeviceAdminTimeAndDateCondition) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.IsNegate.IsNull() { + return false + } + if !data.WeekDays.IsNull() { + return false + } + if !data.WeekDaysException.IsNull() { + return false + } + if !data.StartDate.IsNull() { + return false + } + if !data.EndDate.IsNull() { + return false + } + if !data.ExceptionStartDate.IsNull() { + return false + } + if !data.ExceptionEndDate.IsNull() { + return false + } + if !data.StartTime.IsNull() { + return false + } + if !data.EndTime.IsNull() { + return false + } + if !data.ExceptionStartTime.IsNull() { + return false + } + if !data.ExceptionEndTime.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_downloadable_acl.go b/internal/provider/model_ise_downloadable_acl.go index 935d3ae..a80428f 100644 --- a/internal/provider/model_ise_downloadable_acl.go +++ b/internal/provider/model_ise_downloadable_acl.go @@ -119,3 +119,22 @@ func (data *DownloadableACL) updateFromBody(ctx context.Context, res gjson.Resul } //template:end updateFromBody + +//template:begin isNull +func (data *DownloadableACL) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.Dacl.IsNull() { + return false + } + if !data.DaclType.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_endpoint_identity_group.go b/internal/provider/model_ise_endpoint_identity_group.go index 8f8bff0..fcfd9c5 100644 --- a/internal/provider/model_ise_endpoint_identity_group.go +++ b/internal/provider/model_ise_endpoint_identity_group.go @@ -119,3 +119,22 @@ func (data *EndpointIdentityGroup) updateFromBody(ctx context.Context, res gjson } //template:end updateFromBody + +//template:begin isNull +func (data *EndpointIdentityGroup) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.SystemDefined.IsNull() { + return false + } + if !data.ParentEndpointIdentityGroupId.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_identity_source_sequence.go b/internal/provider/model_ise_identity_source_sequence.go index 183995b..848f2dc 100644 --- a/internal/provider/model_ise_identity_source_sequence.go +++ b/internal/provider/model_ise_identity_source_sequence.go @@ -191,3 +191,25 @@ func (data *IdentitySourceSequence) updateFromBody(ctx context.Context, res gjso } //template:end updateFromBody + +//template:begin isNull +func (data *IdentitySourceSequence) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.BreakOnStoreFail.IsNull() { + return false + } + if !data.CertificateAuthenticationProfile.IsNull() { + return false + } + if len(data.IdentitySources) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_internal_user.go b/internal/provider/model_ise_internal_user.go index 259e56d..def096c 100644 --- a/internal/provider/model_ise_internal_user.go +++ b/internal/provider/model_ise_internal_user.go @@ -239,3 +239,52 @@ func (data *InternalUser) updateFromBody(ctx context.Context, res gjson.Result) } //template:end updateFromBody + +//template:begin isNull +func (data *InternalUser) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Password.IsNull() { + return false + } + if !data.ChangePassword.IsNull() { + return false + } + if !data.Email.IsNull() { + return false + } + if !data.AccountNameAlias.IsNull() { + return false + } + if !data.EnablePassword.IsNull() { + return false + } + if !data.Enabled.IsNull() { + return false + } + if !data.PasswordNeverExpires.IsNull() { + return false + } + if !data.FirstName.IsNull() { + return false + } + if !data.LastName.IsNull() { + return false + } + if !data.IdentityGroups.IsNull() { + return false + } + if !data.CustomAttributes.IsNull() { + return false + } + if !data.PasswordIdStore.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_license_tier_state.go b/internal/provider/model_ise_license_tier_state.go index 68e4d2b..aae20cb 100644 --- a/internal/provider/model_ise_license_tier_state.go +++ b/internal/provider/model_ise_license_tier_state.go @@ -134,3 +134,13 @@ func (data *LicenseTierState) updateFromBody(ctx context.Context, res gjson.Resu } //template:end updateFromBody + +//template:begin isNull +func (data *LicenseTierState) isNull(ctx context.Context, res gjson.Result) bool { + if len(data.Licenses) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_authentication_rule.go b/internal/provider/model_ise_network_access_authentication_rule.go index 57e18b5..a53bde0 100644 --- a/internal/provider/model_ise_network_access_authentication_rule.go +++ b/internal/provider/model_ise_network_access_authentication_rule.go @@ -600,3 +600,64 @@ func (data *NetworkAccessAuthenticationRule) updateFromBody(ctx context.Context, } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessAuthenticationRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.IdentitySourceName.IsNull() { + return false + } + if !data.IfAuthFail.IsNull() { + return false + } + if !data.IfProcessFail.IsNull() { + return false + } + if !data.IfUserNotFound.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_authorization_exception_rule.go b/internal/provider/model_ise_network_access_authorization_exception_rule.go index eab9405..a384f9b 100644 --- a/internal/provider/model_ise_network_access_authorization_exception_rule.go +++ b/internal/provider/model_ise_network_access_authorization_exception_rule.go @@ -575,3 +575,58 @@ func (data *NetworkAccessAuthorizationExceptionRule) updateFromBody(ctx context. } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessAuthorizationExceptionRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.Profiles.IsNull() { + return false + } + if !data.SecurityGroup.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_authorization_global_exception_rule.go b/internal/provider/model_ise_network_access_authorization_global_exception_rule.go index 0ef2a41..df7ef81 100644 --- a/internal/provider/model_ise_network_access_authorization_global_exception_rule.go +++ b/internal/provider/model_ise_network_access_authorization_global_exception_rule.go @@ -573,3 +573,55 @@ func (data *NetworkAccessAuthorizationGlobalExceptionRule) updateFromBody(ctx co } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessAuthorizationGlobalExceptionRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.Profiles.IsNull() { + return false + } + if !data.SecurityGroup.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_authorization_rule.go b/internal/provider/model_ise_network_access_authorization_rule.go index ed4a54a..5b82ff8 100644 --- a/internal/provider/model_ise_network_access_authorization_rule.go +++ b/internal/provider/model_ise_network_access_authorization_rule.go @@ -575,3 +575,58 @@ func (data *NetworkAccessAuthorizationRule) updateFromBody(ctx context.Context, } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessAuthorizationRule) isNull(ctx context.Context, res gjson.Result) bool { + if !data.PolicySetId.IsNull() { + return false + } + if !data.Name.IsNull() { + return false + } + if !data.Default.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + if !data.Profiles.IsNull() { + return false + } + if !data.SecurityGroup.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_condition.go b/internal/provider/model_ise_network_access_condition.go index 0efbea0..a3c53ce 100644 --- a/internal/provider/model_ise_network_access_condition.go +++ b/internal/provider/model_ise_network_access_condition.go @@ -555,3 +555,40 @@ func (data *NetworkAccessCondition) updateFromBody(ctx context.Context, res gjso } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessCondition) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.IsNegate.IsNull() { + return false + } + if !data.AttributeName.IsNull() { + return false + } + if !data.AttributeValue.IsNull() { + return false + } + if !data.DictionaryName.IsNull() { + return false + } + if !data.DictionaryValue.IsNull() { + return false + } + if !data.Operator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_dictionary.go b/internal/provider/model_ise_network_access_dictionary.go index 3035958..fb2a336 100644 --- a/internal/provider/model_ise_network_access_dictionary.go +++ b/internal/provider/model_ise_network_access_dictionary.go @@ -119,3 +119,22 @@ func (data *NetworkAccessDictionary) updateFromBody(ctx context.Context, res gjs } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessDictionary) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.Version.IsNull() { + return false + } + if !data.DictionaryAttrType.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_policy_set.go b/internal/provider/model_ise_network_access_policy_set.go index ce3dcc8..dd20487 100644 --- a/internal/provider/model_ise_network_access_policy_set.go +++ b/internal/provider/model_ise_network_access_policy_set.go @@ -570,3 +570,55 @@ func (data *NetworkAccessPolicySet) updateFromBody(ctx context.Context, res gjso } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessPolicySet) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.IsProxy.IsNull() { + return false + } + if !data.Rank.IsNull() { + return false + } + if !data.ServiceName.IsNull() { + return false + } + if !data.State.IsNull() { + return false + } + if !data.ConditionType.IsNull() { + return false + } + if !data.ConditionId.IsNull() { + return false + } + if !data.ConditionIsNegate.IsNull() { + return false + } + if !data.ConditionAttributeName.IsNull() { + return false + } + if !data.ConditionAttributeValue.IsNull() { + return false + } + if !data.ConditionDictionaryName.IsNull() { + return false + } + if !data.ConditionDictionaryValue.IsNull() { + return false + } + if !data.ConditionOperator.IsNull() { + return false + } + if len(data.Children) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_access_time_and_date_condition.go b/internal/provider/model_ise_network_access_time_and_date_condition.go index b4be988..8fdc961 100644 --- a/internal/provider/model_ise_network_access_time_and_date_condition.go +++ b/internal/provider/model_ise_network_access_time_and_date_condition.go @@ -251,3 +251,49 @@ func (data *NetworkAccessTimeAndDateCondition) updateFromBody(ctx context.Contex } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkAccessTimeAndDateCondition) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.IsNegate.IsNull() { + return false + } + if !data.WeekDays.IsNull() { + return false + } + if !data.WeekDaysException.IsNull() { + return false + } + if !data.StartDate.IsNull() { + return false + } + if !data.EndDate.IsNull() { + return false + } + if !data.ExceptionStartDate.IsNull() { + return false + } + if !data.ExceptionEndDate.IsNull() { + return false + } + if !data.StartTime.IsNull() { + return false + } + if !data.EndTime.IsNull() { + return false + } + if !data.ExceptionStartTime.IsNull() { + return false + } + if !data.ExceptionEndTime.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_device.go b/internal/provider/model_ise_network_device.go index 10a5a52..1d8397f 100644 --- a/internal/provider/model_ise_network_device.go +++ b/internal/provider/model_ise_network_device.go @@ -715,3 +715,136 @@ func (data *NetworkDevice) updateFromBody(ctx context.Context, res gjson.Result) } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkDevice) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.AuthenticationEnableKeyWrap.IsNull() { + return false + } + if !data.AuthenticationEncryptionKey.IsNull() { + return false + } + if !data.AuthenticationEncryptionKeyFormat.IsNull() { + return false + } + if !data.AuthenticationMessageAuthenticatorCodeKey.IsNull() { + return false + } + if !data.AuthenticationNetworkProtocol.IsNull() { + return false + } + if !data.AuthenticationRadiusSharedSecret.IsNull() { + return false + } + if !data.AuthenticationEnableMultiSecret.IsNull() { + return false + } + if !data.AuthenticationSecondRadiusSharedSecret.IsNull() { + return false + } + if !data.AuthenticationDtlsRequired.IsNull() { + return false + } + if !data.CoaPort.IsNull() { + return false + } + if !data.DtlsDnsName.IsNull() { + return false + } + if len(data.Ips) > 0 { + return false + } + if !data.NetworkDeviceGroups.IsNull() { + return false + } + if !data.ModelName.IsNull() { + return false + } + if !data.SoftwareVersion.IsNull() { + return false + } + if !data.ProfileName.IsNull() { + return false + } + if !data.SnmpLinkTrapQuery.IsNull() { + return false + } + if !data.SnmpMacTrapQuery.IsNull() { + return false + } + if !data.SnmpOriginatingPolicyServiceNode.IsNull() { + return false + } + if !data.SnmpPollingInterval.IsNull() { + return false + } + if !data.SnmpRoCommunity.IsNull() { + return false + } + if !data.SnmpVersion.IsNull() { + return false + } + if !data.TacacsConnectModeOptions.IsNull() { + return false + } + if !data.TacacsSharedSecret.IsNull() { + return false + } + if !data.TrustsecDeviceId.IsNull() { + return false + } + if !data.TrustsecDevicePassword.IsNull() { + return false + } + if !data.TrustsecRestApiUsername.IsNull() { + return false + } + if !data.TrustsecRestApiPassword.IsNull() { + return false + } + if !data.TrustsecEnableModePassword.IsNull() { + return false + } + if !data.TrustsecExecModePassword.IsNull() { + return false + } + if !data.TrustsecExecModeUsername.IsNull() { + return false + } + if !data.TrustsecIncludeWhenDeployingSgtUpdates.IsNull() { + return false + } + if !data.TrustsecDownloadEnviromentDataEveryXSeconds.IsNull() { + return false + } + if !data.TrustsecDownloadPeerAuthorizationPolicyEveryXSeconds.IsNull() { + return false + } + if !data.TrustsecDownloadSgaclListsEveryXSeconds.IsNull() { + return false + } + if !data.TrustsecOtherSgaDevicesToTrustThisDevice.IsNull() { + return false + } + if !data.TrustsecReAuthenticationEveryXSeconds.IsNull() { + return false + } + if !data.TrustsecSendConfigurationToDevice.IsNull() { + return false + } + if !data.TrustsecSendConfigurationToDeviceUsing.IsNull() { + return false + } + if !data.TrustsecCoaSourceHost.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_network_device_group.go b/internal/provider/model_ise_network_device_group.go index ed3fa1f..23256ef 100644 --- a/internal/provider/model_ise_network_device_group.go +++ b/internal/provider/model_ise_network_device_group.go @@ -105,3 +105,19 @@ func (data *NetworkDeviceGroup) updateFromBody(ctx context.Context, res gjson.Re } //template:end updateFromBody + +//template:begin isNull +func (data *NetworkDeviceGroup) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.RootGroup.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_repository.go b/internal/provider/model_ise_repository.go index 66ecfe0..23a63f0 100644 --- a/internal/provider/model_ise_repository.go +++ b/internal/provider/model_ise_repository.go @@ -151,3 +151,31 @@ func (data *Repository) updateFromBody(ctx context.Context, res gjson.Result) { } //template:end updateFromBody + +//template:begin isNull +func (data *Repository) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Protocol.IsNull() { + return false + } + if !data.Path.IsNull() { + return false + } + if !data.ServerName.IsNull() { + return false + } + if !data.UserName.IsNull() { + return false + } + if !data.Password.IsNull() { + return false + } + if !data.EnablePki.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_tacacs_command_set.go b/internal/provider/model_ise_tacacs_command_set.go index c75b0c4..6a622e4 100644 --- a/internal/provider/model_ise_tacacs_command_set.go +++ b/internal/provider/model_ise_tacacs_command_set.go @@ -190,3 +190,22 @@ func (data *TACACSCommandSet) updateFromBody(ctx context.Context, res gjson.Resu } //template:end updateFromBody + +//template:begin isNull +func (data *TACACSCommandSet) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.PermitUnmatched.IsNull() { + return false + } + if len(data.Commands) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_tacacs_profile.go b/internal/provider/model_ise_tacacs_profile.go index 990e30e..44238e7 100644 --- a/internal/provider/model_ise_tacacs_profile.go +++ b/internal/provider/model_ise_tacacs_profile.go @@ -176,3 +176,19 @@ func (data *TACACSProfile) updateFromBody(ctx context.Context, res gjson.Result) } //template:end updateFromBody + +//template:begin isNull +func (data *TACACSProfile) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if len(data.SessionAttributes) > 0 { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_trustsec_egress_matrix_cell.go b/internal/provider/model_ise_trustsec_egress_matrix_cell.go index d9d1858..e205e33 100644 --- a/internal/provider/model_ise_trustsec_egress_matrix_cell.go +++ b/internal/provider/model_ise_trustsec_egress_matrix_cell.go @@ -153,3 +153,28 @@ func (data *TrustSecEgressMatrixCell) updateFromBody(ctx context.Context, res gj } //template:end updateFromBody + +//template:begin isNull +func (data *TrustSecEgressMatrixCell) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Description.IsNull() { + return false + } + if !data.DefaultRule.IsNull() { + return false + } + if !data.MatrixCellStatus.IsNull() { + return false + } + if !data.Sgacls.IsNull() { + return false + } + if !data.SourceSgtId.IsNull() { + return false + } + if !data.DestinationSgtId.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go index 8b12760..73f43f8 100644 --- a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go +++ b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping.go @@ -175,3 +175,34 @@ func (data *TrustSecIPToSGTMapping) updateFromBody(ctx context.Context, res gjso } //template:end updateFromBody + +//template:begin isNull +func (data *TrustSecIPToSGTMapping) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.DeployTo.IsNull() { + return false + } + if !data.DeployType.IsNull() { + return false + } + if !data.HostName.IsNull() { + return false + } + if !data.HostIp.IsNull() { + return false + } + if !data.Sgt.IsNull() { + return false + } + if !data.MappingGroup.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go index 39e39b1..9ce1292 100644 --- a/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go +++ b/internal/provider/model_ise_trustsec_ip_to_sgt_mapping_group.go @@ -133,3 +133,25 @@ func (data *TrustSecIPToSGTMappingGroup) updateFromBody(ctx context.Context, res } //template:end updateFromBody + +//template:begin isNull +func (data *TrustSecIPToSGTMappingGroup) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.DeployTo.IsNull() { + return false + } + if !data.DeployType.IsNull() { + return false + } + if !data.Sgt.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_trustsec_security_group.go b/internal/provider/model_ise_trustsec_security_group.go index c8721d2..8021260 100644 --- a/internal/provider/model_ise_trustsec_security_group.go +++ b/internal/provider/model_ise_trustsec_security_group.go @@ -123,3 +123,25 @@ func (data *TrustSecSecurityGroup) updateFromBody(ctx context.Context, res gjson } //template:end updateFromBody + +//template:begin isNull +func (data *TrustSecSecurityGroup) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.Value.IsNull() { + return false + } + if !data.PropogateToApic.IsNull() { + return false + } + if !data.IsReadOnly.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_trustsec_security_group_acl.go b/internal/provider/model_ise_trustsec_security_group_acl.go index 9ab5251..3457ed6 100644 --- a/internal/provider/model_ise_trustsec_security_group_acl.go +++ b/internal/provider/model_ise_trustsec_security_group_acl.go @@ -123,3 +123,25 @@ func (data *TrustSecSecurityGroupACL) updateFromBody(ctx context.Context, res gj } //template:end updateFromBody + +//template:begin isNull +func (data *TrustSecSecurityGroupACL) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.AclContent.IsNull() { + return false + } + if !data.IpVersion.IsNull() { + return false + } + if !data.ReadOnly.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/model_ise_user_identity_group.go b/internal/provider/model_ise_user_identity_group.go index 78c2589..96e1b70 100644 --- a/internal/provider/model_ise_user_identity_group.go +++ b/internal/provider/model_ise_user_identity_group.go @@ -105,3 +105,19 @@ func (data *UserIdentityGroup) updateFromBody(ctx context.Context, res gjson.Res } //template:end updateFromBody + +//template:begin isNull +func (data *UserIdentityGroup) isNull(ctx context.Context, res gjson.Result) bool { + if !data.Name.IsNull() { + return false + } + if !data.Description.IsNull() { + return false + } + if !data.Parent.IsNull() { + return false + } + return true +} + +//template:end isNull diff --git a/internal/provider/resource_ise_allowed_protocols.go b/internal/provider/resource_ise_allowed_protocols.go index a6f2f6a..8ca6d60 100644 --- a/internal/provider/resource_ise_allowed_protocols.go +++ b/internal/provider/resource_ise_allowed_protocols.go @@ -486,7 +486,12 @@ func (r *AllowedProtocolsResource) Read(ctx context.Context, req resource.ReadRe return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_allowed_protocols_tacacs.go b/internal/provider/resource_ise_allowed_protocols_tacacs.go index f91880b..c2eafe5 100644 --- a/internal/provider/resource_ise_allowed_protocols_tacacs.go +++ b/internal/provider/resource_ise_allowed_protocols_tacacs.go @@ -156,7 +156,12 @@ func (r *AllowedProtocolsTACACSResource) Read(ctx context.Context, req resource. return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_authorization_profile.go b/internal/provider/resource_ise_authorization_profile.go index 331ef44..199ac0f 100644 --- a/internal/provider/resource_ise_authorization_profile.go +++ b/internal/provider/resource_ise_authorization_profile.go @@ -338,7 +338,12 @@ func (r *AuthorizationProfileResource) Read(ctx context.Context, req resource.Re return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_certificate_authentication_profile.go b/internal/provider/resource_ise_certificate_authentication_profile.go index 805dd16..54fcd1e 100644 --- a/internal/provider/resource_ise_certificate_authentication_profile.go +++ b/internal/provider/resource_ise_certificate_authentication_profile.go @@ -187,7 +187,12 @@ func (r *CertificateAuthenticationProfileResource) Read(ctx context.Context, req return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_authentication_rule.go b/internal/provider/resource_ise_device_admin_authentication_rule.go index 806a078..f5618aa 100644 --- a/internal/provider/resource_ise_device_admin_authentication_rule.go +++ b/internal/provider/resource_ise_device_admin_authentication_rule.go @@ -318,7 +318,12 @@ func (r *DeviceAdminAuthenticationRuleResource) Read(ctx context.Context, req re return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_authorization_exception_rule.go b/internal/provider/resource_ise_device_admin_authorization_exception_rule.go index 0717102..295341e 100644 --- a/internal/provider/resource_ise_device_admin_authorization_exception_rule.go +++ b/internal/provider/resource_ise_device_admin_authorization_exception_rule.go @@ -302,7 +302,12 @@ func (r *DeviceAdminAuthorizationExceptionRuleResource) Read(ctx context.Context return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_authorization_global_exception_rule.go b/internal/provider/resource_ise_device_admin_authorization_global_exception_rule.go index 666177c..c8864d8 100644 --- a/internal/provider/resource_ise_device_admin_authorization_global_exception_rule.go +++ b/internal/provider/resource_ise_device_admin_authorization_global_exception_rule.go @@ -295,7 +295,12 @@ func (r *DeviceAdminAuthorizationGlobalExceptionRuleResource) Read(ctx context.C return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_authorization_rule.go b/internal/provider/resource_ise_device_admin_authorization_rule.go index 0d72867..96c7c2b 100644 --- a/internal/provider/resource_ise_device_admin_authorization_rule.go +++ b/internal/provider/resource_ise_device_admin_authorization_rule.go @@ -302,7 +302,12 @@ func (r *DeviceAdminAuthorizationRuleResource) Read(ctx context.Context, req res return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_condition.go b/internal/provider/resource_ise_device_admin_condition.go index e4b78df..f9dbbde 100644 --- a/internal/provider/resource_ise_device_admin_condition.go +++ b/internal/provider/resource_ise_device_admin_condition.go @@ -287,7 +287,12 @@ func (r *DeviceAdminConditionResource) Read(ctx context.Context, req resource.Re return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_policy_set.go b/internal/provider/resource_ise_device_admin_policy_set.go index 70dc9b0..7d30303 100644 --- a/internal/provider/resource_ise_device_admin_policy_set.go +++ b/internal/provider/resource_ise_device_admin_policy_set.go @@ -294,7 +294,12 @@ func (r *DeviceAdminPolicySetResource) Read(ctx context.Context, req resource.Re return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_device_admin_time_and_date_condition.go b/internal/provider/resource_ise_device_admin_time_and_date_condition.go index 41fe24c..9d99f52 100644 --- a/internal/provider/resource_ise_device_admin_time_and_date_condition.go +++ b/internal/provider/resource_ise_device_admin_time_and_date_condition.go @@ -189,7 +189,12 @@ func (r *DeviceAdminTimeAndDateConditionResource) Read(ctx context.Context, req return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_downloadable_acl.go b/internal/provider/resource_ise_downloadable_acl.go index bd98b1f..99c6ff2 100644 --- a/internal/provider/resource_ise_downloadable_acl.go +++ b/internal/provider/resource_ise_downloadable_acl.go @@ -160,7 +160,12 @@ func (r *DownloadableACLResource) Read(ctx context.Context, req resource.ReadReq return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_endpoint_identity_group.go b/internal/provider/resource_ise_endpoint_identity_group.go index 96c5c41..5d01107 100644 --- a/internal/provider/resource_ise_endpoint_identity_group.go +++ b/internal/provider/resource_ise_endpoint_identity_group.go @@ -155,7 +155,12 @@ func (r *EndpointIdentityGroupResource) Read(ctx context.Context, req resource.R return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_identity_source_sequence.go b/internal/provider/resource_ise_identity_source_sequence.go index 712484f..2f5cdfd 100644 --- a/internal/provider/resource_ise_identity_source_sequence.go +++ b/internal/provider/resource_ise_identity_source_sequence.go @@ -168,7 +168,12 @@ func (r *IdentitySourceSequenceResource) Read(ctx context.Context, req resource. return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_internal_user.go b/internal/provider/resource_ise_internal_user.go index 9a9e515..ca2474c 100644 --- a/internal/provider/resource_ise_internal_user.go +++ b/internal/provider/resource_ise_internal_user.go @@ -200,7 +200,12 @@ func (r *InternalUserResource) Read(ctx context.Context, req resource.ReadReques return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_license_tier_state.go b/internal/provider/resource_ise_license_tier_state.go index 0379292..4000ea5 100644 --- a/internal/provider/resource_ise_license_tier_state.go +++ b/internal/provider/resource_ise_license_tier_state.go @@ -159,7 +159,12 @@ func (r *LicenseTierStateResource) Read(ctx context.Context, req resource.ReadRe return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_authentication_rule.go b/internal/provider/resource_ise_network_access_authentication_rule.go index 075ff0f..b6e0ad6 100644 --- a/internal/provider/resource_ise_network_access_authentication_rule.go +++ b/internal/provider/resource_ise_network_access_authentication_rule.go @@ -318,7 +318,12 @@ func (r *NetworkAccessAuthenticationRuleResource) Read(ctx context.Context, req return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_authorization_exception_rule.go b/internal/provider/resource_ise_network_access_authorization_exception_rule.go index 228442e..3fd3000 100644 --- a/internal/provider/resource_ise_network_access_authorization_exception_rule.go +++ b/internal/provider/resource_ise_network_access_authorization_exception_rule.go @@ -302,7 +302,12 @@ func (r *NetworkAccessAuthorizationExceptionRuleResource) Read(ctx context.Conte return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_authorization_global_exception_rule.go b/internal/provider/resource_ise_network_access_authorization_global_exception_rule.go index b459c06..6783675 100644 --- a/internal/provider/resource_ise_network_access_authorization_global_exception_rule.go +++ b/internal/provider/resource_ise_network_access_authorization_global_exception_rule.go @@ -295,7 +295,12 @@ func (r *NetworkAccessAuthorizationGlobalExceptionRuleResource) Read(ctx context return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_authorization_rule.go b/internal/provider/resource_ise_network_access_authorization_rule.go index dcc43ad..7849d13 100644 --- a/internal/provider/resource_ise_network_access_authorization_rule.go +++ b/internal/provider/resource_ise_network_access_authorization_rule.go @@ -302,7 +302,12 @@ func (r *NetworkAccessAuthorizationRuleResource) Read(ctx context.Context, req r return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_condition.go b/internal/provider/resource_ise_network_access_condition.go index ff556bc..ec36216 100644 --- a/internal/provider/resource_ise_network_access_condition.go +++ b/internal/provider/resource_ise_network_access_condition.go @@ -287,7 +287,12 @@ func (r *NetworkAccessConditionResource) Read(ctx context.Context, req resource. return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_dictionary.go b/internal/provider/resource_ise_network_access_dictionary.go index 1f94a27..2930349 100644 --- a/internal/provider/resource_ise_network_access_dictionary.go +++ b/internal/provider/resource_ise_network_access_dictionary.go @@ -159,7 +159,12 @@ func (r *NetworkAccessDictionaryResource) Read(ctx context.Context, req resource return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_policy_set.go b/internal/provider/resource_ise_network_access_policy_set.go index 154ae43..6657607 100644 --- a/internal/provider/resource_ise_network_access_policy_set.go +++ b/internal/provider/resource_ise_network_access_policy_set.go @@ -294,7 +294,12 @@ func (r *NetworkAccessPolicySetResource) Read(ctx context.Context, req resource. return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_access_time_and_date_condition.go b/internal/provider/resource_ise_network_access_time_and_date_condition.go index 74be619..26a16c0 100644 --- a/internal/provider/resource_ise_network_access_time_and_date_condition.go +++ b/internal/provider/resource_ise_network_access_time_and_date_condition.go @@ -189,7 +189,12 @@ func (r *NetworkAccessTimeAndDateConditionResource) Read(ctx context.Context, re return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_device.go b/internal/provider/resource_ise_network_device.go index c9ec0c3..c83fc25 100644 --- a/internal/provider/resource_ise_network_device.go +++ b/internal/provider/resource_ise_network_device.go @@ -348,7 +348,12 @@ func (r *NetworkDeviceResource) Read(ctx context.Context, req resource.ReadReque return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_network_device_group.go b/internal/provider/resource_ise_network_device_group.go index 2c453b9..1dcd0cb 100644 --- a/internal/provider/resource_ise_network_device_group.go +++ b/internal/provider/resource_ise_network_device_group.go @@ -148,7 +148,12 @@ func (r *NetworkDeviceGroupResource) Read(ctx context.Context, req resource.Read return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_repository.go b/internal/provider/resource_ise_repository.go index 342e66a..130c2ff 100644 --- a/internal/provider/resource_ise_repository.go +++ b/internal/provider/resource_ise_repository.go @@ -171,7 +171,12 @@ func (r *RepositoryResource) Read(ctx context.Context, req resource.ReadRequest, return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_tacacs_command_set.go b/internal/provider/resource_ise_tacacs_command_set.go index a07cc96..55e5b61 100644 --- a/internal/provider/resource_ise_tacacs_command_set.go +++ b/internal/provider/resource_ise_tacacs_command_set.go @@ -176,7 +176,12 @@ func (r *TACACSCommandSetResource) Read(ctx context.Context, req resource.ReadRe return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_tacacs_profile.go b/internal/provider/resource_ise_tacacs_profile.go index 8603052..30e4880 100644 --- a/internal/provider/resource_ise_tacacs_profile.go +++ b/internal/provider/resource_ise_tacacs_profile.go @@ -169,7 +169,12 @@ func (r *TACACSProfileResource) Read(ctx context.Context, req resource.ReadReque return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_trustsec_egress_matrix_cell.go b/internal/provider/resource_ise_trustsec_egress_matrix_cell.go index 847b21a..541a314 100644 --- a/internal/provider/resource_ise_trustsec_egress_matrix_cell.go +++ b/internal/provider/resource_ise_trustsec_egress_matrix_cell.go @@ -174,7 +174,12 @@ func (r *TrustSecEgressMatrixCellResource) Read(ctx context.Context, req resourc return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping.go b/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping.go index 3081f64..31d56f3 100644 --- a/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping.go +++ b/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping.go @@ -173,7 +173,12 @@ func (r *TrustSecIPToSGTMappingResource) Read(ctx context.Context, req resource. return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping_group.go b/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping_group.go index 1923047..3bcf540 100644 --- a/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping_group.go +++ b/internal/provider/resource_ise_trustsec_ip_to_sgt_mapping_group.go @@ -161,7 +161,12 @@ func (r *TrustSecIPToSGTMappingGroupResource) Read(ctx context.Context, req reso return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_trustsec_security_group.go b/internal/provider/resource_ise_trustsec_security_group.go index 90b21b4..9d5e417 100644 --- a/internal/provider/resource_ise_trustsec_security_group.go +++ b/internal/provider/resource_ise_trustsec_security_group.go @@ -164,7 +164,12 @@ func (r *TrustSecSecurityGroupResource) Read(ctx context.Context, req resource.R return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_trustsec_security_group_acl.go b/internal/provider/resource_ise_trustsec_security_group_acl.go index d3b6625..a68166f 100644 --- a/internal/provider/resource_ise_trustsec_security_group_acl.go +++ b/internal/provider/resource_ise_trustsec_security_group_acl.go @@ -167,7 +167,12 @@ func (r *TrustSecSecurityGroupACLResource) Read(ctx context.Context, req resourc return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/internal/provider/resource_ise_user_identity_group.go b/internal/provider/resource_ise_user_identity_group.go index a79fd3d..4c1cf82 100644 --- a/internal/provider/resource_ise_user_identity_group.go +++ b/internal/provider/resource_ise_user_identity_group.go @@ -148,7 +148,12 @@ func (r *UserIdentityGroupResource) Read(ctx context.Context, req resource.ReadR return } - state.updateFromBody(ctx, res) + // If every attribute is set to null we are dealing with an import operation and therefore reading all attributes + if state.isNull(ctx, res) { + state.fromBody(ctx, res) + } else { + state.updateFromBody(ctx, res) + } tflog.Debug(ctx, fmt.Sprintf("%s: Read finished successfully", state.Id.ValueString())) diff --git a/templates/guides/changelog.md.tmpl b/templates/guides/changelog.md.tmpl index f70ac36..2d7a646 100644 --- a/templates/guides/changelog.md.tmpl +++ b/templates/guides/changelog.md.tmpl @@ -10,6 +10,7 @@ description: |- ## 0.1.10 (unreleased) - Retry on 400 and 500 HTTP errors when creating or updating objects +- Fix import operation of resources ## 0.1.9