// Code generated by "gen/generator.go"; DO NOT EDIT.
// In order to regenerate this file execute `go generate` from the repository root.
// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md).

package provider

import (
	"context"
	"encoding/json"
	"fmt"

	customTypes "github.com/CiscoDevNet/terraform-provider-aci/v2/internal/custom_types"
	"github.com/CiscoDevNet/terraform-provider-aci/v2/internal/validators"
	"github.com/ciscoecosystem/aci-go-client/v2/client"
	"github.com/ciscoecosystem/aci-go-client/v2/container"
	"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
	"github.com/hashicorp/terraform-plugin-framework/attr"
	"github.com/hashicorp/terraform-plugin-framework/diag"
	"github.com/hashicorp/terraform-plugin-framework/path"
	"github.com/hashicorp/terraform-plugin-framework/resource"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/objectplanmodifier"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
	"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
	"github.com/hashicorp/terraform-plugin-framework/schema/validator"
	"github.com/hashicorp/terraform-plugin-framework/types"
	"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
	"github.com/hashicorp/terraform-plugin-log/tflog"
)

// Ensure provider defined types fully satisfy framework interfaces.
var _ resource.Resource = &L3extInstPResource{}
var _ resource.ResourceWithImportState = &L3extInstPResource{}

func NewL3extInstPResource() resource.Resource {
	return &L3extInstPResource{}
}

// L3extInstPResource defines the resource implementation.
type L3extInstPResource struct {
	client *client.Client
}

// L3extInstPResourceModel describes the resource data model.
type L3extInstPResourceModel struct {
	Id                    types.String                                `tfsdk:"id"`
	ParentDn              types.String                                `tfsdk:"parent_dn"`
	Annotation            types.String                                `tfsdk:"annotation"`
	Descr                 types.String                                `tfsdk:"description"`
	ExceptionTag          types.String                                `tfsdk:"contract_exception_tag"`
	FloodOnEncap          types.String                                `tfsdk:"flood_in_encapsulation"`
	MatchT                types.String                                `tfsdk:"match_criteria"`
	Name                  types.String                                `tfsdk:"name"`
	NameAlias             types.String                                `tfsdk:"name_alias"`
	PcEnfPref             types.String                                `tfsdk:"intra_epg_isolation"`
	PcTag                 types.String                                `tfsdk:"pc_tag"`
	PrefGrMemb            types.String                                `tfsdk:"preferred_group_member"`
	Prio                  customTypes.L3extInstPPrioStringValue       `tfsdk:"priority"`
	Scope                 types.String                                `tfsdk:"scope"`
	TargetDscp            customTypes.L3extInstPTargetDscpStringValue `tfsdk:"target_dscp"`
	FvRsCons              types.Set                                   `tfsdk:"relation_to_consumed_contracts"`
	FvRsConsIf            types.Set                                   `tfsdk:"relation_to_imported_contracts"`
	FvRsCustQosPol        types.Object                                `tfsdk:"relation_to_custom_qos_policy"`
	FvRsIntraEpg          types.Set                                   `tfsdk:"relation_to_intra_epg_contracts"`
	FvRsProtBy            types.Set                                   `tfsdk:"relation_to_taboo_contracts"`
	FvRsProv              types.Set                                   `tfsdk:"relation_to_provided_contracts"`
	FvRsSecInherited      types.Set                                   `tfsdk:"relation_to_contract_masters"`
	L3extRsInstPToProfile types.Set                                   `tfsdk:"relation_to_route_control_profiles"`
	TagAnnotation         types.Set                                   `tfsdk:"annotations"`
	TagTag                types.Set                                   `tfsdk:"tags"`
}

func getEmptyL3extInstPResourceModel() *L3extInstPResourceModel {
	return &L3extInstPResourceModel{
		Id:           basetypes.NewStringNull(),
		ParentDn:     basetypes.NewStringNull(),
		Annotation:   basetypes.NewStringNull(),
		Descr:        basetypes.NewStringNull(),
		ExceptionTag: basetypes.NewStringNull(),
		FloodOnEncap: basetypes.NewStringNull(),
		MatchT:       basetypes.NewStringNull(),
		Name:         basetypes.NewStringNull(),
		NameAlias:    basetypes.NewStringNull(),
		PcEnfPref:    basetypes.NewStringNull(),
		PcTag:        basetypes.NewStringNull(),
		PrefGrMemb:   basetypes.NewStringNull(),
		Prio:         customTypes.NewL3extInstPPrioStringNull(),
		Scope:        basetypes.NewStringNull(),
		TargetDscp:   customTypes.NewL3extInstPTargetDscpStringNull(),
		FvRsCons: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":    types.StringType,
				"priority":      types.StringType,
				"contract_name": types.StringType,
				"annotations":   types.SetType{ElemType: TagAnnotationFvRsConsL3extInstPType},
				"tags":          types.SetType{ElemType: TagTagFvRsConsL3extInstPType},
			},
		}),
		FvRsConsIf: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":             types.StringType,
				"priority":               types.StringType,
				"imported_contract_name": types.StringType,
				"annotations":            types.SetType{ElemType: TagAnnotationFvRsConsIfL3extInstPType},
				"tags":                   types.SetType{ElemType: TagTagFvRsConsIfL3extInstPType},
			},
		}),
		FvRsCustQosPol: types.ObjectNull(map[string]attr.Type{
			"annotation":             types.StringType,
			"custom_qos_policy_name": types.StringType,
			"annotations":            types.SetType{ElemType: TagAnnotationFvRsCustQosPolL3extInstPType},
			"tags":                   types.SetType{ElemType: TagTagFvRsCustQosPolL3extInstPType},
		}),
		FvRsIntraEpg: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":    types.StringType,
				"contract_name": types.StringType,
				"annotations":   types.SetType{ElemType: TagAnnotationFvRsIntraEpgL3extInstPType},
				"tags":          types.SetType{ElemType: TagTagFvRsIntraEpgL3extInstPType},
			},
		}),
		FvRsProtBy: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":          types.StringType,
				"taboo_contract_name": types.StringType,
				"annotations":         types.SetType{ElemType: TagAnnotationFvRsProtByL3extInstPType},
				"tags":                types.SetType{ElemType: TagTagFvRsProtByL3extInstPType},
			},
		}),
		FvRsProv: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":     types.StringType,
				"match_criteria": types.StringType,
				"priority":       types.StringType,
				"contract_name":  types.StringType,
				"annotations":    types.SetType{ElemType: TagAnnotationFvRsProvL3extInstPType},
				"tags":           types.SetType{ElemType: TagTagFvRsProvL3extInstPType},
			},
		}),
		FvRsSecInherited: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":  types.StringType,
				"target_dn":   types.StringType,
				"annotations": types.SetType{ElemType: TagAnnotationFvRsSecInheritedL3extInstPType},
				"tags":        types.SetType{ElemType: TagTagFvRsSecInheritedL3extInstPType},
			},
		}),
		L3extRsInstPToProfile: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"annotation":                 types.StringType,
				"direction":                  types.StringType,
				"route_control_profile_name": types.StringType,
				"annotations":                types.SetType{ElemType: TagAnnotationL3extRsInstPToProfileL3extInstPType},
				"tags":                       types.SetType{ElemType: TagTagL3extRsInstPToProfileL3extInstPType},
			},
		}),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

// FvRsConsL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsConsL3extInstPResourceModel struct {
	Annotation    types.String                        `tfsdk:"annotation"`
	Prio          customTypes.FvRsConsPrioStringValue `tfsdk:"priority"`
	TnVzBrCPName  types.String                        `tfsdk:"contract_name"`
	TagAnnotation types.Set                           `tfsdk:"annotations"`
	TagTag        types.Set                           `tfsdk:"tags"`
}

func getEmptyFvRsConsL3extInstPResourceModel() FvRsConsL3extInstPResourceModel {
	return FvRsConsL3extInstPResourceModel{
		Annotation:   basetypes.NewStringNull(),
		Prio:         customTypes.NewFvRsConsPrioStringNull(),
		TnVzBrCPName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsConsL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":    types.StringType,
		"priority":      types.StringType,
		"contract_name": types.StringType,
		"annotations":   types.SetType{ElemType: TagAnnotationFvRsConsL3extInstPType},
		"tags":          types.SetType{ElemType: TagTagFvRsConsL3extInstPType},
	},
}

