diff --git a/CHANGELOG.md b/CHANGELOG.md index 8abae487..5873114a 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 f70ac36f..2d7a6467 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 00000000..00a21330 --- /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 0679592e..a77f834a 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 ab4f9674..92e38b01 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 df651c28..20d702c9 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 a6ce4b0e..96df26ce 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 07e4cf81..36c83d0d 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 5cb7d471..8269d799 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 82c70f38..bc88ec2a 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 210c54f7..ebc2a863 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 dbc3989c..1681fcb2 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 332c4c20..f183e115 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 1cb3e2b0..9cb11c1d 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 9fe2c02c..153438c6 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 33682c69..1a22329c 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 935d3aec..a80428f5 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 8f8bff01..fcfd9c5f 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 183995b5..848f2dcd 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 259e56d0..def096cf 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 68e4d2bd..aae20cb8 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 57e18b5a..a53bde0e 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 eab9405f..a384f9b3 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 0ef2a413..df7ef81d 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 ed4a54af..5b82ff81 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 0efbea0a..a3c53ce5 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 3035958b..fb2a336d 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 ce3dcc8c..dd20487e 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 b4be988e..8fdc9610 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 10a5a523..1d8397f7 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 ed3fa1f0..23256efb 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 66ecfe09..23a63f08 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 c75b0c4f..6a622e4e 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 990e30e2..44238e7f 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 d9d18580..e205e331 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 8b127609..73f43f8c 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 39e39b1b..9ce12928 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 c8721d2f..8021260e 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 9ab52517..3457ed65 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 78c25898..96e1b701 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 a6f2f6a3..8ca6d60c 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 f91880be..c2eafe56 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 331ef44b..199ac0f8 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 805dd162..54fcd1e1 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 806a0787..f5618aa8 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 07171029..295341e0 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 666177c7..c8864d85 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 0d728677..96c7c2ba 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 e4b78dfe..f9dbbde3 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 70dc9b04..7d30303c 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 41fe24c2..9d99f528 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 bd98b1f6..99c6ff2f 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 96c5c410..5d011076 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 712484fb..2f5cdfd9 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 9a9e515d..ca2474c1 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 0379292f..4000ea53 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 075ff0f2..b6e0ad6d 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 228442e2..3fd30005 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 b459c066..67836758 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 dcc43ade..7849d133 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 ff556bcf..ec36216f 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 1f94a27e..2930349b 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 154ae433..66576071 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 74be6199..26a16c04 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 c9ec0c38..c83fc259 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 2c453b9a..1dcd0cb7 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 342e66a7..130c2ffc 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 a07cc967..55e5b615 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 8603052b..30e4880a 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 847b21aa..541a3142 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 3081f642..31d56f34 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 1923047b..3bcf540b 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 90b21b48..9d5e4170 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 d3b66256..a68166f8 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 a79fd3d4..4c1cf827 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 f70ac36f..2d7a6467 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