func FvRsConsL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsConsL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.Prio.IsNull() {
				nullInStateFound = true
				planSetValues[index].Prio = customTypes.NewFvRsConsPrioStringNull()
			}
			if stateValue.TnVzBrCPName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnVzBrCPName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsConsL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsConsL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsConsL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsConsL3extInstPResourceModel() TagAnnotationFvRsConsL3extInstPResourceModel {
	return TagAnnotationFvRsConsL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsConsL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsConsL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsConsL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsConsL3extInstPResourceModel() TagTagFvRsConsL3extInstPResourceModel {
	return TagTagFvRsConsL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsConsL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsConsIfL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsConsIfL3extInstPResourceModel struct {
	Annotation    types.String                          `tfsdk:"annotation"`
	Prio          customTypes.FvRsConsIfPrioStringValue `tfsdk:"priority"`
	TnVzCPIfName  types.String                          `tfsdk:"imported_contract_name"`
	TagAnnotation types.Set                             `tfsdk:"annotations"`
	TagTag        types.Set                             `tfsdk:"tags"`
}

func getEmptyFvRsConsIfL3extInstPResourceModel() FvRsConsIfL3extInstPResourceModel {
	return FvRsConsIfL3extInstPResourceModel{
		Annotation:   basetypes.NewStringNull(),
		Prio:         customTypes.NewFvRsConsIfPrioStringNull(),
		TnVzCPIfName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsConsIfL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":             types.StringType,
		"priority":               types.StringType,
		"imported_contract_name": types.StringType,
		"annotations":            types.SetType{ElemType: TagAnnotationFvRsConsIfL3extInstPType},
		"tags":                   types.SetType{ElemType: TagTagFvRsConsIfL3extInstPType},
	},
}

func FvRsConsIfL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsConsIfL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.Prio.IsNull() {
				nullInStateFound = true
				planSetValues[index].Prio = customTypes.NewFvRsConsIfPrioStringNull()
			}
			if stateValue.TnVzCPIfName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnVzCPIfName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsConsIfL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsConsIfL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsConsIfL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsConsIfL3extInstPResourceModel() TagAnnotationFvRsConsIfL3extInstPResourceModel {
	return TagAnnotationFvRsConsIfL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsConsIfL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsConsIfL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsConsIfL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsConsIfL3extInstPResourceModel() TagTagFvRsConsIfL3extInstPResourceModel {
	return TagTagFvRsConsIfL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsConsIfL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsCustQosPolL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsCustQosPolL3extInstPResourceModel struct {
	Annotation         types.String `tfsdk:"annotation"`
	TnQosCustomPolName types.String `tfsdk:"custom_qos_policy_name"`
	TagAnnotation      types.Set    `tfsdk:"annotations"`
	TagTag             types.Set    `tfsdk:"tags"`
}

func getEmptyFvRsCustQosPolL3extInstPResourceModel() FvRsCustQosPolL3extInstPResourceModel {
	return FvRsCustQosPolL3extInstPResourceModel{
		Annotation:         basetypes.NewStringNull(),
		TnQosCustomPolName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsCustQosPolL3extInstPType = map[string]attr.Type{
	"annotation":             types.StringType,
	"custom_qos_policy_name": types.StringType,
	"annotations":            types.SetType{ElemType: TagAnnotationFvRsCustQosPolL3extInstPType},
	"tags":                   types.SetType{ElemType: TagTagFvRsCustQosPolL3extInstPType},
}

// TagAnnotationFvRsCustQosPolL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsCustQosPolL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsCustQosPolL3extInstPResourceModel() TagAnnotationFvRsCustQosPolL3extInstPResourceModel {
	return TagAnnotationFvRsCustQosPolL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsCustQosPolL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsCustQosPolL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsCustQosPolL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsCustQosPolL3extInstPResourceModel() TagTagFvRsCustQosPolL3extInstPResourceModel {
	return TagTagFvRsCustQosPolL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsCustQosPolL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsIntraEpgL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsIntraEpgL3extInstPResourceModel struct {
	Annotation    types.String `tfsdk:"annotation"`
	TnVzBrCPName  types.String `tfsdk:"contract_name"`
	TagAnnotation types.Set    `tfsdk:"annotations"`
	TagTag        types.Set    `tfsdk:"tags"`
}

func getEmptyFvRsIntraEpgL3extInstPResourceModel() FvRsIntraEpgL3extInstPResourceModel {
	return FvRsIntraEpgL3extInstPResourceModel{
		Annotation:   basetypes.NewStringNull(),
		TnVzBrCPName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsIntraEpgL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":    types.StringType,
		"contract_name": types.StringType,
		"annotations":   types.SetType{ElemType: TagAnnotationFvRsIntraEpgL3extInstPType},
		"tags":          types.SetType{ElemType: TagTagFvRsIntraEpgL3extInstPType},
	},
}

func FvRsIntraEpgL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsIntraEpgL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.TnVzBrCPName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnVzBrCPName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsIntraEpgL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsIntraEpgL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsIntraEpgL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsIntraEpgL3extInstPResourceModel() TagAnnotationFvRsIntraEpgL3extInstPResourceModel {
	return TagAnnotationFvRsIntraEpgL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsIntraEpgL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsIntraEpgL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsIntraEpgL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsIntraEpgL3extInstPResourceModel() TagTagFvRsIntraEpgL3extInstPResourceModel {
	return TagTagFvRsIntraEpgL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsIntraEpgL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsProtByL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsProtByL3extInstPResourceModel struct {
	Annotation    types.String `tfsdk:"annotation"`
	TnVzTabooName types.String `tfsdk:"taboo_contract_name"`
	TagAnnotation types.Set    `tfsdk:"annotations"`
	TagTag        types.Set    `tfsdk:"tags"`
}

func getEmptyFvRsProtByL3extInstPResourceModel() FvRsProtByL3extInstPResourceModel {
	return FvRsProtByL3extInstPResourceModel{
		Annotation:    basetypes.NewStringNull(),
		TnVzTabooName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsProtByL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":          types.StringType,
		"taboo_contract_name": types.StringType,
		"annotations":         types.SetType{ElemType: TagAnnotationFvRsProtByL3extInstPType},
		"tags":                types.SetType{ElemType: TagTagFvRsProtByL3extInstPType},
	},
}

func FvRsProtByL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsProtByL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.TnVzTabooName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnVzTabooName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsProtByL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsProtByL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsProtByL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsProtByL3extInstPResourceModel() TagAnnotationFvRsProtByL3extInstPResourceModel {
	return TagAnnotationFvRsProtByL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsProtByL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsProtByL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsProtByL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsProtByL3extInstPResourceModel() TagTagFvRsProtByL3extInstPResourceModel {
	return TagTagFvRsProtByL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsProtByL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsProvL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsProvL3extInstPResourceModel struct {
	Annotation    types.String                        `tfsdk:"annotation"`
	MatchT        types.String                        `tfsdk:"match_criteria"`
	Prio          customTypes.FvRsProvPrioStringValue `tfsdk:"priority"`
	TnVzBrCPName  types.String                        `tfsdk:"contract_name"`
	TagAnnotation types.Set                           `tfsdk:"annotations"`
	TagTag        types.Set                           `tfsdk:"tags"`
}

func getEmptyFvRsProvL3extInstPResourceModel() FvRsProvL3extInstPResourceModel {
	return FvRsProvL3extInstPResourceModel{
		Annotation:   basetypes.NewStringNull(),
		MatchT:       basetypes.NewStringNull(),
		Prio:         customTypes.NewFvRsProvPrioStringNull(),
		TnVzBrCPName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsProvL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":     types.StringType,
		"match_criteria": types.StringType,
		"priority":       types.StringType,
		"contract_name":  types.StringType,
		"annotations":    types.SetType{ElemType: TagAnnotationFvRsProvL3extInstPType},
		"tags":           types.SetType{ElemType: TagTagFvRsProvL3extInstPType},
	},
}

func FvRsProvL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsProvL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.MatchT.IsNull() {
				nullInStateFound = true
				planSetValues[index].MatchT = basetypes.NewStringNull()
			}
			if stateValue.Prio.IsNull() {
				nullInStateFound = true
				planSetValues[index].Prio = customTypes.NewFvRsProvPrioStringNull()
			}
			if stateValue.TnVzBrCPName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnVzBrCPName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsProvL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsProvL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsProvL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsProvL3extInstPResourceModel() TagAnnotationFvRsProvL3extInstPResourceModel {
	return TagAnnotationFvRsProvL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsProvL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsProvL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsProvL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsProvL3extInstPResourceModel() TagTagFvRsProvL3extInstPResourceModel {
	return TagTagFvRsProvL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsProvL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// FvRsSecInheritedL3extInstPResourceModel describes the resource data model for the children without relation ships.
type FvRsSecInheritedL3extInstPResourceModel struct {
	Annotation    types.String `tfsdk:"annotation"`
	TDn           types.String `tfsdk:"target_dn"`
	TagAnnotation types.Set    `tfsdk:"annotations"`
	TagTag        types.Set    `tfsdk:"tags"`
}

func getEmptyFvRsSecInheritedL3extInstPResourceModel() FvRsSecInheritedL3extInstPResourceModel {
	return FvRsSecInheritedL3extInstPResourceModel{
		Annotation: basetypes.NewStringNull(),
		TDn:        basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var FvRsSecInheritedL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":  types.StringType,
		"target_dn":   types.StringType,
		"annotations": types.SetType{ElemType: TagAnnotationFvRsSecInheritedL3extInstPType},
		"tags":        types.SetType{ElemType: TagTagFvRsSecInheritedL3extInstPType},
	},
}

func FvRsSecInheritedL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []FvRsSecInheritedL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.TDn.IsNull() {
				nullInStateFound = true
				planSetValues[index].TDn = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, FvRsSecInheritedL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationFvRsSecInheritedL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationFvRsSecInheritedL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationFvRsSecInheritedL3extInstPResourceModel() TagAnnotationFvRsSecInheritedL3extInstPResourceModel {
	return TagAnnotationFvRsSecInheritedL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationFvRsSecInheritedL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagFvRsSecInheritedL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagFvRsSecInheritedL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagFvRsSecInheritedL3extInstPResourceModel() TagTagFvRsSecInheritedL3extInstPResourceModel {
	return TagTagFvRsSecInheritedL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagFvRsSecInheritedL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// L3extRsInstPToProfileL3extInstPResourceModel describes the resource data model for the children without relation ships.
type L3extRsInstPToProfileL3extInstPResourceModel struct {
	Annotation          types.String `tfsdk:"annotation"`
	Direction           types.String `tfsdk:"direction"`
	TnRtctrlProfileName types.String `tfsdk:"route_control_profile_name"`
	TagAnnotation       types.Set    `tfsdk:"annotations"`
	TagTag              types.Set    `tfsdk:"tags"`
}

func getEmptyL3extRsInstPToProfileL3extInstPResourceModel() L3extRsInstPToProfileL3extInstPResourceModel {
	return L3extRsInstPToProfileL3extInstPResourceModel{
		Annotation:          basetypes.NewStringNull(),
		Direction:           basetypes.NewStringNull(),
		TnRtctrlProfileName: basetypes.NewStringNull(),
		TagAnnotation: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
		TagTag: types.SetNull(types.ObjectType{
			AttrTypes: map[string]attr.Type{
				"key":   types.StringType,
				"value": types.StringType,
			},
		}),
	}
}

var L3extRsInstPToProfileL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"annotation":                 types.StringType,
		"direction":                  types.StringType,
		"route_control_profile_name": types.StringType,
		"annotations":                types.SetType{ElemType: TagAnnotationL3extRsInstPToProfileL3extInstPType},
		"tags":                       types.SetType{ElemType: TagTagL3extRsInstPToProfileL3extInstPType},
	},
}

func L3extRsInstPToProfileL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(ctx context.Context, planValue, stateValue types.Set) basetypes.SetValue {
	//  Function is needed to handle the case that an attribute is not yet supported in a version and gets set to null during read
	var planSetValues, stateSetValues []L3extRsInstPToProfileL3extInstPResourceModel
	stateValue.ElementsAs(ctx, &stateSetValues, false)
	planValue.ElementsAs(ctx, &planSetValues, false)

	// If the length of the state and plan values are different a change is already detected the loop can be skipped
	if len(stateSetValues) == len(planSetValues) {
		for index, stateValue := range stateSetValues {
			nullInStateFound := false
			if stateValue.Annotation.IsNull() {
				nullInStateFound = true
				planSetValues[index].Annotation = basetypes.NewStringNull()
			}
			if stateValue.Direction.IsNull() {
				nullInStateFound = true
				planSetValues[index].Direction = basetypes.NewStringNull()
			}
			if stateValue.TnRtctrlProfileName.IsNull() {
				nullInStateFound = true
				planSetValues[index].TnRtctrlProfileName = basetypes.NewStringNull()
			}
			if !nullInStateFound {
				// when there are no null fields we can conclude the version supports all attributes in set
				break
			}
		}
	}
	planSet, _ := types.SetValueFrom(ctx, L3extRsInstPToProfileL3extInstPType, planSetValues)
	return planSet

}

// TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationL3extRsInstPToProfileL3extInstPResourceModel() TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel {
	return TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationL3extRsInstPToProfileL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagL3extRsInstPToProfileL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagL3extRsInstPToProfileL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagL3extRsInstPToProfileL3extInstPResourceModel() TagTagL3extRsInstPToProfileL3extInstPResourceModel {
	return TagTagL3extRsInstPToProfileL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagL3extRsInstPToProfileL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagAnnotationL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagAnnotationL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagAnnotationL3extInstPResourceModel() TagAnnotationL3extInstPResourceModel {
	return TagAnnotationL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagAnnotationL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

// TagTagL3extInstPResourceModel describes the resource data model for the children without relation ships.
type TagTagL3extInstPResourceModel struct {
	Key   types.String `tfsdk:"key"`
	Value types.String `tfsdk:"value"`
}

func getEmptyTagTagL3extInstPResourceModel() TagTagL3extInstPResourceModel {
	return TagTagL3extInstPResourceModel{
		Key:   basetypes.NewStringNull(),
		Value: basetypes.NewStringNull(),
	}
}

var TagTagL3extInstPType = types.ObjectType{
	AttrTypes: map[string]attr.Type{
		"key":   types.StringType,
		"value": types.StringType,
	},
}

type L3extInstPIdentifier struct {
	Name types.String
}

func (r *L3extInstPResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) {
	if !req.Plan.Raw.IsNull() {
		var planData, stateData, configData *L3extInstPResourceModel
		resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...)
		resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...)
		resp.Diagnostics.Append(req.Config.Get(ctx, &configData)...)

		if resp.Diagnostics.HasError() {
			return
		}

		if (planData.Id.IsUnknown() || planData.Id.IsNull()) && !planData.ParentDn.IsUnknown() && !planData.Name.IsUnknown() {
			setL3extInstPId(ctx, planData)
		}

		if stateData == nil && !globalAllowExistingOnCreate && !planData.Id.IsUnknown() && !planData.Id.IsNull() {
			CheckDn(ctx, &resp.Diagnostics, r.client, "l3extInstP", planData.Id.ValueString())
			if resp.Diagnostics.HasError() {
				return
			}
		}
		if !configData.FvRsCustQosPol.IsNull() && stateData != nil {
			if IsEmptySingleNestedAttribute(configData.FvRsCustQosPol.Attributes()) {
				FvRsCustQosPolObject, _ := types.ObjectValueFrom(ctx, FvRsCustQosPolL3extInstPType, getEmptyFvRsCustQosPolL3extInstPResourceModel())
				planData.FvRsCustQosPol = FvRsCustQosPolObject
			}
		}

		resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...)
	}
}

func (r *L3extInstPResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) {
	tflog.Debug(ctx, "Start metadata of resource: aci_external_epg")
	resp.TypeName = req.ProviderTypeName + "_external_epg"
	tflog.Debug(ctx, "End metadata of resource: aci_external_epg")
}

func (r *L3extInstPResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
	tflog.Debug(ctx, "Start schema of resource: aci_external_epg")
	resp.Schema = schema.Schema{
		// This description is used by the documentation generator and the language server.
		MarkdownDescription: "The external_epg resource for the 'l3extInstP' class",

		Attributes: map[string]schema.Attribute{
			"id": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: "The distinguished name (DN) of the External EPG object.",
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
				},
			},
			"parent_dn": schema.StringAttribute{
				Required:            true,
				MarkdownDescription: "The distinguished name (DN) of the parent object.",
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					stringplanmodifier.RequiresReplace(),
				},
			},
			"annotation": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Default:             stringdefault.StaticString(globalAnnotation),
				MarkdownDescription: `The annotation of the External EPG object.`,
			},
			"description": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				MarkdownDescription: `The description of the External EPG object.`,
			},
			"contract_exception_tag": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				MarkdownDescription: `The contract exception tag of the External EPG object.`,
			},
			"flood_in_encapsulation": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.OneOf("disabled", "enabled"),
				},
				MarkdownDescription: `Flood L2 Multicast/Broadcast and Link Local Layer based on encapsulation.`,
			},
			"match_criteria": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.OneOf("All", "AtleastOne", "AtmostOne", "None"),
				},
				MarkdownDescription: `The provider label match criteria.`,
			},
			"name": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
					stringplanmodifier.RequiresReplace(),
				},
				Validators: []validator.String{
					MakeStringRequired(),
				},
				MarkdownDescription: `The name of the External EPG object.`,
			},
			"name_alias": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				MarkdownDescription: `The name alias of the External EPG object.`,
			},
			"intra_epg_isolation": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.OneOf("enforced", "unenforced"),
				},
				MarkdownDescription: `Parameter used to determine whether communication between endpoints within the EPG is blocked.`,
			},
			"pc_tag": schema.StringAttribute{
				Computed: true,
				Validators: []validator.String{
					stringvalidator.OneOf("any"),
				},
				MarkdownDescription: `The classification tag used for policy enforcement and zoning.`,
			},
			"preferred_group_member": schema.StringAttribute{
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.OneOf("exclude", "include"),
				},
				MarkdownDescription: `Parameter used to determine whether the EPG is part of the preferred group. Members of this group are allowed to communicate without contracts.`,
			},
			"priority": schema.StringAttribute{
				CustomType: customTypes.L3extInstPPrioStringType{},
				Optional:   true,
				Computed:   true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.Any(
						stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"),
						validators.InBetweenFromString(0, 9),
					),
				},
				MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`,
			},
			"scope": schema.StringAttribute{
				Computed:            true,
				MarkdownDescription: `The scope ID (L3-VNI) of the External EPG object.`,
			},
			"target_dscp": schema.StringAttribute{
				CustomType: customTypes.L3extInstPTargetDscpStringType{},
				Optional:   true,
				Computed:   true,
				PlanModifiers: []planmodifier.String{
					stringplanmodifier.UseStateForUnknown(),
					SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(),
				},
				Validators: []validator.String{
					stringvalidator.Any(
						stringvalidator.OneOf("AF11", "AF12", "AF13", "AF21", "AF22", "AF23", "AF31", "AF32", "AF33", "AF41", "AF42", "AF43", "CS0", "CS1", "CS2", "CS3", "CS4", "CS5", "CS6", "CS7", "EF", "VA", "unspecified"),
						validators.InBetweenFromString(0, 64),
					),
				},
				MarkdownDescription: `The target DSCP value of the External EPG object.`,
			},
			"relation_to_consumed_contracts": schema.SetNestedAttribute{
				MarkdownDescription: `The Consumer contract profile information.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsConsL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Consumed Contract object.`,
						},
						"priority": schema.StringAttribute{
							CustomType: customTypes.FvRsConsPrioStringType{},
							Optional:   true,
							Computed:   true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								stringvalidator.Any(
									stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"),
									validators.InBetweenFromString(0, 9),
								),
							},
							MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`,
						},
						"contract_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The consumer contract name.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_imported_contracts": schema.SetNestedAttribute{
				MarkdownDescription: `A contract for which the EPG will be a consumer.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsConsIfL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Imported Contract object.`,
						},
						"priority": schema.StringAttribute{
							CustomType: customTypes.FvRsConsIfPrioStringType{},
							Optional:   true,
							Computed:   true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								stringvalidator.Any(
									stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"),
									validators.InBetweenFromString(0, 9),
								),
							},
							MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`,
						},
						"imported_contract_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The contract interface name.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_custom_qos_policy": schema.SingleNestedAttribute{
				MarkdownDescription: `A source relation to a custom QoS policy that enables different levels of service to be assigned to network traffic, including specifications for the Differentiated Services Code Point (DSCP) value(s) and the 802.1p Dot1p priority. This is an internal object.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Object{
					objectplanmodifier.UseStateForUnknown(),
				},
				Attributes: map[string]schema.Attribute{
					"annotation": schema.StringAttribute{
						Optional: true,
						Computed: true,
						PlanModifiers: []planmodifier.String{
							stringplanmodifier.UseStateForUnknown(),
						},
						MarkdownDescription: `The annotation of the Relation To Custom QoS Policy object.`,
					},
					"custom_qos_policy_name": schema.StringAttribute{
						Optional: true,
						Computed: true,
						PlanModifiers: []planmodifier.String{
							stringplanmodifier.UseStateForUnknown(),
						},
						MarkdownDescription: `The Custom QoS traffic policy name.`,
					},
					"annotations": schema.SetNestedAttribute{
						MarkdownDescription: ``,
						Optional:            true,
						Computed:            true,
						PlanModifiers: []planmodifier.Set{
							setplanmodifier.UseStateForUnknown(),
						},
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"key": schema.StringAttribute{
									Optional: true,
									Computed: true,
									PlanModifiers: []planmodifier.String{
										stringplanmodifier.UseStateForUnknown(),
									},
									Validators: []validator.String{
										MakeStringRequired(),
									},
									MarkdownDescription: `The key used to uniquely identify this configuration object.`,
								},
								"value": schema.StringAttribute{
									Optional: true,
									Computed: true,
									PlanModifiers: []planmodifier.String{
										stringplanmodifier.UseStateForUnknown(),
									},
									Validators: []validator.String{
										MakeStringRequired(),
									},
									MarkdownDescription: `The value of the property.`,
								},
							},
						},
					},
					"tags": schema.SetNestedAttribute{
						MarkdownDescription: ``,
						Optional:            true,
						Computed:            true,
						PlanModifiers: []planmodifier.Set{
							setplanmodifier.UseStateForUnknown(),
						},
						NestedObject: schema.NestedAttributeObject{
							Attributes: map[string]schema.Attribute{
								"key": schema.StringAttribute{
									Optional: true,
									Computed: true,
									PlanModifiers: []planmodifier.String{
										stringplanmodifier.UseStateForUnknown(),
									},
									Validators: []validator.String{
										MakeStringRequired(),
									},
									MarkdownDescription: `The key used to uniquely identify this configuration object.`,
								},
								"value": schema.StringAttribute{
									Optional: true,
									Computed: true,
									PlanModifiers: []planmodifier.String{
										stringplanmodifier.UseStateForUnknown(),
									},
									Validators: []validator.String{
										MakeStringRequired(),
									},
									MarkdownDescription: `The value of the property.`,
								},
							},
						},
					},
				},
			},
			"relation_to_intra_epg_contracts": schema.SetNestedAttribute{
				MarkdownDescription: `Intra EPg contract:
                      Represents that the EPg is moving from "allow all within epg" mode
                      to a "deny all within epg" mode.
                      The only type of traffic allowed between EPs in this EPg is the one
                      specified by contracts EPg associates to with this relation.`,
				Optional: true,
				Computed: true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsIntraEpgL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Intra EPG Contract object.`,
						},
						"contract_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The contract name.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_taboo_contracts": schema.SetNestedAttribute{
				MarkdownDescription: `The taboo contract for which the EPG will be a provider and consumer.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsProtByL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Taboo Contract object.`,
						},
						"taboo_contract_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `A contract for denying specific classes of traffic. Taboo rules are applied in the hardware before applying the rules of regular contracts. Without a contract, the default forwarding policy is to not allow any communication between EPGs.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_provided_contracts": schema.SetNestedAttribute{
				MarkdownDescription: `A contract for which the EPG will be a provider.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsProvL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Provided Contract object.`,
						},
						"match_criteria": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								stringvalidator.OneOf("All", "AtleastOne", "AtmostOne", "None"),
							},
							MarkdownDescription: `The provider label match criteria.`,
						},
						"priority": schema.StringAttribute{
							CustomType: customTypes.FvRsProvPrioStringType{},
							Optional:   true,
							Computed:   true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								stringvalidator.Any(
									stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"),
									validators.InBetweenFromString(0, 9),
								),
							},
							MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`,
						},
						"contract_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The provider contract name.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_contract_masters": schema.SetNestedAttribute{
				MarkdownDescription: `Represents that the EPg is inheriting security configuration from another EPg`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(FvRsSecInheritedL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation To Contract Master object.`,
						},
						"target_dn": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The distinguished name of the target.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"relation_to_route_control_profiles": schema.SetNestedAttribute{
				MarkdownDescription: `A source relation to a route control profile.`,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
					SetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate(L3extRsInstPToProfileL3extInstPSetToSetNullWhenStateIsNullPlanIsUnknownDuringUpdate),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"annotation": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators:          []validator.String{},
							MarkdownDescription: `The annotation of the Relation From External EPG To Route Control Profile object.`,
						},
						"direction": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								stringvalidator.OneOf("export", "import"),
								MakeStringRequired(),
							},
							MarkdownDescription: `The direction on which to apply the Route Map associated with the Route Control Profile.`,
						},
						"route_control_profile_name": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The name of the Route Control Profile object.`,
						},
						"annotations": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
						"tags": schema.SetNestedAttribute{
							MarkdownDescription: ``,
							Optional:            true,
							Computed:            true,
							PlanModifiers: []planmodifier.Set{
								setplanmodifier.UseStateForUnknown(),
							},
							NestedObject: schema.NestedAttributeObject{
								Attributes: map[string]schema.Attribute{
									"key": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The key used to uniquely identify this configuration object.`,
									},
									"value": schema.StringAttribute{
										Optional: true,
										Computed: true,
										PlanModifiers: []planmodifier.String{
											stringplanmodifier.UseStateForUnknown(),
										},
										Validators: []validator.String{
											MakeStringRequired(),
										},
										MarkdownDescription: `The value of the property.`,
									},
								},
							},
						},
					},
				},
			},
			"annotations": schema.SetNestedAttribute{
				MarkdownDescription: ``,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"key": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The key used to uniquely identify this configuration object.`,
						},
						"value": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The value of the property.`,
						},
					},
				},
			},
			"tags": schema.SetNestedAttribute{
				MarkdownDescription: ``,
				Optional:            true,
				Computed:            true,
				PlanModifiers: []planmodifier.Set{
					setplanmodifier.UseStateForUnknown(),
				},
				NestedObject: schema.NestedAttributeObject{
					Attributes: map[string]schema.Attribute{
						"key": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The key used to uniquely identify this configuration object.`,
						},
						"value": schema.StringAttribute{
							Optional: true,
							Computed: true,
							PlanModifiers: []planmodifier.String{
								stringplanmodifier.UseStateForUnknown(),
							},
							Validators: []validator.String{
								MakeStringRequired(),
							},
							MarkdownDescription: `The value of the property.`,
						},
					},
				},
			},
		},
	}
	tflog.Debug(ctx, "End schema of resource: aci_external_epg")
}

func (r *L3extInstPResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) {
	tflog.Debug(ctx, "Start configure of resource: aci_external_epg")
	// Prevent panic if the provider has not been configured.
	if req.ProviderData == nil {
		return
	}

	client, ok := req.ProviderData.(*client.Client)

	if !ok {
		resp.Diagnostics.AddError(
			"Unexpected Resource Configure Type",
			fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData),
		)

		return
	}

	r.client = client
	tflog.Debug(ctx, "End configure of resource: aci_external_epg")
}

func (r *L3extInstPResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
	tflog.Debug(ctx, "Start create of resource: aci_external_epg")
	// On create retrieve information on current state prior to making any changes in order to determine child delete operations
	var stateData *L3extInstPResourceModel
	resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...)
	if stateData.Id.IsUnknown() || stateData.Id.IsNull() {
		setL3extInstPId(ctx, stateData)
	}
	getAndSetL3extInstPAttributes(ctx, &resp.Diagnostics, r.client, stateData)
	if !globalAllowExistingOnCreate && !stateData.Id.IsNull() {
		resp.Diagnostics.AddError(
			"Object Already Exists",
			fmt.Sprintf("The l3extInstP object with DN '%s' already exists.", stateData.Id.ValueString()),
		)
		return
	}

	var data *L3extInstPResourceModel

	// Read Terraform plan data into the model
	resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...)

	if resp.Diagnostics.HasError() {
		return
	}

	if data.Id.IsUnknown() || data.Id.IsNull() {
		setL3extInstPId(ctx, data)
	}

	tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_external_epg with id '%s'", data.Id.ValueString()))

	var fvRsConsPlan, fvRsConsState []FvRsConsL3extInstPResourceModel
	data.FvRsCons.ElementsAs(ctx, &fvRsConsPlan, false)
	stateData.FvRsCons.ElementsAs(ctx, &fvRsConsState, false)
	var fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfL3extInstPResourceModel
	data.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfPlan, false)
	stateData.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfState, false)
	var fvRsCustQosPolPlan, fvRsCustQosPolState FvRsCustQosPolL3extInstPResourceModel
	data.FvRsCustQosPol.As(ctx, &fvRsCustQosPolPlan, basetypes.ObjectAsOptions{})
	stateData.FvRsCustQosPol.As(ctx, &fvRsCustQosPolState, basetypes.ObjectAsOptions{})
	var fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgL3extInstPResourceModel
	data.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgPlan, false)
	stateData.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgState, false)
	var fvRsProtByPlan, fvRsProtByState []FvRsProtByL3extInstPResourceModel
	data.FvRsProtBy.ElementsAs(ctx, &fvRsProtByPlan, false)
	stateData.FvRsProtBy.ElementsAs(ctx, &fvRsProtByState, false)
	var fvRsProvPlan, fvRsProvState []FvRsProvL3extInstPResourceModel
	data.FvRsProv.ElementsAs(ctx, &fvRsProvPlan, false)
	stateData.FvRsProv.ElementsAs(ctx, &fvRsProvState, false)
	var fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedL3extInstPResourceModel
	data.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedPlan, false)
	stateData.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedState, false)
	var l3extRsInstPToProfilePlan, l3extRsInstPToProfileState []L3extRsInstPToProfileL3extInstPResourceModel
	data.L3extRsInstPToProfile.ElementsAs(ctx, &l3extRsInstPToProfilePlan, false)
	stateData.L3extRsInstPToProfile.ElementsAs(ctx, &l3extRsInstPToProfileState, false)
	var tagAnnotationPlan, tagAnnotationState []TagAnnotationL3extInstPResourceModel
	data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false)
	stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false)
	var tagTagPlan, tagTagState []TagTagL3extInstPResourceModel
	data.TagTag.ElementsAs(ctx, &tagTagPlan, false)
	stateData.TagTag.ElementsAs(ctx, &tagTagState, false)
	jsonPayload := getL3extInstPCreateJsonPayload(ctx, &resp.Diagnostics, true, data, fvRsConsPlan, fvRsConsState, fvRsConsIfPlan, fvRsConsIfState, fvRsCustQosPolPlan, fvRsCustQosPolState, fvRsIntraEpgPlan, fvRsIntraEpgState, fvRsProtByPlan, fvRsProtByState, fvRsProvPlan, fvRsProvState, fvRsSecInheritedPlan, fvRsSecInheritedState, l3extRsInstPToProfilePlan, l3extRsInstPToProfileState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState)

	if resp.Diagnostics.HasError() {
		return
	}

	DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload)

	if resp.Diagnostics.HasError() {
		return
	}

	getAndSetL3extInstPAttributes(ctx, &resp.Diagnostics, r.client, data)

	// Save data into Terraform state
	resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
	tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_external_epg with id '%s'", data.Id.ValueString()))
}

func (r *L3extInstPResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) {
	tflog.Debug(ctx, "Start read of resource: aci_external_epg")
	var data *L3extInstPResourceModel

	// Read Terraform prior state data into the model
	resp.Diagnostics.Append(req.State.Get(ctx, &data)...)

	if resp.Diagnostics.HasError() {
		return
	}

	tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_external_epg with id '%s'", data.Id.ValueString()))

	getAndSetL3extInstPAttributes(ctx, &resp.Diagnostics, r.client, data)

	// Save updated data into Terraform state
	if data.Id.IsNull() {
		var emptyData *L3extInstPResourceModel
		resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...)
	} else {
		resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
	}

	tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_external_epg with id '%s'", data.Id.ValueString()))
}

func (r *L3extInstPResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
	tflog.Debug(ctx, "Start update of resource: aci_external_epg")
	var data *L3extInstPResourceModel
	var stateData *L3extInstPResourceModel

	// Read Terraform plan data into the model
	resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...)
	resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...)
	// Error out when child object fvRsCustQosPol is being deleted
	if IsEmptySingleNestedAttribute(data.FvRsCustQosPol.Attributes()) && !IsEmptySingleNestedAttribute(stateData.FvRsCustQosPol.Attributes()) {
		resp.Diagnostics.AddError(
			"FvRsCustQosPol object cannot be deleted",
			"deletion of child is only possible upon deletion of the parent",
		)
	}

	if resp.Diagnostics.HasError() {
		return
	}

	tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_external_epg with id '%s'", data.Id.ValueString()))

	var fvRsConsPlan, fvRsConsState []FvRsConsL3extInstPResourceModel
	data.FvRsCons.ElementsAs(ctx, &fvRsConsPlan, false)
	stateData.FvRsCons.ElementsAs(ctx, &fvRsConsState, false)
	var fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfL3extInstPResourceModel
	data.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfPlan, false)
	stateData.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfState, false)
	var fvRsCustQosPolPlan, fvRsCustQosPolState FvRsCustQosPolL3extInstPResourceModel
	data.FvRsCustQosPol.As(ctx, &fvRsCustQosPolPlan, basetypes.ObjectAsOptions{})
	stateData.FvRsCustQosPol.As(ctx, &fvRsCustQosPolState, basetypes.ObjectAsOptions{})
	var fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgL3extInstPResourceModel
	data.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgPlan, false)
	stateData.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgState, false)
	var fvRsProtByPlan, fvRsProtByState []FvRsProtByL3extInstPResourceModel
	data.FvRsProtBy.ElementsAs(ctx, &fvRsProtByPlan, false)
	stateData.FvRsProtBy.ElementsAs(ctx, &fvRsProtByState, false)
	var fvRsProvPlan, fvRsProvState []FvRsProvL3extInstPResourceModel
	data.FvRsProv.ElementsAs(ctx, &fvRsProvPlan, false)
	stateData.FvRsProv.ElementsAs(ctx, &fvRsProvState, false)
	var fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedL3extInstPResourceModel
	data.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedPlan, false)
	stateData.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedState, false)
	var l3extRsInstPToProfilePlan, l3extRsInstPToProfileState []L3extRsInstPToProfileL3extInstPResourceModel
	data.L3extRsInstPToProfile.ElementsAs(ctx, &l3extRsInstPToProfilePlan, false)
	stateData.L3extRsInstPToProfile.ElementsAs(ctx, &l3extRsInstPToProfileState, false)
	var tagAnnotationPlan, tagAnnotationState []TagAnnotationL3extInstPResourceModel
	data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false)
	stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false)
	var tagTagPlan, tagTagState []TagTagL3extInstPResourceModel
	data.TagTag.ElementsAs(ctx, &tagTagPlan, false)
	stateData.TagTag.ElementsAs(ctx, &tagTagState, false)
	jsonPayload := getL3extInstPCreateJsonPayload(ctx, &resp.Diagnostics, false, data, fvRsConsPlan, fvRsConsState, fvRsConsIfPlan, fvRsConsIfState, fvRsCustQosPolPlan, fvRsCustQosPolState, fvRsIntraEpgPlan, fvRsIntraEpgState, fvRsProtByPlan, fvRsProtByState, fvRsProvPlan, fvRsProvState, fvRsSecInheritedPlan, fvRsSecInheritedState, l3extRsInstPToProfilePlan, l3extRsInstPToProfileState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState)

	if resp.Diagnostics.HasError() {
		return
	}

	DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload)

	if resp.Diagnostics.HasError() {
		return
	}

	getAndSetL3extInstPAttributes(ctx, &resp.Diagnostics, r.client, data)

	// Save updated data into Terraform state
	resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)
	tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_external_epg with id '%s'", data.Id.ValueString()))
}

func (r *L3extInstPResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {
	tflog.Debug(ctx, "Start delete of resource: aci_external_epg")
	var data *L3extInstPResourceModel

	// Read Terraform prior state data into the model
	resp.Diagnostics.Append(req.State.Get(ctx, &data)...)

	if resp.Diagnostics.HasError() {
		return
	}

	tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_external_epg with id '%s'", data.Id.ValueString()))
	jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "l3extInstP", data.Id.ValueString())
	if resp.Diagnostics.HasError() {
		return
	}
	DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload)
	if resp.Diagnostics.HasError() {
		return
	}
	tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_external_epg with id '%s'", data.Id.ValueString()))
}

func (r *L3extInstPResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
	tflog.Debug(ctx, "Start import state of resource: aci_external_epg")
	resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)

	var stateData *L3extInstPResourceModel
	resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...)
	tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_external_epg with id '%s'", stateData.Id.ValueString()))

	tflog.Debug(ctx, "End import of state resource: aci_external_epg")
}

func getAndSetL3extInstPAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *L3extInstPResourceModel) {
	requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=full&rsp-subtree-class=%s", data.Id.ValueString(), "l3extInstP,fvRsCons,fvRsConsIf,fvRsCustQosPol,fvRsIntraEpg,fvRsProtBy,fvRsProv,fvRsSecInherited,l3extRsInstPToProfile,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag,tagAnnotation,tagTag"), "GET", nil)

	readData := getEmptyL3extInstPResourceModel()

	if diags.HasError() {
		return
	}
	if requestData.Search("imdata").Search("l3extInstP").Data() != nil {
		classReadInfo := requestData.Search("imdata").Search("l3extInstP").Data().([]interface{})
		if len(classReadInfo) == 1 {
			attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{})
			for attributeName, attributeValue := range attributes {
				if attributeName == "dn" {
					readData.Id = basetypes.NewStringValue(attributeValue.(string))
					setL3extInstPParentDn(ctx, attributeValue.(string), readData)
				}
				if attributeName == "annotation" {
					readData.Annotation = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "descr" {
					readData.Descr = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "exceptionTag" {
					readData.ExceptionTag = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "floodOnEncap" {
					readData.FloodOnEncap = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "matchT" {
					readData.MatchT = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "name" {
					readData.Name = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "nameAlias" {
					readData.NameAlias = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "pcEnfPref" {
					readData.PcEnfPref = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "pcTag" {
					readData.PcTag = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "prefGrMemb" {
					readData.PrefGrMemb = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "prio" {
					readData.Prio = customTypes.NewL3extInstPPrioStringValue(attributeValue.(string))
				}
				if attributeName == "scope" {
					readData.Scope = basetypes.NewStringValue(attributeValue.(string))
				}
				if attributeName == "targetDscp" {
					readData.TargetDscp = customTypes.NewL3extInstPTargetDscpStringValue(attributeValue.(string))
				}
			}
			FvRsConsL3extInstPList := make([]FvRsConsL3extInstPResourceModel, 0)
			FvRsConsIfL3extInstPList := make([]FvRsConsIfL3extInstPResourceModel, 0)
			FvRsCustQosPolL3extInstPList := make([]FvRsCustQosPolL3extInstPResourceModel, 0)
			FvRsIntraEpgL3extInstPList := make([]FvRsIntraEpgL3extInstPResourceModel, 0)
			FvRsProtByL3extInstPList := make([]FvRsProtByL3extInstPResourceModel, 0)
			FvRsProvL3extInstPList := make([]FvRsProvL3extInstPResourceModel, 0)
			FvRsSecInheritedL3extInstPList := make([]FvRsSecInheritedL3extInstPResourceModel, 0)
			L3extRsInstPToProfileL3extInstPList := make([]L3extRsInstPToProfileL3extInstPResourceModel, 0)
			TagAnnotationL3extInstPList := make([]TagAnnotationL3extInstPResourceModel, 0)
			TagTagL3extInstPList := make([]TagTagL3extInstPResourceModel, 0)
			_, ok := classReadInfo[0].(map[string]interface{})["children"]
			if ok {
				children := classReadInfo[0].(map[string]interface{})["children"].([]interface{})
				for _, child := range children {
					for childClassName, childClassDetails := range child.(map[string]interface{}) {
						childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{})
						if childClassName == "fvRsCons" {
							FvRsConsL3extInstP := getEmptyFvRsConsL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsConsL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "prio" {
									FvRsConsL3extInstP.Prio = customTypes.NewFvRsConsPrioStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnVzBrCPName" {
									FvRsConsL3extInstP.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsConsL3extInstPList := make([]TagAnnotationFvRsConsL3extInstPResourceModel, 0)
							TagTagFvRsConsL3extInstPList := make([]TagTagFvRsConsL3extInstPResourceModel, 0)
							childrenOfFvRsConsL3extInstP, childrenOfFvRsConsL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsConsL3extInstPExist {
								for _, childFvRsConsL3extInstP := range childrenOfFvRsConsL3extInstP.([]interface{}) {
									for childClassNameFvRsConsL3extInstP, childClassDetailsFvRsConsL3extInstP := range childFvRsConsL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsConsL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsConsL3extInstP := getEmptyTagAnnotationFvRsConsL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsConsL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsConsL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsConsL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsConsL3extInstPList = append(TagAnnotationFvRsConsL3extInstPList, TagAnnotationFvRsConsL3extInstP)
										}
										if childClassNameFvRsConsL3extInstP == "tagTag" {
											TagTagFvRsConsL3extInstP := getEmptyTagTagFvRsConsL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsConsL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsConsL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsConsL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsConsL3extInstPList = append(TagTagFvRsConsL3extInstPList, TagTagFvRsConsL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsConsL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsConsL3extInstPType, TagAnnotationFvRsConsL3extInstPList)
							FvRsConsL3extInstP.TagAnnotation = TagAnnotationFvRsConsL3extInstPSet
							TagTagFvRsConsL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsConsL3extInstPType, TagTagFvRsConsL3extInstPList)
							FvRsConsL3extInstP.TagTag = TagTagFvRsConsL3extInstPSet
							FvRsConsL3extInstPList = append(FvRsConsL3extInstPList, FvRsConsL3extInstP)
						}
						if childClassName == "fvRsConsIf" {
							FvRsConsIfL3extInstP := getEmptyFvRsConsIfL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsConsIfL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "prio" {
									FvRsConsIfL3extInstP.Prio = customTypes.NewFvRsConsIfPrioStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnVzCPIfName" {
									FvRsConsIfL3extInstP.TnVzCPIfName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsConsIfL3extInstPList := make([]TagAnnotationFvRsConsIfL3extInstPResourceModel, 0)
							TagTagFvRsConsIfL3extInstPList := make([]TagTagFvRsConsIfL3extInstPResourceModel, 0)
							childrenOfFvRsConsIfL3extInstP, childrenOfFvRsConsIfL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsConsIfL3extInstPExist {
								for _, childFvRsConsIfL3extInstP := range childrenOfFvRsConsIfL3extInstP.([]interface{}) {
									for childClassNameFvRsConsIfL3extInstP, childClassDetailsFvRsConsIfL3extInstP := range childFvRsConsIfL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsConsIfL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsConsIfL3extInstP := getEmptyTagAnnotationFvRsConsIfL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsConsIfL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsConsIfL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsConsIfL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsConsIfL3extInstPList = append(TagAnnotationFvRsConsIfL3extInstPList, TagAnnotationFvRsConsIfL3extInstP)
										}
										if childClassNameFvRsConsIfL3extInstP == "tagTag" {
											TagTagFvRsConsIfL3extInstP := getEmptyTagTagFvRsConsIfL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsConsIfL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsConsIfL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsConsIfL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsConsIfL3extInstPList = append(TagTagFvRsConsIfL3extInstPList, TagTagFvRsConsIfL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsConsIfL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsConsIfL3extInstPType, TagAnnotationFvRsConsIfL3extInstPList)
							FvRsConsIfL3extInstP.TagAnnotation = TagAnnotationFvRsConsIfL3extInstPSet
							TagTagFvRsConsIfL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsConsIfL3extInstPType, TagTagFvRsConsIfL3extInstPList)
							FvRsConsIfL3extInstP.TagTag = TagTagFvRsConsIfL3extInstPSet
							FvRsConsIfL3extInstPList = append(FvRsConsIfL3extInstPList, FvRsConsIfL3extInstP)
						}
						if childClassName == "fvRsCustQosPol" {
							FvRsCustQosPolL3extInstP := getEmptyFvRsCustQosPolL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsCustQosPolL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnQosCustomPolName" {
									FvRsCustQosPolL3extInstP.TnQosCustomPolName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsCustQosPolL3extInstPList := make([]TagAnnotationFvRsCustQosPolL3extInstPResourceModel, 0)
							TagTagFvRsCustQosPolL3extInstPList := make([]TagTagFvRsCustQosPolL3extInstPResourceModel, 0)
							childrenOfFvRsCustQosPolL3extInstP, childrenOfFvRsCustQosPolL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsCustQosPolL3extInstPExist {
								for _, childFvRsCustQosPolL3extInstP := range childrenOfFvRsCustQosPolL3extInstP.([]interface{}) {
									for childClassNameFvRsCustQosPolL3extInstP, childClassDetailsFvRsCustQosPolL3extInstP := range childFvRsCustQosPolL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsCustQosPolL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsCustQosPolL3extInstP := getEmptyTagAnnotationFvRsCustQosPolL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsCustQosPolL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsCustQosPolL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsCustQosPolL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsCustQosPolL3extInstPList = append(TagAnnotationFvRsCustQosPolL3extInstPList, TagAnnotationFvRsCustQosPolL3extInstP)
										}
										if childClassNameFvRsCustQosPolL3extInstP == "tagTag" {
											TagTagFvRsCustQosPolL3extInstP := getEmptyTagTagFvRsCustQosPolL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsCustQosPolL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsCustQosPolL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsCustQosPolL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsCustQosPolL3extInstPList = append(TagTagFvRsCustQosPolL3extInstPList, TagTagFvRsCustQosPolL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsCustQosPolL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsCustQosPolL3extInstPType, TagAnnotationFvRsCustQosPolL3extInstPList)
							FvRsCustQosPolL3extInstP.TagAnnotation = TagAnnotationFvRsCustQosPolL3extInstPSet
							TagTagFvRsCustQosPolL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsCustQosPolL3extInstPType, TagTagFvRsCustQosPolL3extInstPList)
							FvRsCustQosPolL3extInstP.TagTag = TagTagFvRsCustQosPolL3extInstPSet
							FvRsCustQosPolL3extInstPList = append(FvRsCustQosPolL3extInstPList, FvRsCustQosPolL3extInstP)
						}
						if childClassName == "fvRsIntraEpg" {
							FvRsIntraEpgL3extInstP := getEmptyFvRsIntraEpgL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsIntraEpgL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnVzBrCPName" {
									FvRsIntraEpgL3extInstP.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsIntraEpgL3extInstPList := make([]TagAnnotationFvRsIntraEpgL3extInstPResourceModel, 0)
							TagTagFvRsIntraEpgL3extInstPList := make([]TagTagFvRsIntraEpgL3extInstPResourceModel, 0)
							childrenOfFvRsIntraEpgL3extInstP, childrenOfFvRsIntraEpgL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsIntraEpgL3extInstPExist {
								for _, childFvRsIntraEpgL3extInstP := range childrenOfFvRsIntraEpgL3extInstP.([]interface{}) {
									for childClassNameFvRsIntraEpgL3extInstP, childClassDetailsFvRsIntraEpgL3extInstP := range childFvRsIntraEpgL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsIntraEpgL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsIntraEpgL3extInstP := getEmptyTagAnnotationFvRsIntraEpgL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsIntraEpgL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsIntraEpgL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsIntraEpgL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsIntraEpgL3extInstPList = append(TagAnnotationFvRsIntraEpgL3extInstPList, TagAnnotationFvRsIntraEpgL3extInstP)
										}
										if childClassNameFvRsIntraEpgL3extInstP == "tagTag" {
											TagTagFvRsIntraEpgL3extInstP := getEmptyTagTagFvRsIntraEpgL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsIntraEpgL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsIntraEpgL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsIntraEpgL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsIntraEpgL3extInstPList = append(TagTagFvRsIntraEpgL3extInstPList, TagTagFvRsIntraEpgL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsIntraEpgL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsIntraEpgL3extInstPType, TagAnnotationFvRsIntraEpgL3extInstPList)
							FvRsIntraEpgL3extInstP.TagAnnotation = TagAnnotationFvRsIntraEpgL3extInstPSet
							TagTagFvRsIntraEpgL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsIntraEpgL3extInstPType, TagTagFvRsIntraEpgL3extInstPList)
							FvRsIntraEpgL3extInstP.TagTag = TagTagFvRsIntraEpgL3extInstPSet
							FvRsIntraEpgL3extInstPList = append(FvRsIntraEpgL3extInstPList, FvRsIntraEpgL3extInstP)
						}
						if childClassName == "fvRsProtBy" {
							FvRsProtByL3extInstP := getEmptyFvRsProtByL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsProtByL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnVzTabooName" {
									FvRsProtByL3extInstP.TnVzTabooName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsProtByL3extInstPList := make([]TagAnnotationFvRsProtByL3extInstPResourceModel, 0)
							TagTagFvRsProtByL3extInstPList := make([]TagTagFvRsProtByL3extInstPResourceModel, 0)
							childrenOfFvRsProtByL3extInstP, childrenOfFvRsProtByL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsProtByL3extInstPExist {
								for _, childFvRsProtByL3extInstP := range childrenOfFvRsProtByL3extInstP.([]interface{}) {
									for childClassNameFvRsProtByL3extInstP, childClassDetailsFvRsProtByL3extInstP := range childFvRsProtByL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsProtByL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsProtByL3extInstP := getEmptyTagAnnotationFvRsProtByL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsProtByL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsProtByL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsProtByL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsProtByL3extInstPList = append(TagAnnotationFvRsProtByL3extInstPList, TagAnnotationFvRsProtByL3extInstP)
										}
										if childClassNameFvRsProtByL3extInstP == "tagTag" {
											TagTagFvRsProtByL3extInstP := getEmptyTagTagFvRsProtByL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsProtByL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsProtByL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsProtByL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsProtByL3extInstPList = append(TagTagFvRsProtByL3extInstPList, TagTagFvRsProtByL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsProtByL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsProtByL3extInstPType, TagAnnotationFvRsProtByL3extInstPList)
							FvRsProtByL3extInstP.TagAnnotation = TagAnnotationFvRsProtByL3extInstPSet
							TagTagFvRsProtByL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsProtByL3extInstPType, TagTagFvRsProtByL3extInstPList)
							FvRsProtByL3extInstP.TagTag = TagTagFvRsProtByL3extInstPSet
							FvRsProtByL3extInstPList = append(FvRsProtByL3extInstPList, FvRsProtByL3extInstP)
						}
						if childClassName == "fvRsProv" {
							FvRsProvL3extInstP := getEmptyFvRsProvL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsProvL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "matchT" {
									FvRsProvL3extInstP.MatchT = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "prio" {
									FvRsProvL3extInstP.Prio = customTypes.NewFvRsProvPrioStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnVzBrCPName" {
									FvRsProvL3extInstP.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsProvL3extInstPList := make([]TagAnnotationFvRsProvL3extInstPResourceModel, 0)
							TagTagFvRsProvL3extInstPList := make([]TagTagFvRsProvL3extInstPResourceModel, 0)
							childrenOfFvRsProvL3extInstP, childrenOfFvRsProvL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsProvL3extInstPExist {
								for _, childFvRsProvL3extInstP := range childrenOfFvRsProvL3extInstP.([]interface{}) {
									for childClassNameFvRsProvL3extInstP, childClassDetailsFvRsProvL3extInstP := range childFvRsProvL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsProvL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsProvL3extInstP := getEmptyTagAnnotationFvRsProvL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsProvL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsProvL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsProvL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsProvL3extInstPList = append(TagAnnotationFvRsProvL3extInstPList, TagAnnotationFvRsProvL3extInstP)
										}
										if childClassNameFvRsProvL3extInstP == "tagTag" {
											TagTagFvRsProvL3extInstP := getEmptyTagTagFvRsProvL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsProvL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsProvL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsProvL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsProvL3extInstPList = append(TagTagFvRsProvL3extInstPList, TagTagFvRsProvL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsProvL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsProvL3extInstPType, TagAnnotationFvRsProvL3extInstPList)
							FvRsProvL3extInstP.TagAnnotation = TagAnnotationFvRsProvL3extInstPSet
							TagTagFvRsProvL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsProvL3extInstPType, TagTagFvRsProvL3extInstPList)
							FvRsProvL3extInstP.TagTag = TagTagFvRsProvL3extInstPSet
							FvRsProvL3extInstPList = append(FvRsProvL3extInstPList, FvRsProvL3extInstP)
						}
						if childClassName == "fvRsSecInherited" {
							FvRsSecInheritedL3extInstP := getEmptyFvRsSecInheritedL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									FvRsSecInheritedL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tDn" {
									FvRsSecInheritedL3extInstP.TDn = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationFvRsSecInheritedL3extInstPList := make([]TagAnnotationFvRsSecInheritedL3extInstPResourceModel, 0)
							TagTagFvRsSecInheritedL3extInstPList := make([]TagTagFvRsSecInheritedL3extInstPResourceModel, 0)
							childrenOfFvRsSecInheritedL3extInstP, childrenOfFvRsSecInheritedL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfFvRsSecInheritedL3extInstPExist {
								for _, childFvRsSecInheritedL3extInstP := range childrenOfFvRsSecInheritedL3extInstP.([]interface{}) {
									for childClassNameFvRsSecInheritedL3extInstP, childClassDetailsFvRsSecInheritedL3extInstP := range childFvRsSecInheritedL3extInstP.(map[string]interface{}) {
										if childClassNameFvRsSecInheritedL3extInstP == "tagAnnotation" {
											TagAnnotationFvRsSecInheritedL3extInstP := getEmptyTagAnnotationFvRsSecInheritedL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsFvRsSecInheritedL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationFvRsSecInheritedL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationFvRsSecInheritedL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationFvRsSecInheritedL3extInstPList = append(TagAnnotationFvRsSecInheritedL3extInstPList, TagAnnotationFvRsSecInheritedL3extInstP)
										}
										if childClassNameFvRsSecInheritedL3extInstP == "tagTag" {
											TagTagFvRsSecInheritedL3extInstP := getEmptyTagTagFvRsSecInheritedL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsFvRsSecInheritedL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagFvRsSecInheritedL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagFvRsSecInheritedL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagFvRsSecInheritedL3extInstPList = append(TagTagFvRsSecInheritedL3extInstPList, TagTagFvRsSecInheritedL3extInstP)
										}
									}
								}
							}
							TagAnnotationFvRsSecInheritedL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationFvRsSecInheritedL3extInstPType, TagAnnotationFvRsSecInheritedL3extInstPList)
							FvRsSecInheritedL3extInstP.TagAnnotation = TagAnnotationFvRsSecInheritedL3extInstPSet
							TagTagFvRsSecInheritedL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagFvRsSecInheritedL3extInstPType, TagTagFvRsSecInheritedL3extInstPList)
							FvRsSecInheritedL3extInstP.TagTag = TagTagFvRsSecInheritedL3extInstPSet
							FvRsSecInheritedL3extInstPList = append(FvRsSecInheritedL3extInstPList, FvRsSecInheritedL3extInstP)
						}
						if childClassName == "l3extRsInstPToProfile" {
							L3extRsInstPToProfileL3extInstP := getEmptyL3extRsInstPToProfileL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "annotation" {
									L3extRsInstPToProfileL3extInstP.Annotation = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "direction" {
									L3extRsInstPToProfileL3extInstP.Direction = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "tnRtctrlProfileName" {
									L3extRsInstPToProfileL3extInstP.TnRtctrlProfileName = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationL3extRsInstPToProfileL3extInstPList := make([]TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel, 0)
							TagTagL3extRsInstPToProfileL3extInstPList := make([]TagTagL3extRsInstPToProfileL3extInstPResourceModel, 0)
							childrenOfL3extRsInstPToProfileL3extInstP, childrenOfL3extRsInstPToProfileL3extInstPExist := childClassDetails.(map[string]interface{})["children"]
							if childrenOfL3extRsInstPToProfileL3extInstPExist {
								for _, childL3extRsInstPToProfileL3extInstP := range childrenOfL3extRsInstPToProfileL3extInstP.([]interface{}) {
									for childClassNameL3extRsInstPToProfileL3extInstP, childClassDetailsL3extRsInstPToProfileL3extInstP := range childL3extRsInstPToProfileL3extInstP.(map[string]interface{}) {
										if childClassNameL3extRsInstPToProfileL3extInstP == "tagAnnotation" {
											TagAnnotationL3extRsInstPToProfileL3extInstP := getEmptyTagAnnotationL3extRsInstPToProfileL3extInstPResourceModel()
											tagAnnotationchildAttributeValue := childClassDetailsL3extRsInstPToProfileL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagAnnotationchildAttributeValue {
												if childAttributeName == "key" {
													TagAnnotationL3extRsInstPToProfileL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagAnnotationL3extRsInstPToProfileL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagAnnotationL3extRsInstPToProfileL3extInstPList = append(TagAnnotationL3extRsInstPToProfileL3extInstPList, TagAnnotationL3extRsInstPToProfileL3extInstP)
										}
										if childClassNameL3extRsInstPToProfileL3extInstP == "tagTag" {
											TagTagL3extRsInstPToProfileL3extInstP := getEmptyTagTagL3extRsInstPToProfileL3extInstPResourceModel()
											tagTagchildAttributeValue := childClassDetailsL3extRsInstPToProfileL3extInstP.(map[string]interface{})["attributes"].(map[string]interface{})
											for childAttributeName, childAttributeValue := range tagTagchildAttributeValue {
												if childAttributeName == "key" {
													TagTagL3extRsInstPToProfileL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
												}
												if childAttributeName == "value" {
													TagTagL3extRsInstPToProfileL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
												}
											}
											TagTagL3extRsInstPToProfileL3extInstPList = append(TagTagL3extRsInstPToProfileL3extInstPList, TagTagL3extRsInstPToProfileL3extInstP)
										}
									}
								}
							}
							TagAnnotationL3extRsInstPToProfileL3extInstPSet, _ := types.SetValueFrom(ctx, TagAnnotationL3extRsInstPToProfileL3extInstPType, TagAnnotationL3extRsInstPToProfileL3extInstPList)
							L3extRsInstPToProfileL3extInstP.TagAnnotation = TagAnnotationL3extRsInstPToProfileL3extInstPSet
							TagTagL3extRsInstPToProfileL3extInstPSet, _ := types.SetValueFrom(ctx, TagTagL3extRsInstPToProfileL3extInstPType, TagTagL3extRsInstPToProfileL3extInstPList)
							L3extRsInstPToProfileL3extInstP.TagTag = TagTagL3extRsInstPToProfileL3extInstPSet
							L3extRsInstPToProfileL3extInstPList = append(L3extRsInstPToProfileL3extInstPList, L3extRsInstPToProfileL3extInstP)
						}
						if childClassName == "tagAnnotation" {
							TagAnnotationL3extInstP := getEmptyTagAnnotationL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "key" {
									TagAnnotationL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "value" {
									TagAnnotationL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagAnnotationL3extInstPList = append(TagAnnotationL3extInstPList, TagAnnotationL3extInstP)
						}
						if childClassName == "tagTag" {
							TagTagL3extInstP := getEmptyTagTagL3extInstPResourceModel()
							for childAttributeName, childAttributeValue := range childAttributes {
								if childAttributeName == "key" {
									TagTagL3extInstP.Key = basetypes.NewStringValue(childAttributeValue.(string))
								}
								if childAttributeName == "value" {
									TagTagL3extInstP.Value = basetypes.NewStringValue(childAttributeValue.(string))
								}

							}
							TagTagL3extInstPList = append(TagTagL3extInstPList, TagTagL3extInstP)
						}
					}
				}
			}
			fvRsConsSet, _ := types.SetValueFrom(ctx, readData.FvRsCons.ElementType(ctx), FvRsConsL3extInstPList)
			readData.FvRsCons = fvRsConsSet
			fvRsConsIfSet, _ := types.SetValueFrom(ctx, readData.FvRsConsIf.ElementType(ctx), FvRsConsIfL3extInstPList)
			readData.FvRsConsIf = fvRsConsIfSet
			if len(FvRsCustQosPolL3extInstPList) == 1 {
				fvRsCustQosPolObject, _ := types.ObjectValueFrom(ctx, FvRsCustQosPolL3extInstPType, FvRsCustQosPolL3extInstPList[0])
				readData.FvRsCustQosPol = fvRsCustQosPolObject
			} else {
				fvRsCustQosPolObject, _ := types.ObjectValueFrom(ctx, FvRsCustQosPolL3extInstPType, getEmptyFvRsCustQosPolL3extInstPResourceModel())
				readData.FvRsCustQosPol = fvRsCustQosPolObject
			}
			fvRsIntraEpgSet, _ := types.SetValueFrom(ctx, readData.FvRsIntraEpg.ElementType(ctx), FvRsIntraEpgL3extInstPList)
			readData.FvRsIntraEpg = fvRsIntraEpgSet
			fvRsProtBySet, _ := types.SetValueFrom(ctx, readData.FvRsProtBy.ElementType(ctx), FvRsProtByL3extInstPList)
			readData.FvRsProtBy = fvRsProtBySet
			fvRsProvSet, _ := types.SetValueFrom(ctx, readData.FvRsProv.ElementType(ctx), FvRsProvL3extInstPList)
			readData.FvRsProv = fvRsProvSet
			fvRsSecInheritedSet, _ := types.SetValueFrom(ctx, readData.FvRsSecInherited.ElementType(ctx), FvRsSecInheritedL3extInstPList)
			readData.FvRsSecInherited = fvRsSecInheritedSet
			l3extRsInstPToProfileSet, _ := types.SetValueFrom(ctx, readData.L3extRsInstPToProfile.ElementType(ctx), L3extRsInstPToProfileL3extInstPList)
			readData.L3extRsInstPToProfile = l3extRsInstPToProfileSet
			tagAnnotationSet, _ := types.SetValueFrom(ctx, readData.TagAnnotation.ElementType(ctx), TagAnnotationL3extInstPList)
			readData.TagAnnotation = tagAnnotationSet
			tagTagSet, _ := types.SetValueFrom(ctx, readData.TagTag.ElementType(ctx), TagTagL3extInstPList)
			readData.TagTag = tagTagSet
		} else {
			diags.AddError(
				"too many results in response",
				fmt.Sprintf("%v matches returned for class 'l3extInstP'. Please report this issue to the provider developers.", len(classReadInfo)),
			)
		}
	} else {
		readData.Id = basetypes.NewStringNull()
	}
	*data = *readData
}

func getL3extInstPRn(ctx context.Context, data *L3extInstPResourceModel) string {
	return fmt.Sprintf("instP-%s", data.Name.ValueString())
}

func setL3extInstPParentDn(ctx context.Context, dn string, data *L3extInstPResourceModel) {
	bracketIndex := 0
	rnIndex := 0
	for i := len(dn) - 1; i >= 0; i-- {
		if string(dn[i]) == "]" {
			bracketIndex = bracketIndex + 1
		} else if string(dn[i]) == "[" {
			bracketIndex = bracketIndex - 1
		} else if string(dn[i]) == "/" && bracketIndex == 0 {
			rnIndex = i
			break
		}
	}
	data.ParentDn = basetypes.NewStringValue(dn[:rnIndex])
}

func setL3extInstPId(ctx context.Context, data *L3extInstPResourceModel) {
	rn := getL3extInstPRn(ctx, data)
	data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn))
}

func getL3extInstPFvRsConsChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsConsL3extInstPPlan, fvRsConsL3extInstPState []FvRsConsL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsCons.IsNull() && !data.FvRsCons.IsUnknown() {
		fvRsConsIdentifiers := []FvRsConsIdentifier{}
		for _, fvRsConsL3extInstP := range fvRsConsL3extInstPPlan {
			FvRsConsL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsConsL3extInstP.Annotation.IsNull() && !fvRsConsL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsConsL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsConsL3extInstP.Prio.IsNull() && !fvRsConsL3extInstP.Prio.IsUnknown() {
				childMap.Attributes["prio"] = fvRsConsL3extInstP.Prio.ValueString()
			}
			if !fvRsConsL3extInstP.TnVzBrCPName.IsNull() && !fvRsConsL3extInstP.TnVzBrCPName.IsUnknown() {
				childMap.Attributes["tnVzBrCPName"] = fvRsConsL3extInstP.TnVzBrCPName.ValueString()
			}

			var tagAnnotationFvRsConsL3extInstPPlan, tagAnnotationFvRsConsL3extInstPState []TagAnnotationFvRsConsL3extInstPResourceModel
			fvRsConsL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsConsL3extInstPPlan, false)
			for _, tagAnnotationFvRsConsL3extInstPstate := range fvRsConsL3extInstPState {
				tagAnnotationFvRsConsL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsConsL3extInstPState, false)
			}
			if !fvRsConsL3extInstP.TagAnnotation.IsNull() && !fvRsConsL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsConsL3extInstP := range tagAnnotationFvRsConsL3extInstPPlan {
					tagAnnotationFvRsConsL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsConsL3extInstP.Key.IsNull() && !tagAnnotationFvRsConsL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsConsL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsConsL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsConsL3extInstP.Value.IsNull() && !tagAnnotationFvRsConsL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsConsL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsConsL3extInstP.Value.ValueString()
					}
					FvRsConsL3extInstPChildren = append(FvRsConsL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsConsL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsConsL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsConsL3extInstP := range tagAnnotationFvRsConsL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsConsL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsConsL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsConsL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsConsL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsConsL3extInstP.Key.ValueString()
						FvRsConsL3extInstPChildren = append(FvRsConsL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsConsL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsConsL3extInstPPlan, tagTagFvRsConsL3extInstPState []TagTagFvRsConsL3extInstPResourceModel
			fvRsConsL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsConsL3extInstPPlan, false)
			for _, tagTagFvRsConsL3extInstPstate := range fvRsConsL3extInstPState {
				tagTagFvRsConsL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsConsL3extInstPState, false)
			}
			if !fvRsConsL3extInstP.TagTag.IsNull() && !fvRsConsL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsConsL3extInstP := range tagTagFvRsConsL3extInstPPlan {
					tagTagFvRsConsL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsConsL3extInstP.Key.IsNull() && !tagTagFvRsConsL3extInstP.Key.IsUnknown() {
						tagTagFvRsConsL3extInstPChildMap.Attributes["key"] = tagTagFvRsConsL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsConsL3extInstP.Value.IsNull() && !tagTagFvRsConsL3extInstP.Value.IsUnknown() {
						tagTagFvRsConsL3extInstPChildMap.Attributes["value"] = tagTagFvRsConsL3extInstP.Value.ValueString()
					}
					FvRsConsL3extInstPChildren = append(FvRsConsL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsConsL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsConsL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsConsL3extInstP := range tagTagFvRsConsL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsConsL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsConsL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsConsL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsConsL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsConsL3extInstP.Key.ValueString()
						FvRsConsL3extInstPChildren = append(FvRsConsL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsConsL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsConsL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsCons": childMap})
			fvRsConsIdentifier := FvRsConsIdentifier{}
			fvRsConsIdentifier.TnVzBrCPName = fvRsConsL3extInstP.TnVzBrCPName
			fvRsConsIdentifiers = append(fvRsConsIdentifiers, fvRsConsIdentifier)
		}
		for _, fvRsCons := range fvRsConsL3extInstPState {
			delete := true
			for _, fvRsConsIdentifier := range fvRsConsIdentifiers {
				if fvRsConsIdentifier.TnVzBrCPName == fvRsCons.TnVzBrCPName {
					delete = false
					break
				}
			}
			if delete {
				fvRsConsChildMapForDelete := NewAciObject()
				fvRsConsChildMapForDelete.Attributes["status"] = "deleted"
				fvRsConsChildMapForDelete.Attributes["tnVzBrCPName"] = fvRsCons.TnVzBrCPName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsCons": fvRsConsChildMapForDelete})
			}
		}
	} else {
		data.FvRsCons = types.SetNull(data.FvRsCons.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPFvRsConsIfChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsConsIfL3extInstPPlan, fvRsConsIfL3extInstPState []FvRsConsIfL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsConsIf.IsNull() && !data.FvRsConsIf.IsUnknown() {
		fvRsConsIfIdentifiers := []FvRsConsIfIdentifier{}
		for _, fvRsConsIfL3extInstP := range fvRsConsIfL3extInstPPlan {
			FvRsConsIfL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsConsIfL3extInstP.Annotation.IsNull() && !fvRsConsIfL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsConsIfL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsConsIfL3extInstP.Prio.IsNull() && !fvRsConsIfL3extInstP.Prio.IsUnknown() {
				childMap.Attributes["prio"] = fvRsConsIfL3extInstP.Prio.ValueString()
			}
			if !fvRsConsIfL3extInstP.TnVzCPIfName.IsNull() && !fvRsConsIfL3extInstP.TnVzCPIfName.IsUnknown() {
				childMap.Attributes["tnVzCPIfName"] = fvRsConsIfL3extInstP.TnVzCPIfName.ValueString()
			}

			var tagAnnotationFvRsConsIfL3extInstPPlan, tagAnnotationFvRsConsIfL3extInstPState []TagAnnotationFvRsConsIfL3extInstPResourceModel
			fvRsConsIfL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsConsIfL3extInstPPlan, false)
			for _, tagAnnotationFvRsConsIfL3extInstPstate := range fvRsConsIfL3extInstPState {
				tagAnnotationFvRsConsIfL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsConsIfL3extInstPState, false)
			}
			if !fvRsConsIfL3extInstP.TagAnnotation.IsNull() && !fvRsConsIfL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsConsIfL3extInstP := range tagAnnotationFvRsConsIfL3extInstPPlan {
					tagAnnotationFvRsConsIfL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsConsIfL3extInstP.Key.IsNull() && !tagAnnotationFvRsConsIfL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsConsIfL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsConsIfL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsConsIfL3extInstP.Value.IsNull() && !tagAnnotationFvRsConsIfL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsConsIfL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsConsIfL3extInstP.Value.ValueString()
					}
					FvRsConsIfL3extInstPChildren = append(FvRsConsIfL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsConsIfL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsConsIfL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsConsIfL3extInstP := range tagAnnotationFvRsConsIfL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsConsIfL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsConsIfL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsConsIfL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsConsIfL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsConsIfL3extInstP.Key.ValueString()
						FvRsConsIfL3extInstPChildren = append(FvRsConsIfL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsConsIfL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsConsIfL3extInstPPlan, tagTagFvRsConsIfL3extInstPState []TagTagFvRsConsIfL3extInstPResourceModel
			fvRsConsIfL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsConsIfL3extInstPPlan, false)
			for _, tagTagFvRsConsIfL3extInstPstate := range fvRsConsIfL3extInstPState {
				tagTagFvRsConsIfL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsConsIfL3extInstPState, false)
			}
			if !fvRsConsIfL3extInstP.TagTag.IsNull() && !fvRsConsIfL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsConsIfL3extInstP := range tagTagFvRsConsIfL3extInstPPlan {
					tagTagFvRsConsIfL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsConsIfL3extInstP.Key.IsNull() && !tagTagFvRsConsIfL3extInstP.Key.IsUnknown() {
						tagTagFvRsConsIfL3extInstPChildMap.Attributes["key"] = tagTagFvRsConsIfL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsConsIfL3extInstP.Value.IsNull() && !tagTagFvRsConsIfL3extInstP.Value.IsUnknown() {
						tagTagFvRsConsIfL3extInstPChildMap.Attributes["value"] = tagTagFvRsConsIfL3extInstP.Value.ValueString()
					}
					FvRsConsIfL3extInstPChildren = append(FvRsConsIfL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsConsIfL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsConsIfL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsConsIfL3extInstP := range tagTagFvRsConsIfL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsConsIfL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsConsIfL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsConsIfL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsConsIfL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsConsIfL3extInstP.Key.ValueString()
						FvRsConsIfL3extInstPChildren = append(FvRsConsIfL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsConsIfL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsConsIfL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsConsIf": childMap})
			fvRsConsIfIdentifier := FvRsConsIfIdentifier{}
			fvRsConsIfIdentifier.TnVzCPIfName = fvRsConsIfL3extInstP.TnVzCPIfName
			fvRsConsIfIdentifiers = append(fvRsConsIfIdentifiers, fvRsConsIfIdentifier)
		}
		for _, fvRsConsIf := range fvRsConsIfL3extInstPState {
			delete := true
			for _, fvRsConsIfIdentifier := range fvRsConsIfIdentifiers {
				if fvRsConsIfIdentifier.TnVzCPIfName == fvRsConsIf.TnVzCPIfName {
					delete = false
					break
				}
			}
			if delete {
				fvRsConsIfChildMapForDelete := NewAciObject()
				fvRsConsIfChildMapForDelete.Attributes["status"] = "deleted"
				fvRsConsIfChildMapForDelete.Attributes["tnVzCPIfName"] = fvRsConsIf.TnVzCPIfName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsConsIf": fvRsConsIfChildMapForDelete})
			}
		}
	} else {
		data.FvRsConsIf = types.SetNull(data.FvRsConsIf.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPFvRsCustQosPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsCustQosPolL3extInstPPlan, fvRsCustQosPolL3extInstPState FvRsCustQosPolL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsCustQosPol.IsNull() && !data.FvRsCustQosPol.IsUnknown() {
		FvRsCustQosPolL3extInstPChildren := make([]map[string]interface{}, 0)
		childMap := NewAciObject()
		if !IsEmptySingleNestedAttribute(data.FvRsCustQosPol.Attributes()) {
			if !fvRsCustQosPolL3extInstPPlan.Annotation.IsUnknown() && !fvRsCustQosPolL3extInstPPlan.Annotation.IsNull() {
				childMap.Attributes["annotation"] = fvRsCustQosPolL3extInstPPlan.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsCustQosPolL3extInstPPlan.TnQosCustomPolName.IsUnknown() && !fvRsCustQosPolL3extInstPPlan.TnQosCustomPolName.IsNull() {
				childMap.Attributes["tnQosCustomPolName"] = fvRsCustQosPolL3extInstPPlan.TnQosCustomPolName.ValueString()
			}

			var tagAnnotationFvRsCustQosPolL3extInstPPlan, tagAnnotationFvRsCustQosPolL3extInstPState []TagAnnotationFvRsCustQosPolL3extInstPResourceModel
			fvRsCustQosPolL3extInstPPlan.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsCustQosPolL3extInstPPlan, false)
			if !fvRsCustQosPolL3extInstPState.TagAnnotation.IsNull() {
				fvRsCustQosPolL3extInstPState.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsCustQosPolL3extInstPState, false)
			}
			if !fvRsCustQosPolL3extInstPPlan.TagAnnotation.IsNull() && !fvRsCustQosPolL3extInstPPlan.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsCustQosPolL3extInstP := range tagAnnotationFvRsCustQosPolL3extInstPPlan {
					tagAnnotationFvRsCustQosPolL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsCustQosPolL3extInstP.Key.IsNull() && !tagAnnotationFvRsCustQosPolL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsCustQosPolL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsCustQosPolL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsCustQosPolL3extInstP.Value.IsNull() && !tagAnnotationFvRsCustQosPolL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsCustQosPolL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsCustQosPolL3extInstP.Value.ValueString()
					}
					FvRsCustQosPolL3extInstPChildren = append(FvRsCustQosPolL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsCustQosPolL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsCustQosPolL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsCustQosPolL3extInstP := range tagAnnotationFvRsCustQosPolL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsCustQosPolL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsCustQosPolL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsCustQosPolL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsCustQosPolL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsCustQosPolL3extInstP.Key.ValueString()
						FvRsCustQosPolL3extInstPChildren = append(FvRsCustQosPolL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsCustQosPolL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsCustQosPolL3extInstPPlan, tagTagFvRsCustQosPolL3extInstPState []TagTagFvRsCustQosPolL3extInstPResourceModel
			fvRsCustQosPolL3extInstPPlan.TagTag.ElementsAs(ctx, &tagTagFvRsCustQosPolL3extInstPPlan, false)
			if !fvRsCustQosPolL3extInstPState.TagTag.IsNull() {
				fvRsCustQosPolL3extInstPState.TagTag.ElementsAs(ctx, &tagTagFvRsCustQosPolL3extInstPState, false)
			}
			if !fvRsCustQosPolL3extInstPPlan.TagTag.IsNull() && !fvRsCustQosPolL3extInstPPlan.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsCustQosPolL3extInstP := range tagTagFvRsCustQosPolL3extInstPPlan {
					tagTagFvRsCustQosPolL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsCustQosPolL3extInstP.Key.IsNull() && !tagTagFvRsCustQosPolL3extInstP.Key.IsUnknown() {
						tagTagFvRsCustQosPolL3extInstPChildMap.Attributes["key"] = tagTagFvRsCustQosPolL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsCustQosPolL3extInstP.Value.IsNull() && !tagTagFvRsCustQosPolL3extInstP.Value.IsUnknown() {
						tagTagFvRsCustQosPolL3extInstPChildMap.Attributes["value"] = tagTagFvRsCustQosPolL3extInstP.Value.ValueString()
					}
					FvRsCustQosPolL3extInstPChildren = append(FvRsCustQosPolL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsCustQosPolL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsCustQosPolL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsCustQosPolL3extInstP := range tagTagFvRsCustQosPolL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsCustQosPolL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsCustQosPolL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsCustQosPolL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsCustQosPolL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsCustQosPolL3extInstP.Key.ValueString()
						FvRsCustQosPolL3extInstPChildren = append(FvRsCustQosPolL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsCustQosPolL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsCustQosPolL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsCustQosPol": childMap})
		}
	} else {
		FvRsCustQosPolObject, _ := types.ObjectValueFrom(ctx, FvRsCustQosPolL3extInstPType, getEmptyFvRsCustQosPolL3extInstPResourceModel())
		data.FvRsCustQosPol = FvRsCustQosPolObject
	}

	return childPayloads
}

func getL3extInstPFvRsIntraEpgChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsIntraEpgL3extInstPPlan, fvRsIntraEpgL3extInstPState []FvRsIntraEpgL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsIntraEpg.IsNull() && !data.FvRsIntraEpg.IsUnknown() {
		fvRsIntraEpgIdentifiers := []FvRsIntraEpgIdentifier{}
		for _, fvRsIntraEpgL3extInstP := range fvRsIntraEpgL3extInstPPlan {
			FvRsIntraEpgL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsIntraEpgL3extInstP.Annotation.IsNull() && !fvRsIntraEpgL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsIntraEpgL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsIntraEpgL3extInstP.TnVzBrCPName.IsNull() && !fvRsIntraEpgL3extInstP.TnVzBrCPName.IsUnknown() {
				childMap.Attributes["tnVzBrCPName"] = fvRsIntraEpgL3extInstP.TnVzBrCPName.ValueString()
			}

			var tagAnnotationFvRsIntraEpgL3extInstPPlan, tagAnnotationFvRsIntraEpgL3extInstPState []TagAnnotationFvRsIntraEpgL3extInstPResourceModel
			fvRsIntraEpgL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsIntraEpgL3extInstPPlan, false)
			for _, tagAnnotationFvRsIntraEpgL3extInstPstate := range fvRsIntraEpgL3extInstPState {
				tagAnnotationFvRsIntraEpgL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsIntraEpgL3extInstPState, false)
			}
			if !fvRsIntraEpgL3extInstP.TagAnnotation.IsNull() && !fvRsIntraEpgL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsIntraEpgL3extInstP := range tagAnnotationFvRsIntraEpgL3extInstPPlan {
					tagAnnotationFvRsIntraEpgL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsIntraEpgL3extInstP.Key.IsNull() && !tagAnnotationFvRsIntraEpgL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsIntraEpgL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsIntraEpgL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsIntraEpgL3extInstP.Value.IsNull() && !tagAnnotationFvRsIntraEpgL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsIntraEpgL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsIntraEpgL3extInstP.Value.ValueString()
					}
					FvRsIntraEpgL3extInstPChildren = append(FvRsIntraEpgL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsIntraEpgL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsIntraEpgL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsIntraEpgL3extInstP := range tagAnnotationFvRsIntraEpgL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsIntraEpgL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsIntraEpgL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsIntraEpgL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsIntraEpgL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsIntraEpgL3extInstP.Key.ValueString()
						FvRsIntraEpgL3extInstPChildren = append(FvRsIntraEpgL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsIntraEpgL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsIntraEpgL3extInstPPlan, tagTagFvRsIntraEpgL3extInstPState []TagTagFvRsIntraEpgL3extInstPResourceModel
			fvRsIntraEpgL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsIntraEpgL3extInstPPlan, false)
			for _, tagTagFvRsIntraEpgL3extInstPstate := range fvRsIntraEpgL3extInstPState {
				tagTagFvRsIntraEpgL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsIntraEpgL3extInstPState, false)
			}
			if !fvRsIntraEpgL3extInstP.TagTag.IsNull() && !fvRsIntraEpgL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsIntraEpgL3extInstP := range tagTagFvRsIntraEpgL3extInstPPlan {
					tagTagFvRsIntraEpgL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsIntraEpgL3extInstP.Key.IsNull() && !tagTagFvRsIntraEpgL3extInstP.Key.IsUnknown() {
						tagTagFvRsIntraEpgL3extInstPChildMap.Attributes["key"] = tagTagFvRsIntraEpgL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsIntraEpgL3extInstP.Value.IsNull() && !tagTagFvRsIntraEpgL3extInstP.Value.IsUnknown() {
						tagTagFvRsIntraEpgL3extInstPChildMap.Attributes["value"] = tagTagFvRsIntraEpgL3extInstP.Value.ValueString()
					}
					FvRsIntraEpgL3extInstPChildren = append(FvRsIntraEpgL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsIntraEpgL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsIntraEpgL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsIntraEpgL3extInstP := range tagTagFvRsIntraEpgL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsIntraEpgL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsIntraEpgL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsIntraEpgL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsIntraEpgL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsIntraEpgL3extInstP.Key.ValueString()
						FvRsIntraEpgL3extInstPChildren = append(FvRsIntraEpgL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsIntraEpgL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsIntraEpgL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsIntraEpg": childMap})
			fvRsIntraEpgIdentifier := FvRsIntraEpgIdentifier{}
			fvRsIntraEpgIdentifier.TnVzBrCPName = fvRsIntraEpgL3extInstP.TnVzBrCPName
			fvRsIntraEpgIdentifiers = append(fvRsIntraEpgIdentifiers, fvRsIntraEpgIdentifier)
		}
		for _, fvRsIntraEpg := range fvRsIntraEpgL3extInstPState {
			delete := true
			for _, fvRsIntraEpgIdentifier := range fvRsIntraEpgIdentifiers {
				if fvRsIntraEpgIdentifier.TnVzBrCPName == fvRsIntraEpg.TnVzBrCPName {
					delete = false
					break
				}
			}
			if delete {
				fvRsIntraEpgChildMapForDelete := NewAciObject()
				fvRsIntraEpgChildMapForDelete.Attributes["status"] = "deleted"
				fvRsIntraEpgChildMapForDelete.Attributes["tnVzBrCPName"] = fvRsIntraEpg.TnVzBrCPName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsIntraEpg": fvRsIntraEpgChildMapForDelete})
			}
		}
	} else {
		data.FvRsIntraEpg = types.SetNull(data.FvRsIntraEpg.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPFvRsProtByChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsProtByL3extInstPPlan, fvRsProtByL3extInstPState []FvRsProtByL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsProtBy.IsNull() && !data.FvRsProtBy.IsUnknown() {
		fvRsProtByIdentifiers := []FvRsProtByIdentifier{}
		for _, fvRsProtByL3extInstP := range fvRsProtByL3extInstPPlan {
			FvRsProtByL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsProtByL3extInstP.Annotation.IsNull() && !fvRsProtByL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsProtByL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsProtByL3extInstP.TnVzTabooName.IsNull() && !fvRsProtByL3extInstP.TnVzTabooName.IsUnknown() {
				childMap.Attributes["tnVzTabooName"] = fvRsProtByL3extInstP.TnVzTabooName.ValueString()
			}

			var tagAnnotationFvRsProtByL3extInstPPlan, tagAnnotationFvRsProtByL3extInstPState []TagAnnotationFvRsProtByL3extInstPResourceModel
			fvRsProtByL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsProtByL3extInstPPlan, false)
			for _, tagAnnotationFvRsProtByL3extInstPstate := range fvRsProtByL3extInstPState {
				tagAnnotationFvRsProtByL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsProtByL3extInstPState, false)
			}
			if !fvRsProtByL3extInstP.TagAnnotation.IsNull() && !fvRsProtByL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsProtByL3extInstP := range tagAnnotationFvRsProtByL3extInstPPlan {
					tagAnnotationFvRsProtByL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsProtByL3extInstP.Key.IsNull() && !tagAnnotationFvRsProtByL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsProtByL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsProtByL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsProtByL3extInstP.Value.IsNull() && !tagAnnotationFvRsProtByL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsProtByL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsProtByL3extInstP.Value.ValueString()
					}
					FvRsProtByL3extInstPChildren = append(FvRsProtByL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsProtByL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsProtByL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsProtByL3extInstP := range tagAnnotationFvRsProtByL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsProtByL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsProtByL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsProtByL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsProtByL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsProtByL3extInstP.Key.ValueString()
						FvRsProtByL3extInstPChildren = append(FvRsProtByL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsProtByL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsProtByL3extInstPPlan, tagTagFvRsProtByL3extInstPState []TagTagFvRsProtByL3extInstPResourceModel
			fvRsProtByL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsProtByL3extInstPPlan, false)
			for _, tagTagFvRsProtByL3extInstPstate := range fvRsProtByL3extInstPState {
				tagTagFvRsProtByL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsProtByL3extInstPState, false)
			}
			if !fvRsProtByL3extInstP.TagTag.IsNull() && !fvRsProtByL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsProtByL3extInstP := range tagTagFvRsProtByL3extInstPPlan {
					tagTagFvRsProtByL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsProtByL3extInstP.Key.IsNull() && !tagTagFvRsProtByL3extInstP.Key.IsUnknown() {
						tagTagFvRsProtByL3extInstPChildMap.Attributes["key"] = tagTagFvRsProtByL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsProtByL3extInstP.Value.IsNull() && !tagTagFvRsProtByL3extInstP.Value.IsUnknown() {
						tagTagFvRsProtByL3extInstPChildMap.Attributes["value"] = tagTagFvRsProtByL3extInstP.Value.ValueString()
					}
					FvRsProtByL3extInstPChildren = append(FvRsProtByL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsProtByL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsProtByL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsProtByL3extInstP := range tagTagFvRsProtByL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsProtByL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsProtByL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsProtByL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsProtByL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsProtByL3extInstP.Key.ValueString()
						FvRsProtByL3extInstPChildren = append(FvRsProtByL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsProtByL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsProtByL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsProtBy": childMap})
			fvRsProtByIdentifier := FvRsProtByIdentifier{}
			fvRsProtByIdentifier.TnVzTabooName = fvRsProtByL3extInstP.TnVzTabooName
			fvRsProtByIdentifiers = append(fvRsProtByIdentifiers, fvRsProtByIdentifier)
		}
		for _, fvRsProtBy := range fvRsProtByL3extInstPState {
			delete := true
			for _, fvRsProtByIdentifier := range fvRsProtByIdentifiers {
				if fvRsProtByIdentifier.TnVzTabooName == fvRsProtBy.TnVzTabooName {
					delete = false
					break
				}
			}
			if delete {
				fvRsProtByChildMapForDelete := NewAciObject()
				fvRsProtByChildMapForDelete.Attributes["status"] = "deleted"
				fvRsProtByChildMapForDelete.Attributes["tnVzTabooName"] = fvRsProtBy.TnVzTabooName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsProtBy": fvRsProtByChildMapForDelete})
			}
		}
	} else {
		data.FvRsProtBy = types.SetNull(data.FvRsProtBy.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPFvRsProvChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsProvL3extInstPPlan, fvRsProvL3extInstPState []FvRsProvL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsProv.IsNull() && !data.FvRsProv.IsUnknown() {
		fvRsProvIdentifiers := []FvRsProvIdentifier{}
		for _, fvRsProvL3extInstP := range fvRsProvL3extInstPPlan {
			FvRsProvL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsProvL3extInstP.Annotation.IsNull() && !fvRsProvL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsProvL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsProvL3extInstP.MatchT.IsNull() && !fvRsProvL3extInstP.MatchT.IsUnknown() {
				childMap.Attributes["matchT"] = fvRsProvL3extInstP.MatchT.ValueString()
			}
			if !fvRsProvL3extInstP.Prio.IsNull() && !fvRsProvL3extInstP.Prio.IsUnknown() {
				childMap.Attributes["prio"] = fvRsProvL3extInstP.Prio.ValueString()
			}
			if !fvRsProvL3extInstP.TnVzBrCPName.IsNull() && !fvRsProvL3extInstP.TnVzBrCPName.IsUnknown() {
				childMap.Attributes["tnVzBrCPName"] = fvRsProvL3extInstP.TnVzBrCPName.ValueString()
			}

			var tagAnnotationFvRsProvL3extInstPPlan, tagAnnotationFvRsProvL3extInstPState []TagAnnotationFvRsProvL3extInstPResourceModel
			fvRsProvL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsProvL3extInstPPlan, false)
			for _, tagAnnotationFvRsProvL3extInstPstate := range fvRsProvL3extInstPState {
				tagAnnotationFvRsProvL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsProvL3extInstPState, false)
			}
			if !fvRsProvL3extInstP.TagAnnotation.IsNull() && !fvRsProvL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsProvL3extInstP := range tagAnnotationFvRsProvL3extInstPPlan {
					tagAnnotationFvRsProvL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsProvL3extInstP.Key.IsNull() && !tagAnnotationFvRsProvL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsProvL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsProvL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsProvL3extInstP.Value.IsNull() && !tagAnnotationFvRsProvL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsProvL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsProvL3extInstP.Value.ValueString()
					}
					FvRsProvL3extInstPChildren = append(FvRsProvL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsProvL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsProvL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsProvL3extInstP := range tagAnnotationFvRsProvL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsProvL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsProvL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsProvL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsProvL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsProvL3extInstP.Key.ValueString()
						FvRsProvL3extInstPChildren = append(FvRsProvL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsProvL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsProvL3extInstPPlan, tagTagFvRsProvL3extInstPState []TagTagFvRsProvL3extInstPResourceModel
			fvRsProvL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsProvL3extInstPPlan, false)
			for _, tagTagFvRsProvL3extInstPstate := range fvRsProvL3extInstPState {
				tagTagFvRsProvL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsProvL3extInstPState, false)
			}
			if !fvRsProvL3extInstP.TagTag.IsNull() && !fvRsProvL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsProvL3extInstP := range tagTagFvRsProvL3extInstPPlan {
					tagTagFvRsProvL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsProvL3extInstP.Key.IsNull() && !tagTagFvRsProvL3extInstP.Key.IsUnknown() {
						tagTagFvRsProvL3extInstPChildMap.Attributes["key"] = tagTagFvRsProvL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsProvL3extInstP.Value.IsNull() && !tagTagFvRsProvL3extInstP.Value.IsUnknown() {
						tagTagFvRsProvL3extInstPChildMap.Attributes["value"] = tagTagFvRsProvL3extInstP.Value.ValueString()
					}
					FvRsProvL3extInstPChildren = append(FvRsProvL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsProvL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsProvL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsProvL3extInstP := range tagTagFvRsProvL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsProvL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsProvL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsProvL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsProvL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsProvL3extInstP.Key.ValueString()
						FvRsProvL3extInstPChildren = append(FvRsProvL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsProvL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsProvL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsProv": childMap})
			fvRsProvIdentifier := FvRsProvIdentifier{}
			fvRsProvIdentifier.TnVzBrCPName = fvRsProvL3extInstP.TnVzBrCPName
			fvRsProvIdentifiers = append(fvRsProvIdentifiers, fvRsProvIdentifier)
		}
		for _, fvRsProv := range fvRsProvL3extInstPState {
			delete := true
			for _, fvRsProvIdentifier := range fvRsProvIdentifiers {
				if fvRsProvIdentifier.TnVzBrCPName == fvRsProv.TnVzBrCPName {
					delete = false
					break
				}
			}
			if delete {
				fvRsProvChildMapForDelete := NewAciObject()
				fvRsProvChildMapForDelete.Attributes["status"] = "deleted"
				fvRsProvChildMapForDelete.Attributes["tnVzBrCPName"] = fvRsProv.TnVzBrCPName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsProv": fvRsProvChildMapForDelete})
			}
		}
	} else {
		data.FvRsProv = types.SetNull(data.FvRsProv.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPFvRsSecInheritedChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, fvRsSecInheritedL3extInstPPlan, fvRsSecInheritedL3extInstPState []FvRsSecInheritedL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.FvRsSecInherited.IsNull() && !data.FvRsSecInherited.IsUnknown() {
		fvRsSecInheritedIdentifiers := []FvRsSecInheritedIdentifier{}
		for _, fvRsSecInheritedL3extInstP := range fvRsSecInheritedL3extInstPPlan {
			FvRsSecInheritedL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !fvRsSecInheritedL3extInstP.Annotation.IsNull() && !fvRsSecInheritedL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = fvRsSecInheritedL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !fvRsSecInheritedL3extInstP.TDn.IsNull() && !fvRsSecInheritedL3extInstP.TDn.IsUnknown() {
				childMap.Attributes["tDn"] = fvRsSecInheritedL3extInstP.TDn.ValueString()
			}

			var tagAnnotationFvRsSecInheritedL3extInstPPlan, tagAnnotationFvRsSecInheritedL3extInstPState []TagAnnotationFvRsSecInheritedL3extInstPResourceModel
			fvRsSecInheritedL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsSecInheritedL3extInstPPlan, false)
			for _, tagAnnotationFvRsSecInheritedL3extInstPstate := range fvRsSecInheritedL3extInstPState {
				tagAnnotationFvRsSecInheritedL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationFvRsSecInheritedL3extInstPState, false)
			}
			if !fvRsSecInheritedL3extInstP.TagAnnotation.IsNull() && !fvRsSecInheritedL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationFvRsSecInheritedL3extInstP := range tagAnnotationFvRsSecInheritedL3extInstPPlan {
					tagAnnotationFvRsSecInheritedL3extInstPChildMap := NewAciObject()
					if !tagAnnotationFvRsSecInheritedL3extInstP.Key.IsNull() && !tagAnnotationFvRsSecInheritedL3extInstP.Key.IsUnknown() {
						tagAnnotationFvRsSecInheritedL3extInstPChildMap.Attributes["key"] = tagAnnotationFvRsSecInheritedL3extInstP.Key.ValueString()
					}
					if !tagAnnotationFvRsSecInheritedL3extInstP.Value.IsNull() && !tagAnnotationFvRsSecInheritedL3extInstP.Value.IsUnknown() {
						tagAnnotationFvRsSecInheritedL3extInstPChildMap.Attributes["value"] = tagAnnotationFvRsSecInheritedL3extInstP.Value.ValueString()
					}
					FvRsSecInheritedL3extInstPChildren = append(FvRsSecInheritedL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsSecInheritedL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationFvRsSecInheritedL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationFvRsSecInheritedL3extInstP := range tagAnnotationFvRsSecInheritedL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationFvRsSecInheritedL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationFvRsSecInheritedL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationFvRsSecInheritedL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationFvRsSecInheritedL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationFvRsSecInheritedL3extInstP.Key.ValueString()
						FvRsSecInheritedL3extInstPChildren = append(FvRsSecInheritedL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationFvRsSecInheritedL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagFvRsSecInheritedL3extInstPPlan, tagTagFvRsSecInheritedL3extInstPState []TagTagFvRsSecInheritedL3extInstPResourceModel
			fvRsSecInheritedL3extInstP.TagTag.ElementsAs(ctx, &tagTagFvRsSecInheritedL3extInstPPlan, false)
			for _, tagTagFvRsSecInheritedL3extInstPstate := range fvRsSecInheritedL3extInstPState {
				tagTagFvRsSecInheritedL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagFvRsSecInheritedL3extInstPState, false)
			}
			if !fvRsSecInheritedL3extInstP.TagTag.IsNull() && !fvRsSecInheritedL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagFvRsSecInheritedL3extInstP := range tagTagFvRsSecInheritedL3extInstPPlan {
					tagTagFvRsSecInheritedL3extInstPChildMap := NewAciObject()
					if !tagTagFvRsSecInheritedL3extInstP.Key.IsNull() && !tagTagFvRsSecInheritedL3extInstP.Key.IsUnknown() {
						tagTagFvRsSecInheritedL3extInstPChildMap.Attributes["key"] = tagTagFvRsSecInheritedL3extInstP.Key.ValueString()
					}
					if !tagTagFvRsSecInheritedL3extInstP.Value.IsNull() && !tagTagFvRsSecInheritedL3extInstP.Value.IsUnknown() {
						tagTagFvRsSecInheritedL3extInstPChildMap.Attributes["value"] = tagTagFvRsSecInheritedL3extInstP.Value.ValueString()
					}
					FvRsSecInheritedL3extInstPChildren = append(FvRsSecInheritedL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsSecInheritedL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagFvRsSecInheritedL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagFvRsSecInheritedL3extInstP := range tagTagFvRsSecInheritedL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagFvRsSecInheritedL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagFvRsSecInheritedL3extInstPChildMapForDelete := NewAciObject()
						tagTagFvRsSecInheritedL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagFvRsSecInheritedL3extInstPChildMapForDelete.Attributes["key"] = tagTagFvRsSecInheritedL3extInstP.Key.ValueString()
						FvRsSecInheritedL3extInstPChildren = append(FvRsSecInheritedL3extInstPChildren, map[string]interface{}{"tagTag": tagTagFvRsSecInheritedL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = FvRsSecInheritedL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"fvRsSecInherited": childMap})
			fvRsSecInheritedIdentifier := FvRsSecInheritedIdentifier{}
			fvRsSecInheritedIdentifier.TDn = fvRsSecInheritedL3extInstP.TDn
			fvRsSecInheritedIdentifiers = append(fvRsSecInheritedIdentifiers, fvRsSecInheritedIdentifier)
		}
		for _, fvRsSecInherited := range fvRsSecInheritedL3extInstPState {
			delete := true
			for _, fvRsSecInheritedIdentifier := range fvRsSecInheritedIdentifiers {
				if fvRsSecInheritedIdentifier.TDn == fvRsSecInherited.TDn {
					delete = false
					break
				}
			}
			if delete {
				fvRsSecInheritedChildMapForDelete := NewAciObject()
				fvRsSecInheritedChildMapForDelete.Attributes["status"] = "deleted"
				fvRsSecInheritedChildMapForDelete.Attributes["tDn"] = fvRsSecInherited.TDn.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"fvRsSecInherited": fvRsSecInheritedChildMapForDelete})
			}
		}
	} else {
		data.FvRsSecInherited = types.SetNull(data.FvRsSecInherited.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPL3extRsInstPToProfileChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, l3extRsInstPToProfileL3extInstPPlan, l3extRsInstPToProfileL3extInstPState []L3extRsInstPToProfileL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.L3extRsInstPToProfile.IsNull() && !data.L3extRsInstPToProfile.IsUnknown() {
		l3extRsInstPToProfileIdentifiers := []L3extRsInstPToProfileIdentifier{}
		for _, l3extRsInstPToProfileL3extInstP := range l3extRsInstPToProfileL3extInstPPlan {
			L3extRsInstPToProfileL3extInstPChildren := make([]map[string]interface{}, 0)
			childMap := NewAciObject()
			if !l3extRsInstPToProfileL3extInstP.Annotation.IsNull() && !l3extRsInstPToProfileL3extInstP.Annotation.IsUnknown() {
				childMap.Attributes["annotation"] = l3extRsInstPToProfileL3extInstP.Annotation.ValueString()
			} else {
				childMap.Attributes["annotation"] = globalAnnotation
			}
			if !l3extRsInstPToProfileL3extInstP.Direction.IsNull() && !l3extRsInstPToProfileL3extInstP.Direction.IsUnknown() {
				childMap.Attributes["direction"] = l3extRsInstPToProfileL3extInstP.Direction.ValueString()
			}
			if !l3extRsInstPToProfileL3extInstP.TnRtctrlProfileName.IsNull() && !l3extRsInstPToProfileL3extInstP.TnRtctrlProfileName.IsUnknown() {
				childMap.Attributes["tnRtctrlProfileName"] = l3extRsInstPToProfileL3extInstP.TnRtctrlProfileName.ValueString()
			}

			var tagAnnotationL3extRsInstPToProfileL3extInstPPlan, tagAnnotationL3extRsInstPToProfileL3extInstPState []TagAnnotationL3extRsInstPToProfileL3extInstPResourceModel
			l3extRsInstPToProfileL3extInstP.TagAnnotation.ElementsAs(ctx, &tagAnnotationL3extRsInstPToProfileL3extInstPPlan, false)
			for _, tagAnnotationL3extRsInstPToProfileL3extInstPstate := range l3extRsInstPToProfileL3extInstPState {
				tagAnnotationL3extRsInstPToProfileL3extInstPstate.TagAnnotation.ElementsAs(ctx, &tagAnnotationL3extRsInstPToProfileL3extInstPState, false)
			}
			if !l3extRsInstPToProfileL3extInstP.TagAnnotation.IsNull() && !l3extRsInstPToProfileL3extInstP.TagAnnotation.IsUnknown() {
				tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
				for _, tagAnnotationL3extRsInstPToProfileL3extInstP := range tagAnnotationL3extRsInstPToProfileL3extInstPPlan {
					tagAnnotationL3extRsInstPToProfileL3extInstPChildMap := NewAciObject()
					if !tagAnnotationL3extRsInstPToProfileL3extInstP.Key.IsNull() && !tagAnnotationL3extRsInstPToProfileL3extInstP.Key.IsUnknown() {
						tagAnnotationL3extRsInstPToProfileL3extInstPChildMap.Attributes["key"] = tagAnnotationL3extRsInstPToProfileL3extInstP.Key.ValueString()
					}
					if !tagAnnotationL3extRsInstPToProfileL3extInstP.Value.IsNull() && !tagAnnotationL3extRsInstPToProfileL3extInstP.Value.IsUnknown() {
						tagAnnotationL3extRsInstPToProfileL3extInstPChildMap.Attributes["value"] = tagAnnotationL3extRsInstPToProfileL3extInstP.Value.ValueString()
					}
					L3extRsInstPToProfileL3extInstPChildren = append(L3extRsInstPToProfileL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationL3extRsInstPToProfileL3extInstPChildMap})
					tagAnnotationIdentifier := TagAnnotationIdentifier{}
					tagAnnotationIdentifier.Key = tagAnnotationL3extRsInstPToProfileL3extInstP.Key
					tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
				}
				for _, tagAnnotationL3extRsInstPToProfileL3extInstP := range tagAnnotationL3extRsInstPToProfileL3extInstPState {
					delete := true
					for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
						if tagAnnotationIdentifier.Key == tagAnnotationL3extRsInstPToProfileL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagAnnotationL3extRsInstPToProfileL3extInstPChildMapForDelete := NewAciObject()
						tagAnnotationL3extRsInstPToProfileL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagAnnotationL3extRsInstPToProfileL3extInstPChildMapForDelete.Attributes["key"] = tagAnnotationL3extRsInstPToProfileL3extInstP.Key.ValueString()
						L3extRsInstPToProfileL3extInstPChildren = append(L3extRsInstPToProfileL3extInstPChildren, map[string]interface{}{"tagAnnotation": tagAnnotationL3extRsInstPToProfileL3extInstPChildMapForDelete})
					}
				}
			}

			var tagTagL3extRsInstPToProfileL3extInstPPlan, tagTagL3extRsInstPToProfileL3extInstPState []TagTagL3extRsInstPToProfileL3extInstPResourceModel
			l3extRsInstPToProfileL3extInstP.TagTag.ElementsAs(ctx, &tagTagL3extRsInstPToProfileL3extInstPPlan, false)
			for _, tagTagL3extRsInstPToProfileL3extInstPstate := range l3extRsInstPToProfileL3extInstPState {
				tagTagL3extRsInstPToProfileL3extInstPstate.TagTag.ElementsAs(ctx, &tagTagL3extRsInstPToProfileL3extInstPState, false)
			}
			if !l3extRsInstPToProfileL3extInstP.TagTag.IsNull() && !l3extRsInstPToProfileL3extInstP.TagTag.IsUnknown() {
				tagTagIdentifiers := []TagTagIdentifier{}
				for _, tagTagL3extRsInstPToProfileL3extInstP := range tagTagL3extRsInstPToProfileL3extInstPPlan {
					tagTagL3extRsInstPToProfileL3extInstPChildMap := NewAciObject()
					if !tagTagL3extRsInstPToProfileL3extInstP.Key.IsNull() && !tagTagL3extRsInstPToProfileL3extInstP.Key.IsUnknown() {
						tagTagL3extRsInstPToProfileL3extInstPChildMap.Attributes["key"] = tagTagL3extRsInstPToProfileL3extInstP.Key.ValueString()
					}
					if !tagTagL3extRsInstPToProfileL3extInstP.Value.IsNull() && !tagTagL3extRsInstPToProfileL3extInstP.Value.IsUnknown() {
						tagTagL3extRsInstPToProfileL3extInstPChildMap.Attributes["value"] = tagTagL3extRsInstPToProfileL3extInstP.Value.ValueString()
					}
					L3extRsInstPToProfileL3extInstPChildren = append(L3extRsInstPToProfileL3extInstPChildren, map[string]interface{}{"tagTag": tagTagL3extRsInstPToProfileL3extInstPChildMap})
					tagTagIdentifier := TagTagIdentifier{}
					tagTagIdentifier.Key = tagTagL3extRsInstPToProfileL3extInstP.Key
					tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
				}
				for _, tagTagL3extRsInstPToProfileL3extInstP := range tagTagL3extRsInstPToProfileL3extInstPState {
					delete := true
					for _, tagTagIdentifier := range tagTagIdentifiers {
						if tagTagIdentifier.Key == tagTagL3extRsInstPToProfileL3extInstP.Key {
							delete = false
							break
						}
					}
					if delete {
						tagTagL3extRsInstPToProfileL3extInstPChildMapForDelete := NewAciObject()
						tagTagL3extRsInstPToProfileL3extInstPChildMapForDelete.Attributes["status"] = "deleted"
						tagTagL3extRsInstPToProfileL3extInstPChildMapForDelete.Attributes["key"] = tagTagL3extRsInstPToProfileL3extInstP.Key.ValueString()
						L3extRsInstPToProfileL3extInstPChildren = append(L3extRsInstPToProfileL3extInstPChildren, map[string]interface{}{"tagTag": tagTagL3extRsInstPToProfileL3extInstPChildMapForDelete})
					}
				}
			}
			childMap.Children = L3extRsInstPToProfileL3extInstPChildren
			childPayloads = append(childPayloads, map[string]interface{}{"l3extRsInstPToProfile": childMap})
			l3extRsInstPToProfileIdentifier := L3extRsInstPToProfileIdentifier{}
			l3extRsInstPToProfileIdentifier.Direction = l3extRsInstPToProfileL3extInstP.Direction
			l3extRsInstPToProfileIdentifier.TnRtctrlProfileName = l3extRsInstPToProfileL3extInstP.TnRtctrlProfileName
			l3extRsInstPToProfileIdentifiers = append(l3extRsInstPToProfileIdentifiers, l3extRsInstPToProfileIdentifier)
		}
		for _, l3extRsInstPToProfile := range l3extRsInstPToProfileL3extInstPState {
			delete := true
			for _, l3extRsInstPToProfileIdentifier := range l3extRsInstPToProfileIdentifiers {
				if l3extRsInstPToProfileIdentifier.Direction == l3extRsInstPToProfile.Direction &&
					l3extRsInstPToProfileIdentifier.TnRtctrlProfileName == l3extRsInstPToProfile.TnRtctrlProfileName {
					delete = false
					break
				}
			}
			if delete {
				l3extRsInstPToProfileChildMapForDelete := NewAciObject()
				l3extRsInstPToProfileChildMapForDelete.Attributes["status"] = "deleted"
				l3extRsInstPToProfileChildMapForDelete.Attributes["direction"] = l3extRsInstPToProfile.Direction.ValueString()
				l3extRsInstPToProfileChildMapForDelete.Attributes["tnRtctrlProfileName"] = l3extRsInstPToProfile.TnRtctrlProfileName.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"l3extRsInstPToProfile": l3extRsInstPToProfileChildMapForDelete})
			}
		}
	} else {
		data.L3extRsInstPToProfile = types.SetNull(data.L3extRsInstPToProfile.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, tagAnnotationL3extInstPPlan, tagAnnotationL3extInstPState []TagAnnotationL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.TagAnnotation.IsNull() && !data.TagAnnotation.IsUnknown() {
		tagAnnotationIdentifiers := []TagAnnotationIdentifier{}
		for _, tagAnnotationL3extInstP := range tagAnnotationL3extInstPPlan {
			childMap := NewAciObject()
			if !tagAnnotationL3extInstP.Key.IsNull() && !tagAnnotationL3extInstP.Key.IsUnknown() {
				childMap.Attributes["key"] = tagAnnotationL3extInstP.Key.ValueString()
			}
			if !tagAnnotationL3extInstP.Value.IsNull() && !tagAnnotationL3extInstP.Value.IsUnknown() {
				childMap.Attributes["value"] = tagAnnotationL3extInstP.Value.ValueString()
			}
			childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap})
			tagAnnotationIdentifier := TagAnnotationIdentifier{}
			tagAnnotationIdentifier.Key = tagAnnotationL3extInstP.Key
			tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier)
		}
		for _, tagAnnotation := range tagAnnotationL3extInstPState {
			delete := true
			for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers {
				if tagAnnotationIdentifier.Key == tagAnnotation.Key {
					delete = false
					break
				}
			}
			if delete {
				tagAnnotationChildMapForDelete := NewAciObject()
				tagAnnotationChildMapForDelete.Attributes["status"] = "deleted"
				tagAnnotationChildMapForDelete.Attributes["key"] = tagAnnotation.Key.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": tagAnnotationChildMapForDelete})
			}
		}
	} else {
		data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *L3extInstPResourceModel, tagTagL3extInstPPlan, tagTagL3extInstPState []TagTagL3extInstPResourceModel) []map[string]interface{} {
	childPayloads := []map[string]interface{}{}
	if !data.TagTag.IsNull() && !data.TagTag.IsUnknown() {
		tagTagIdentifiers := []TagTagIdentifier{}
		for _, tagTagL3extInstP := range tagTagL3extInstPPlan {
			childMap := NewAciObject()
			if !tagTagL3extInstP.Key.IsNull() && !tagTagL3extInstP.Key.IsUnknown() {
				childMap.Attributes["key"] = tagTagL3extInstP.Key.ValueString()
			}
			if !tagTagL3extInstP.Value.IsNull() && !tagTagL3extInstP.Value.IsUnknown() {
				childMap.Attributes["value"] = tagTagL3extInstP.Value.ValueString()
			}
			childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap})
			tagTagIdentifier := TagTagIdentifier{}
			tagTagIdentifier.Key = tagTagL3extInstP.Key
			tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier)
		}
		for _, tagTag := range tagTagL3extInstPState {
			delete := true
			for _, tagTagIdentifier := range tagTagIdentifiers {
				if tagTagIdentifier.Key == tagTag.Key {
					delete = false
					break
				}
			}
			if delete {
				tagTagChildMapForDelete := NewAciObject()
				tagTagChildMapForDelete.Attributes["status"] = "deleted"
				tagTagChildMapForDelete.Attributes["key"] = tagTag.Key.ValueString()
				childPayloads = append(childPayloads, map[string]interface{}{"tagTag": tagTagChildMapForDelete})
			}
		}
	} else {
		data.TagTag = types.SetNull(data.TagTag.ElementType(ctx))
	}

	return childPayloads
}

func getL3extInstPCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, createType bool, data *L3extInstPResourceModel, fvRsConsPlan, fvRsConsState []FvRsConsL3extInstPResourceModel, fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfL3extInstPResourceModel, fvRsCustQosPolPlan, fvRsCustQosPolState FvRsCustQosPolL3extInstPResourceModel, fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgL3extInstPResourceModel, fvRsProtByPlan, fvRsProtByState []FvRsProtByL3extInstPResourceModel, fvRsProvPlan, fvRsProvState []FvRsProvL3extInstPResourceModel, fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedL3extInstPResourceModel, l3extRsInstPToProfilePlan, l3extRsInstPToProfileState []L3extRsInstPToProfileL3extInstPResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationL3extInstPResourceModel, tagTagPlan, tagTagState []TagTagL3extInstPResourceModel) *container.Container {
	payloadMap := map[string]interface{}{}
	payloadMap["attributes"] = map[string]string{}

	if createType && !globalAllowExistingOnCreate {
		payloadMap["attributes"].(map[string]string)["status"] = "created"
	}
	childPayloads := []map[string]interface{}{}

	FvRsConschildPayloads := getL3extInstPFvRsConsChildPayloads(ctx, diags, data, fvRsConsPlan, fvRsConsState)
	if FvRsConschildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsConschildPayloads...)

	FvRsConsIfchildPayloads := getL3extInstPFvRsConsIfChildPayloads(ctx, diags, data, fvRsConsIfPlan, fvRsConsIfState)
	if FvRsConsIfchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsConsIfchildPayloads...)

	FvRsCustQosPolchildPayloads := getL3extInstPFvRsCustQosPolChildPayloads(ctx, diags, data, fvRsCustQosPolPlan, fvRsCustQosPolState)
	if FvRsCustQosPolchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsCustQosPolchildPayloads...)

	FvRsIntraEpgchildPayloads := getL3extInstPFvRsIntraEpgChildPayloads(ctx, diags, data, fvRsIntraEpgPlan, fvRsIntraEpgState)
	if FvRsIntraEpgchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsIntraEpgchildPayloads...)

	FvRsProtBychildPayloads := getL3extInstPFvRsProtByChildPayloads(ctx, diags, data, fvRsProtByPlan, fvRsProtByState)
	if FvRsProtBychildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsProtBychildPayloads...)

	FvRsProvchildPayloads := getL3extInstPFvRsProvChildPayloads(ctx, diags, data, fvRsProvPlan, fvRsProvState)
	if FvRsProvchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsProvchildPayloads...)

	FvRsSecInheritedchildPayloads := getL3extInstPFvRsSecInheritedChildPayloads(ctx, diags, data, fvRsSecInheritedPlan, fvRsSecInheritedState)
	if FvRsSecInheritedchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, FvRsSecInheritedchildPayloads...)

	L3extRsInstPToProfilechildPayloads := getL3extInstPL3extRsInstPToProfileChildPayloads(ctx, diags, data, l3extRsInstPToProfilePlan, l3extRsInstPToProfileState)
	if L3extRsInstPToProfilechildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, L3extRsInstPToProfilechildPayloads...)

	TagAnnotationchildPayloads := getL3extInstPTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState)
	if TagAnnotationchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, TagAnnotationchildPayloads...)

	TagTagchildPayloads := getL3extInstPTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState)
	if TagTagchildPayloads == nil {
		return nil
	}
	childPayloads = append(childPayloads, TagTagchildPayloads...)

	payloadMap["children"] = childPayloads
	if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString()
	}
	if !data.Descr.IsNull() && !data.Descr.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString()
	}
	if !data.ExceptionTag.IsNull() && !data.ExceptionTag.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["exceptionTag"] = data.ExceptionTag.ValueString()
	}
	if !data.FloodOnEncap.IsNull() && !data.FloodOnEncap.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["floodOnEncap"] = data.FloodOnEncap.ValueString()
	}
	if !data.MatchT.IsNull() && !data.MatchT.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["matchT"] = data.MatchT.ValueString()
	}
	if !data.Name.IsNull() && !data.Name.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString()
	}
	if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString()
	}
	if !data.PcEnfPref.IsNull() && !data.PcEnfPref.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["pcEnfPref"] = data.PcEnfPref.ValueString()
	}
	if !data.PrefGrMemb.IsNull() && !data.PrefGrMemb.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["prefGrMemb"] = data.PrefGrMemb.ValueString()
	}
	if !data.Prio.IsNull() && !data.Prio.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["prio"] = data.Prio.ValueString()
	}
	if !data.TargetDscp.IsNull() && !data.TargetDscp.IsUnknown() {
		payloadMap["attributes"].(map[string]string)["targetDscp"] = data.TargetDscp.ValueString()
	}
	payload, err := json.Marshal(map[string]interface{}{"l3extInstP": payloadMap})
	if err != nil {
		diags.AddError(
			"Marshalling of json payload failed",
			fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err),
		)
		return nil
	}

	jsonPayload, err := container.ParseJSON(payload)

	if err != nil {
		diags.AddError(
			"Construction of json payload failed",
			fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err),
		)
		return nil
	}
	return jsonPayload
}
