From 174fc571d722e5bc38d6f6d436d73e03666633e8 Mon Sep 17 00:00:00 2001 From: akinross Date: Wed, 22 Jan 2025 16:10:43 +0100 Subject: [PATCH] [ignore] fix test dependencies for templates with legacy attributes, and add support for reference attributes of dependencies in tests --- gen/definitions/properties.yaml | 61 +++++++++ gen/generator.go | 34 ++++- gen/templates/resource.go.tmpl | 13 +- gen/templates/resource_test.go.tmpl | 78 ++++++------ gen/testvars/fvBD.yaml | 70 ++++++++++- gen/testvars/fvESg.yaml | 2 +- .../provider/resource_aci_application_epg.go | 55 ++++++++ .../resource_aci_application_epg_test.go | 30 ++--- .../provider/resource_aci_bridge_domain.go | 99 +++++++++++++++ .../resource_aci_bridge_domain_test.go | 117 +++++++++++------- .../resource_aci_endpoint_security_group.go | 18 ++- ...source_aci_endpoint_security_group_test.go | 38 +++--- 12 files changed, 486 insertions(+), 129 deletions(-) diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index cad2c499a..7d7234275 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -459,6 +459,9 @@ fvRsScope: parent_dependency: "fvAp" - class_name: "fvAEPg" parent_dependency: "fvAp" + test_values: + all: + vrf_name: "default" fvRsCons: ignores: @@ -1463,6 +1466,9 @@ fvRsABDPolMonPol: relation_from_bridge_domain_to_monitoring_policy: "relation_to_monitor_policy" documentation: tnMonEPGPolName: "The name of the Monitoring Policy object." + test_values: + all: + monitoring_policy_name: "default" fvRsBdToEpRet: overwrites: @@ -1471,18 +1477,27 @@ fvRsBdToEpRet: documentation: tnFvEpRetPolName: "The name of the Endpoint Retention Policy object." resolveAct: "The action to take for resolving the Endpoint Retention Policy object." + test_values: + all: + end_point_retention_policy_name: "default" fvRsBDToFhs: overwrites: relation_from_bridge_domain_to_first_hop_security_policy: "relation_to_first_hop_security_policy" documentation: tnFhsBDPolName: "The name of the First Hop Security Policy object." + test_values: + all: + first_hop_security_policy_name: "default" fvRsBDToNdP: overwrites: relation_from_bridge_domain_to_neighbor_discovery_interface_policy: "relation_to_neighbor_discovery_interface_policy" documentation: tnNdIfPolName: "The name of the Neighbor Discovery Interface Policy object." + test_values: + all: + neighbor_discovery_interface_policy_name: "default" fvRsBDToNetflowMonitorPol: overwrites: @@ -1518,12 +1533,52 @@ fvRsBDToOut: fvRsBDToProfile: overwrites: relation_from_bridge_domain_to_route_control_profile: "relation_to_route_control_profile" + targets: + - class_name: "fvCtx" + parent_dependency: "fvTenant" + overwrite_parent_dn_key: "tenant_dn" + target_dn: "uni/tn-test_tenant/ctx-vrf_name_1" + relation_resource_name: "vrf" + properties: + name: "vrf_name_1" + - class_name: "l3extOut" + parent_dependency: "fvTenant" + overwrite_parent_dn_key: "tenant_dn" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_1" + relation_resource_name: "l3_outside" + properties: + name: "l3_outside_name_1" + relation_l3ext_rs_ectx: aci_vrf.test_vrf_0.id + - class_name: "l3extOut" + parent_dependency: "fvTenant" + overwrite_parent_dn_key: "tenant_dn" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_0" + relation_resource_name: "l3_outside" + properties: + name: "l3_outside_name_0" + relation_l3ext_rs_ectx: aci_vrf.test_vrf_0.id + - class_name: "rtctrlProfile" + parent_dependency: "l3extOut" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_0/prof-route_control_profile_name_1" + parent_dependency_dn_ref: aci_l3_outside.test_l3_outside_1.id + relation_resource_name: "route_control_profile" + properties: + name: "route_control_profile_name_1" + fvRsBDToRelayP: overwrites: relation_from_bridge_domain_to_dhcp_relay_policy: "relation_to_dhcp_relay_policy" documentation: tnDhcpRelayPName: "The name of the DHCP Relay Policy object." + targets: + - class_name: "dhcpRelayP" + parent_dependency: "fvTenant" + overwrite_parent_dn_key: "tenant_dn" + target_dn: "uni/tn-test_tenant/relayp-dhcp_relay_policy_name_1" + relation_resource_name: "dhcp_relay_policy" + properties: + name: "dhcp_relay_policy_name_1" fvRsCtx: documentation: @@ -1532,10 +1587,16 @@ fvRsCtx: fvRsIgmpsn: documentation: tnIgmpSnoopPolName: "The name of the IGMP Snooping Policy object." + test_values: + all: + igmp_snooping_policy_name: "default" fvRsMldsn: documentation: tnMldSnoopPolName: "The name of the MLD Snooping Policy object." + test_values: + all: + mld_snooping_policy_name: "default" fvRogueExceptionMac: test_values: diff --git a/gen/generator.go b/gen/generator.go index 524d0dab8..9ecc7ab24 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -143,6 +143,30 @@ var templateFuncs = template.FuncMap{ "checkDeletableChild": CheckDeletableChild, "emptyChild": EmptyChild, "excludeForNullInSetCheck": ExcludeForNullInSetCheck, + "getTestTargetValue": GetTestTargetValue, + "isReference": IsReference, +} + +func GetTestTargetValue(targets []interface{}, key, value string) string { + + for index, target := range targets { + + var resourceName string + if targetResourceName, ok := target.(map[interface{}]interface{})["target_resource_name"]; ok { + resourceName = targetResourceName.(string) + } + + if properties, ok := target.(map[interface{}]interface{})["properties"]; ok { + + if key == fmt.Sprintf("%s_name", resourceName) { + key = "name" + } + if result, ok := properties.(map[interface{}]interface{})[key]; ok && value == result { + return fmt.Sprintf(`aci_%s.test_%s_%d.%s`, resourceName, resourceName, index%2, key) + } + } + } + return value } func ExcludeForNullInSetCheck(resourceClassName string) bool { @@ -421,6 +445,10 @@ func ContainsString(s, sub string) bool { return strings.Contains(s, sub) } +func IsReference(s string) bool { + return strings.HasPrefix(s, "aci_") || strings.HasPrefix(s, "data.aci_") +} + // Reused from https://github.com/buxizhizhoum/inflection/blob/master/inflection.go#L8 to avoid importing the whole package func Underscore(s string) string { for _, reStr := range []string{`([A-Z]+)([A-Z][a-z])`, `([a-z\d])([A-Z])`} { @@ -2755,7 +2783,11 @@ func getTestDependency(className string, targetMap map[interface{}]interface{}, if parentDependency, ok := targetMap["parent_dependency"]; ok { testDependency.ParentDependency = parentDependency.(string) - testDependency.ParentDependencyDnRef = fmt.Sprintf("%s_%s.test.id", providerName, GetResourceName(parentDependency.(string), definitions)) + if parentDependencyDn, ok := targetMap["parent_dependency_dn_ref"]; ok { + testDependency.ParentDependencyDnRef = parentDependencyDn.(string) + } else { + testDependency.ParentDependencyDnRef = fmt.Sprintf("%s_%s.test.id", providerName, GetResourceName(parentDependency.(string), definitions)) + } } if targetDn, ok := targetMap["target_dn"]; ok { diff --git a/gen/templates/resource.go.tmpl b/gen/templates/resource.go.tmpl index dd19dd323..9983a9c15 100644 --- a/gen/templates/resource.go.tmpl +++ b/gen/templates/resource.go.tmpl @@ -866,6 +866,16 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res } {{- end}} {{- end}} + var stateAttributeValue, planAttributeValue {{$SetName}}{{$.ResourceClassName}}ResourceModel + stateData.{{$SetName}}.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.{{$SetName}}.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + {{- range .Children}} + if stateAttributeValue.{{ .ResourceClassName }}.IsNull() && attributeValues.{{ .ResourceClassName }}.IsNull() { + planAttributeValue.{{ .ResourceClassName }} = basetypes.NewSetUnknown({{ .ResourceClassName }}{{$SetName}}{{$.ResourceClassName}}Type) + } + {{- end}} + {{$SetName}}Object, _ := types.ObjectValueFrom(ctx, {{$SetName}}{{$.ResourceClassName}}Type, planAttributeValue) + planData.{{$SetName}} = {{$SetName}}Object } } else if !configData.Deprecated{{ $SetName }}.IsNull() { var newAttributeValues {{ $SetName }}{{.ParentHierarchy}}ResourceModel @@ -1113,7 +1123,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{$HasNewNamedClassAttributeWithTargetDN = true}} var newAttributeValues []{{ .ResourceClassName }}{{$.ResourceClassName}}ResourceModelV1 if stateData != nil { - stateData.{{.ResourceClassName}}.ElementsAs(ctx, &newAttributeValues, false) + stateData.Deprecated{{.ResourceClassName}}.ElementsAs(ctx, &newAttributeValues, false) } {{- end}} {{- end}} @@ -1543,6 +1553,7 @@ func (r *{{.ResourceClassName}}Resource) Schema(ctx context.Context, req resourc DeprecationMessage: "Attribute `{{.AttributeName}}` is deprecated. The attribute will be removed in the next major version of the provider.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, }, {{- end}} diff --git a/gen/templates/resource_test.go.tmpl b/gen/templates/resource_test.go.tmpl index 20f3f9fff..a63185689 100644 --- a/gen/templates/resource_test.go.tmpl +++ b/gen/templates/resource_test.go.tmpl @@ -1692,7 +1692,11 @@ resource "aci_{{$target.target_resource_name}}" "test_{{$target.target_resource_ {{$target.parent_dn_key}} = {{$target.parent_dependency_dn_ref}} {{- end}} {{- range $key, $value := $target.properties}} + {{- if contains $value "."}} + {{$key}} = {{$value}} + {{- else}} {{$key}} = "{{$value}}" + {{- end}} {{- end}} }{{$testIndex = add $testIndex 1}} @@ -1710,7 +1714,7 @@ resource "aci_{{$.resourceName}}" "allow_test" { {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1722,7 +1726,7 @@ resource "aci_{{$.resourceName}}" "allow_test_2" { {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1738,7 +1742,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1754,7 +1758,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.all}} {{- if not $contains}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1798,7 +1802,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.default}} {{- if not $contains}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1842,7 +1846,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1863,15 +1867,15 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] {{- else}} {{$child_key}} = [] {{- end}} - {{- else if ne $child_key "deletable_child"}} - {{$child_key}} = "{{$child_value}}" + {{- else if ne $child_key "deletable_child"}}{{$attributeValue := getTestTargetValue $.child_targets $child_key $child_value}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- end}} {{- end}} {{- end}}{{ $index = add $index 1 }} @@ -1892,9 +1896,9 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} - {{- else if ne $child_key "deletable_child"}} - {{$child_key}} = "{{$child_value}}" + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{- else if ne $child_key "deletable_child"}}{{$attributeValue := getTestTargetValue $.child_targets $child_key $child_value}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- end}} {{- end}} {{- end}}{{ $index = add $index 1 }} @@ -1913,7 +1917,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1928,7 +1932,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -1952,15 +1956,15 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] {{- else}} {{$child_key}} = [] {{- end}} - {{- else if ne $child_key "deletable_child"}} - {{$child_key}} = "{{$child_value}}" + {{- else if ne $child_key "deletable_child"}}{{$attributeValue := getTestTargetValue $.child_targets $child_key $child_value}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- end}} {{- end}} {{- end}}{{ $index = add $index 1 }} @@ -1981,9 +1985,9 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil 1 false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} - {{- else }} - {{$child_key}} = "{{$child_value}}" + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{- else }}{{$attributeValue := getTestTargetValue $.child_targets $child_key $child_value}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- end}} {{- end}} {{- end}} @@ -2001,7 +2005,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2025,7 +2029,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2053,7 +2057,7 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas parent_dn = {{.parent_dn}} {{- range $key, $value := $.custom_type}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2165,7 +2169,7 @@ const testConfig{{.resourceClassName}}Children = {{- if $childDependencies }} te resource "aci_{{$.resourceName}}" "test" { {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true nil 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2194,7 +2198,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2223,7 +2227,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if ne $child_key "deletable_child"}} {{$child_key}} = "{{$child_value}}" {{- end}} @@ -2248,7 +2252,7 @@ const testConfig{{.resourceClassName}}ChildrenRemoveFromConfig = {{- if $childDe resource "aci_{{$.resourceName}}" "test" { {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true nil 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2260,7 +2264,7 @@ const testConfig{{.resourceClassName}}ChildrenRemoveOne = {{- if $childDependenc resource "aci_{{$.resourceName}}" "test" { {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true nil 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2292,7 +2296,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2321,7 +2325,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil 1 false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$child_key}} = "{{$child_value}}" {{- end}} @@ -2338,7 +2342,7 @@ const testConfig{{.resourceClassName}}ChildrenRemoveAll = {{- if $childDependenc resource "aci_{{$.resourceName}}" "test" { {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true nil 0 false}} - {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$key}} = "{{$value}}" {{- end }} @@ -2370,7 +2374,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2432,7 +2436,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$indent}}{{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$indent}}{{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$indent}}{{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2461,7 +2465,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$indent}}{{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$indent}}{{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if ne $child_key "deletable_child"}} {{$indent}}{{$child_key}} = "{{$child_value}}" {{- end}} @@ -2505,7 +2509,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$indent}}{{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$indent}}{{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$indent}}{{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] @@ -2534,7 +2538,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil 1 false}} - {{$indent}}{{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$indent}}{{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else }} {{$indent}}{{$child_key}} = "{{$child_value}}" {{- end}} @@ -2576,7 +2580,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- end }} {{- else }} {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}} - {{$indent}}{{$child_key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{$indent}}{{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} {{- else if (isInterfaceSlice $child_value)}} {{- if lt 0 (len $child_value)}} {{$indent}}{{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}] diff --git a/gen/testvars/fvBD.yaml b/gen/testvars/fvBD.yaml index 2f5a503e7..c7abfed48 100644 --- a/gen/testvars/fvBD.yaml +++ b/gen/testvars/fvBD.yaml @@ -148,7 +148,7 @@ children: relation_to_monitor_policy: - annotation: "annotation_1" - monitoring_policy_name: "monitoring_policy_name_1" + monitoring_policy_name: "default" deletable_child: true children: annotations: @@ -167,7 +167,7 @@ children: relation_to_first_hop_security_policy: - annotation: "annotation_1" - first_hop_security_policy_name: "first_hop_security_policy_name_1" + first_hop_security_policy_name: "default" deletable_child: true children: annotations: @@ -186,7 +186,7 @@ children: relation_to_neighbor_discovery_interface_policy: - annotation: "annotation_1" - neighbor_discovery_interface_policy_name: "neighbor_discovery_interface_policy_name_1" + neighbor_discovery_interface_policy_name: "default" deletable_child: false children: @@ -322,7 +322,7 @@ children: relation_to_end_point_retention_policy: - annotation: "annotation_1" resolve_action: "inherit" - end_point_retention_policy_name: "end_point_retention_policy_name_1" + end_point_retention_policy_name: "default" deletable_child: false children: @@ -362,7 +362,7 @@ children: relation_to_igmp_snooping_policy: - annotation: "annotation_1" - igmp_snooping_policy_name: "igmp_snooping_policy_name_1" + igmp_snooping_policy_name: "default" deletable_child: false children: @@ -382,7 +382,7 @@ children: relation_to_mld_snooping_policy: - annotation: "annotation_1" - mld_snooping_policy_name: "mld_snooping_policy_name_1" + mld_snooping_policy_name: "default" deletable_child: false children: @@ -420,5 +420,63 @@ parents: parent_dn: "aci_tenant.test.id" class_in_parent: false test_type: apic +child_targets: + - class_name: "fvCtx" + target_dn: "uni/tn-test_tenant/ctx-vrf_name_1" + relation_resource_name: "vrf" + static: false + target_dn_ref: "aci_vrf.test_vrf_0.id" + parent_dependency: "fvTenant" + parent_dependency_dn_ref: "aci_tenant.test.id" + target_resource_name: "vrf" + parent_dn_key: "tenant_dn" + properties: + name: "vrf_name_1" + - class_name: "l3extOut" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_1" + relation_resource_name: "l3_outside" + static: false + target_dn_ref: "aci_l3_outside.test_l3_outside_1.id" + parent_dependency: "fvTenant" + parent_dependency_dn_ref: "aci_tenant.test.id" + target_resource_name: "l3_outside" + parent_dn_key: "tenant_dn" + properties: + name: "l3_outside_name_1" + relation_l3ext_rs_ectx: "aci_vrf.test_vrf_0.id" + - class_name: "l3extOut" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_0" + relation_resource_name: "l3_outside" + static: false + target_dn_ref: "aci_l3_outside.test_l3_outside_0.id" + parent_dependency: "fvTenant" + parent_dependency_dn_ref: "aci_tenant.test.id" + target_resource_name: "l3_outside" + parent_dn_key: "tenant_dn" + properties: + name: "l3_outside_name_0" + relation_l3ext_rs_ectx: "aci_vrf.test_vrf_0.id" + - class_name: "rtctrlProfile" + target_dn: "uni/tn-test_tenant/out-abr_l3_outside_name_0/prof-route_control_profile_name_1" + relation_resource_name: "route_control_profile" + static: false + target_dn_ref: "aci_route_control_profile.test_route_control_profile_1.id" + parent_dependency: "l3extOut" + parent_dependency_dn_ref: "aci_l3_outside.test_l3_outside_1.id" + target_resource_name: "route_control_profile" + parent_dn_key: "parent_dn" + properties: + name: "route_control_profile_name_1" + - class_name: "dhcpRelayP" + target_dn: "uni/tn-test_tenant/relayp-dhcp_relay_policy_name_1" + relation_resource_name: "dhcp_relay_policy" + static: false + target_dn_ref: "aci_dhcp_relay_policy.test_dhcp_relay_policy_0.id" + parent_dependency: "fvTenant" + parent_dependency_dn_ref: "aci_tenant.test.id" + target_resource_name: "dhcp_relay_policy" + parent_dn_key: "tenant_dn" + properties: + name: "dhcp_relay_policy_name_1" class_version: 1.0(1e)- version_mismatch: true diff --git a/gen/testvars/fvESg.yaml b/gen/testvars/fvESg.yaml index 4206ad2a8..da0e9b7f6 100644 --- a/gen/testvars/fvESg.yaml +++ b/gen/testvars/fvESg.yaml @@ -198,7 +198,7 @@ children: relation_to_vrf: - annotation: "annotation_1" - vrf_name: "vrf_name_1" + vrf_name: "default" deletable_child: false children: diff --git a/internal/provider/resource_aci_application_epg.go b/internal/provider/resource_aci_application_epg.go index 0a6801822..2725c4e5b 100644 --- a/internal/provider/resource_aci_application_epg.go +++ b/internal/provider/resource_aci_application_epg.go @@ -3264,6 +3264,17 @@ func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan if GetMOName(stateData.DeprecatedFvRsAEPgMonPol.ValueString()) == attributeValues.TnMonEPGPolName.ValueString() && !attributeValues.TnMonEPGPolName.IsNull() { planData.DeprecatedFvRsAEPgMonPol = stateData.DeprecatedFvRsAEPgMonPol } + var stateAttributeValue, planAttributeValue FvRsAEPgMonPolFvAEPgResourceModel + stateData.FvRsAEPgMonPol.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsAEPgMonPol.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsAEPgMonPolFvAEPgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsAEPgMonPolFvAEPgType) + } + FvRsAEPgMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsAEPgMonPolFvAEPgType, planAttributeValue) + planData.FvRsAEPgMonPol = FvRsAEPgMonPolObject } } else if !configData.DeprecatedFvRsAEPgMonPol.IsNull() { var newAttributeValues FvRsAEPgMonPolFvAEPgResourceModel @@ -3302,6 +3313,17 @@ func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan if GetMOName(stateData.DeprecatedFvRsBd.ValueString()) == attributeValues.TnFvBDName.ValueString() && !attributeValues.TnFvBDName.IsNull() { planData.DeprecatedFvRsBd = stateData.DeprecatedFvRsBd } + var stateAttributeValue, planAttributeValue FvRsBdFvAEPgResourceModel + stateData.FvRsBd.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBd.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBdFvAEPgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBdFvAEPgType) + } + FvRsBdObject, _ := types.ObjectValueFrom(ctx, FvRsBdFvAEPgType, planAttributeValue) + planData.FvRsBd = FvRsBdObject } } else if !configData.DeprecatedFvRsBd.IsNull() { var newAttributeValues FvRsBdFvAEPgResourceModel @@ -3472,6 +3494,17 @@ func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan if GetMOName(stateData.DeprecatedFvRsCustQosPol.ValueString()) == attributeValues.TnQosCustomPolName.ValueString() && !attributeValues.TnQosCustomPolName.IsNull() { planData.DeprecatedFvRsCustQosPol = stateData.DeprecatedFvRsCustQosPol } + var stateAttributeValue, planAttributeValue FvRsCustQosPolFvAEPgResourceModel + stateData.FvRsCustQosPol.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsCustQosPol.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsCustQosPolFvAEPgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsCustQosPolFvAEPgType) + } + FvRsCustQosPolObject, _ := types.ObjectValueFrom(ctx, FvRsCustQosPolFvAEPgType, planAttributeValue) + planData.FvRsCustQosPol = FvRsCustQosPolObject } } else if !configData.DeprecatedFvRsCustQosPol.IsNull() { var newAttributeValues FvRsCustQosPolFvAEPgResourceModel @@ -3510,6 +3543,17 @@ func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan if GetMOName(stateData.DeprecatedFvRsDppPol.ValueString()) == attributeValues.TnQosDppPolName.ValueString() && !attributeValues.TnQosDppPolName.IsNull() { planData.DeprecatedFvRsDppPol = stateData.DeprecatedFvRsDppPol } + var stateAttributeValue, planAttributeValue FvRsDppPolFvAEPgResourceModel + stateData.FvRsDppPol.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsDppPol.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsDppPolFvAEPgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsDppPolFvAEPgType) + } + FvRsDppPolObject, _ := types.ObjectValueFrom(ctx, FvRsDppPolFvAEPgType, planAttributeValue) + planData.FvRsDppPol = FvRsDppPolObject } } else if !configData.DeprecatedFvRsDppPol.IsNull() { var newAttributeValues FvRsDppPolFvAEPgResourceModel @@ -3956,6 +4000,17 @@ func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlan if GetMOName(stateData.DeprecatedFvRsTrustCtrl.ValueString()) == attributeValues.TnFhsTrustCtrlPolName.ValueString() && !attributeValues.TnFhsTrustCtrlPolName.IsNull() { planData.DeprecatedFvRsTrustCtrl = stateData.DeprecatedFvRsTrustCtrl } + var stateAttributeValue, planAttributeValue FvRsTrustCtrlFvAEPgResourceModel + stateData.FvRsTrustCtrl.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsTrustCtrl.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsTrustCtrlFvAEPgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsTrustCtrlFvAEPgType) + } + FvRsTrustCtrlObject, _ := types.ObjectValueFrom(ctx, FvRsTrustCtrlFvAEPgType, planAttributeValue) + planData.FvRsTrustCtrl = FvRsTrustCtrlObject } } else if !configData.DeprecatedFvRsTrustCtrl.IsNull() { var newAttributeValues FvRsTrustCtrlFvAEPgResourceModel diff --git a/internal/provider/resource_aci_application_epg_test.go b/internal/provider/resource_aci_application_epg_test.go index 9a051e08b..4314d0497 100644 --- a/internal/provider/resource_aci_application_epg_test.go +++ b/internal/provider/resource_aci_application_epg_test.go @@ -1324,7 +1324,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name priority = "level1" }, { @@ -1349,7 +1349,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name priority = "level2" }, ] @@ -1620,7 +1620,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_0" + imported_contract_name = aci_imported_contract.test_imported_contract_0.name priority = "level1" }, { @@ -1645,7 +1645,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_1" + imported_contract_name = aci_imported_contract.test_imported_contract_1.name priority = "level2" }, ] @@ -1672,7 +1672,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name }, { annotation = "annotation_2" @@ -1696,7 +1696,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name }, ] relation_to_provided_contracts = [ @@ -1722,7 +1722,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name match_criteria = "All" priority = "level1" }, @@ -1748,7 +1748,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name match_criteria = "AtleastOne" priority = "level2" }, @@ -1894,7 +1894,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - taboo_contract_name = "taboo_contract_name_0" + taboo_contract_name = aci_taboo_contract.test_taboo_contract_0.name }, { annotation = "annotation_2" @@ -1918,7 +1918,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - taboo_contract_name = "taboo_contract_name_1" + taboo_contract_name = aci_taboo_contract.test_taboo_contract_1.name }, ] relation_to_trust_control_policy = { @@ -2008,7 +2008,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name priority = "level2" }, ] @@ -2121,7 +2121,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_1" + imported_contract_name = aci_imported_contract.test_imported_contract_1.name priority = "level2" }, ] @@ -2140,7 +2140,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name }, ] relation_to_provided_contracts = [ @@ -2158,7 +2158,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name match_criteria = "AtleastOne" priority = "level2" }, @@ -2223,7 +2223,7 @@ resource "aci_application_epg" "test" { value = "test_value" }, ] - taboo_contract_name = "taboo_contract_name_1" + taboo_contract_name = aci_taboo_contract.test_taboo_contract_1.name }, ] relation_to_trust_control_policy = {} diff --git a/internal/provider/resource_aci_bridge_domain.go b/internal/provider/resource_aci_bridge_domain.go index 1fd58aac5..6887393f8 100644 --- a/internal/provider/resource_aci_bridge_domain.go +++ b/internal/provider/resource_aci_bridge_domain.go @@ -2433,6 +2433,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsBDToRelayP.ValueString()) == attributeValues.TnDhcpRelayPName.ValueString() && !attributeValues.TnDhcpRelayPName.IsNull() { planData.DeprecatedFvRsBDToRelayP = stateData.DeprecatedFvRsBDToRelayP } + var stateAttributeValue, planAttributeValue FvRsBDToRelayPFvBDResourceModel + stateData.FvRsBDToRelayP.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBDToRelayP.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBDToRelayPFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBDToRelayPFvBDType) + } + FvRsBDToRelayPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToRelayPFvBDType, planAttributeValue) + planData.FvRsBDToRelayP = FvRsBDToRelayPObject } } else if !configData.DeprecatedFvRsBDToRelayP.IsNull() { var newAttributeValues FvRsBDToRelayPFvBDResourceModel @@ -2471,6 +2482,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsBdToEpRet.ValueString()) == attributeValues.TnFvEpRetPolName.ValueString() && !attributeValues.TnFvEpRetPolName.IsNull() { planData.DeprecatedFvRsBdToEpRet = stateData.DeprecatedFvRsBdToEpRet } + var stateAttributeValue, planAttributeValue FvRsBdToEpRetFvBDResourceModel + stateData.FvRsBdToEpRet.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBdToEpRet.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBdToEpRetFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBdToEpRetFvBDType) + } + FvRsBdToEpRetObject, _ := types.ObjectValueFrom(ctx, FvRsBdToEpRetFvBDType, planAttributeValue) + planData.FvRsBdToEpRet = FvRsBdToEpRetObject } } else if !configData.DeprecatedFvRsBdToEpRet.IsNull() { var newAttributeValues FvRsBdToEpRetFvBDResourceModel @@ -2510,6 +2532,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsBDToFhs.ValueString()) == attributeValues.TnFhsBDPolName.ValueString() && !attributeValues.TnFhsBDPolName.IsNull() { planData.DeprecatedFvRsBDToFhs = stateData.DeprecatedFvRsBDToFhs } + var stateAttributeValue, planAttributeValue FvRsBDToFhsFvBDResourceModel + stateData.FvRsBDToFhs.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBDToFhs.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBDToFhsFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBDToFhsFvBDType) + } + FvRsBDToFhsObject, _ := types.ObjectValueFrom(ctx, FvRsBDToFhsFvBDType, planAttributeValue) + planData.FvRsBDToFhs = FvRsBDToFhsObject } } else if !configData.DeprecatedFvRsBDToFhs.IsNull() { var newAttributeValues FvRsBDToFhsFvBDResourceModel @@ -2548,6 +2581,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsIgmpsn.ValueString()) == attributeValues.TnIgmpSnoopPolName.ValueString() && !attributeValues.TnIgmpSnoopPolName.IsNull() { planData.DeprecatedFvRsIgmpsn = stateData.DeprecatedFvRsIgmpsn } + var stateAttributeValue, planAttributeValue FvRsIgmpsnFvBDResourceModel + stateData.FvRsIgmpsn.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsIgmpsn.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsIgmpsnFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsIgmpsnFvBDType) + } + FvRsIgmpsnObject, _ := types.ObjectValueFrom(ctx, FvRsIgmpsnFvBDType, planAttributeValue) + planData.FvRsIgmpsn = FvRsIgmpsnObject } } else if !configData.DeprecatedFvRsIgmpsn.IsNull() { var newAttributeValues FvRsIgmpsnFvBDResourceModel @@ -2651,6 +2695,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsMldsn.ValueString()) == attributeValues.TnMldSnoopPolName.ValueString() && !attributeValues.TnMldSnoopPolName.IsNull() { planData.DeprecatedFvRsMldsn = stateData.DeprecatedFvRsMldsn } + var stateAttributeValue, planAttributeValue FvRsMldsnFvBDResourceModel + stateData.FvRsMldsn.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsMldsn.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsMldsnFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsMldsnFvBDType) + } + FvRsMldsnObject, _ := types.ObjectValueFrom(ctx, FvRsMldsnFvBDType, planAttributeValue) + planData.FvRsMldsn = FvRsMldsnObject } } else if !configData.DeprecatedFvRsMldsn.IsNull() { var newAttributeValues FvRsMldsnFvBDResourceModel @@ -2689,6 +2744,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsABDPolMonPol.ValueString()) == attributeValues.TnMonEPGPolName.ValueString() && !attributeValues.TnMonEPGPolName.IsNull() { planData.DeprecatedFvRsABDPolMonPol = stateData.DeprecatedFvRsABDPolMonPol } + var stateAttributeValue, planAttributeValue FvRsABDPolMonPolFvBDResourceModel + stateData.FvRsABDPolMonPol.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsABDPolMonPol.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsABDPolMonPolFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsABDPolMonPolFvBDType) + } + FvRsABDPolMonPolObject, _ := types.ObjectValueFrom(ctx, FvRsABDPolMonPolFvBDType, planAttributeValue) + planData.FvRsABDPolMonPol = FvRsABDPolMonPolObject } } else if !configData.DeprecatedFvRsABDPolMonPol.IsNull() { var newAttributeValues FvRsABDPolMonPolFvBDResourceModel @@ -2727,6 +2793,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsBDToNdP.ValueString()) == attributeValues.TnNdIfPolName.ValueString() && !attributeValues.TnNdIfPolName.IsNull() { planData.DeprecatedFvRsBDToNdP = stateData.DeprecatedFvRsBDToNdP } + var stateAttributeValue, planAttributeValue FvRsBDToNdPFvBDResourceModel + stateData.FvRsBDToNdP.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBDToNdP.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBDToNdPFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBDToNdPFvBDType) + } + FvRsBDToNdPObject, _ := types.ObjectValueFrom(ctx, FvRsBDToNdPFvBDType, planAttributeValue) + planData.FvRsBDToNdP = FvRsBDToNdPObject } } else if !configData.DeprecatedFvRsBDToNdP.IsNull() { var newAttributeValues FvRsBDToNdPFvBDResourceModel @@ -2765,6 +2842,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsBDToProfile.ValueString()) == attributeValues.TnRtctrlProfileName.ValueString() && !attributeValues.TnRtctrlProfileName.IsNull() { planData.DeprecatedFvRsBDToProfile = stateData.DeprecatedFvRsBDToProfile } + var stateAttributeValue, planAttributeValue FvRsBDToProfileFvBDResourceModel + stateData.FvRsBDToProfile.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsBDToProfile.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsBDToProfileFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsBDToProfileFvBDType) + } + FvRsBDToProfileObject, _ := types.ObjectValueFrom(ctx, FvRsBDToProfileFvBDType, planAttributeValue) + planData.FvRsBDToProfile = FvRsBDToProfileObject } } else if !configData.DeprecatedFvRsBDToProfile.IsNull() { var newAttributeValues FvRsBDToProfileFvBDResourceModel @@ -2804,6 +2892,17 @@ func (r *FvBDResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRe if GetMOName(stateData.DeprecatedFvRsCtx.ValueString()) == attributeValues.TnFvCtxName.ValueString() && !attributeValues.TnFvCtxName.IsNull() { planData.DeprecatedFvRsCtx = stateData.DeprecatedFvRsCtx } + var stateAttributeValue, planAttributeValue FvRsCtxFvBDResourceModel + stateData.FvRsCtx.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsCtx.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsCtxFvBDType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsCtxFvBDType) + } + FvRsCtxObject, _ := types.ObjectValueFrom(ctx, FvRsCtxFvBDType, planAttributeValue) + planData.FvRsCtx = FvRsCtxObject } } else if !configData.DeprecatedFvRsCtx.IsNull() { var newAttributeValues FvRsCtxFvBDResourceModel diff --git a/internal/provider/resource_aci_bridge_domain_test.go b/internal/provider/resource_aci_bridge_domain_test.go index dff02c20a..35a3b750c 100644 --- a/internal/provider/resource_aci_bridge_domain_test.go +++ b/internal/provider/resource_aci_bridge_domain_test.go @@ -356,22 +356,22 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_dhcp_relay_policy.dhcp_relay_policy_name", "dhcp_relay_policy_name_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_action", "inherit"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "first_hop_security_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.l3_outside_name", "l3_outside_name_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.annotation", "annotation_2"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.1.l3_outside_name", "l3_outside_name_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.filter_type", "ce"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.netflow_monitor_policy_name", "netflow_monitor_policy_name_0"), @@ -460,7 +460,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_action", "inherit"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.annotations.0.key", "key_0"), @@ -473,7 +473,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "first_hop_security_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_first_hop_security_policy.first_hop_security_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotations.0.value", "value_1"), @@ -485,7 +485,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotations.0.value", "value_1"), @@ -522,7 +522,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.annotations.0.value", "value_1"), @@ -534,7 +534,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_monitor_policy.monitoring_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotations.0.value", "value_1"), @@ -546,7 +546,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotations.0.value", "value_1"), @@ -652,7 +652,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.#", "1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_action", "inherit"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotations.0.key", "key_1"), @@ -661,7 +661,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.#", "1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotation", "annotation_2"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotations.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.0.annotations.0.value", "test_value"), @@ -678,7 +678,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.#", "1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotations.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotations.0.value", "test_value"), @@ -686,7 +686,7 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.#", "1"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotation", "annotation_2"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotations.0.key", "key_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.0.annotations.0.value", "test_value"), @@ -794,21 +794,21 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.annotations.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.tags.#", "0"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "end_point_retention_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.end_point_retention_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_end_point_retention_policy.resolve_action", "inherit"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.annotations.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.tags.#", "0"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "igmp_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_igmp_snooping_policy.igmp_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_l3_outsides.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.annotations.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.tags.#", "0"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "mld_snooping_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_mld_snooping_policy.mld_snooping_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.annotations.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.tags.#", "0"), - resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "neighbor_discovery_interface_policy_name_1"), + resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_neighbor_discovery_interface_policy.neighbor_discovery_interface_policy_name", "default"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_netflow_monitor_policies.#", "0"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_bridge_domain.test", "relation_to_vrf.annotations.#", "0"), @@ -886,6 +886,31 @@ func TestAccResourceFvBDWithFvTenant(t *testing.T) { }) } +const testChildDependencyConfigFvBD = ` +resource "aci_vrf" "test_vrf_0"{ + tenant_dn = aci_tenant.test.id + name = "vrf_name_1" +} +resource "aci_l3_outside" "test_l3_outside_1"{ + tenant_dn = aci_tenant.test.id + name = "l3_outside_name_1" + relation_l3ext_rs_ectx = aci_vrf.test_vrf_0.id +} +resource "aci_l3_outside" "test_l3_outside_0"{ + tenant_dn = aci_tenant.test.id + name = "l3_outside_name_0" + relation_l3ext_rs_ectx = aci_vrf.test_vrf_0.id +} +resource "aci_route_control_profile" "test_route_control_profile_1"{ + parent_dn = aci_l3_outside.test_l3_outside_1.id + name = "route_control_profile_name_1" +} +resource "aci_dhcp_relay_policy" "test_dhcp_relay_policy_0"{ + tenant_dn = aci_tenant.test.id + name = "dhcp_relay_policy_name_1" +} +` + const testConfigFvBDMinDependencyWithFvTenantAllowExisting = testConfigFvTenantMin + ` resource "aci_bridge_domain" "allow_test" { parent_dn = aci_tenant.test.id @@ -970,7 +995,7 @@ resource "aci_bridge_domain" "test" { virtual_mac_address = "not-applicable" } ` -const testConfigFvBDChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +const testConfigFvBDChildrenDependencyWithFvTenant = testChildDependencyConfigFvBD + testConfigFvTenantMin + ` resource "aci_bridge_domain" "test" { parent_dn = aci_tenant.test.id name = "test_name" @@ -1035,7 +1060,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - dhcp_relay_policy_name = "dhcp_relay_policy_name_1" + dhcp_relay_policy_name = aci_dhcp_relay_policy.test_dhcp_relay_policy_0.name } relation_to_end_point_retention_policy = { annotation = "annotation_1" @@ -1059,7 +1084,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - end_point_retention_policy_name = "end_point_retention_policy_name_1" + end_point_retention_policy_name = "default" resolve_action = "inherit" } relation_to_first_hop_security_policy = { @@ -1084,7 +1109,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - first_hop_security_policy_name = "first_hop_security_policy_name_1" + first_hop_security_policy_name = "default" } relation_to_igmp_snooping_policy = { annotation = "annotation_1" @@ -1108,7 +1133,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - igmp_snooping_policy_name = "igmp_snooping_policy_name_1" + igmp_snooping_policy_name = "default" } relation_to_l3_outsides = [ { @@ -1133,7 +1158,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - l3_outside_name = "l3_outside_name_0" + l3_outside_name = aci_l3_outside.test_l3_outside_0.name }, { annotation = "annotation_2" @@ -1157,7 +1182,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - l3_outside_name = "l3_outside_name_1" + l3_outside_name = aci_l3_outside.test_l3_outside_1.name }, ] relation_to_mld_snooping_policy = { @@ -1182,7 +1207,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - mld_snooping_policy_name = "mld_snooping_policy_name_1" + mld_snooping_policy_name = "default" } relation_to_monitor_policy = { annotation = "annotation_1" @@ -1206,7 +1231,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - monitoring_policy_name = "monitoring_policy_name_1" + monitoring_policy_name = "default" } relation_to_neighbor_discovery_interface_policy = { annotation = "annotation_1" @@ -1230,7 +1255,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - neighbor_discovery_interface_policy_name = "neighbor_discovery_interface_policy_name_1" + neighbor_discovery_interface_policy_name = "default" } relation_to_netflow_monitor_policies = [ { @@ -1306,8 +1331,8 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - l3_outside_name = "l3_outside_name_1" - route_control_profile_name = "route_control_profile_name_1" + l3_outside_name = aci_l3_outside.test_l3_outside_1.name + route_control_profile_name = aci_route_control_profile.test_route_control_profile_1.name } relation_to_vrf = { annotation = "annotation_1" @@ -1331,7 +1356,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - vrf_name = "vrf_name_1" + vrf_name = aci_vrf.test_vrf_0.name } rogue_coop_exceptions = [ { @@ -1402,14 +1427,14 @@ resource "aci_bridge_domain" "test" { } ` -const testConfigFvBDChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +const testConfigFvBDChildrenRemoveFromConfigDependencyWithFvTenant = testChildDependencyConfigFvBD + testConfigFvTenantMin + ` resource "aci_bridge_domain" "test" { parent_dn = aci_tenant.test.id name = "test_name" } ` -const testConfigFvBDChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +const testConfigFvBDChildrenRemoveOneDependencyWithFvTenant = testChildDependencyConfigFvBD + testConfigFvTenantMin + ` resource "aci_bridge_domain" "test" { parent_dn = aci_tenant.test.id name = "test_name" @@ -1435,7 +1460,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - end_point_retention_policy_name = "end_point_retention_policy_name_1" + end_point_retention_policy_name = "default" resolve_action = "inherit" } relation_to_first_hop_security_policy = {} @@ -1453,7 +1478,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - igmp_snooping_policy_name = "igmp_snooping_policy_name_1" + igmp_snooping_policy_name = "default" } relation_to_l3_outsides = [ { @@ -1470,7 +1495,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - l3_outside_name = "l3_outside_name_1" + l3_outside_name = aci_l3_outside.test_l3_outside_1.name }, ] relation_to_mld_snooping_policy = { @@ -1487,7 +1512,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - mld_snooping_policy_name = "mld_snooping_policy_name_1" + mld_snooping_policy_name = "default" } relation_to_monitor_policy = {} relation_to_neighbor_discovery_interface_policy = { @@ -1504,7 +1529,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - neighbor_discovery_interface_policy_name = "neighbor_discovery_interface_policy_name_1" + neighbor_discovery_interface_policy_name = "default" } relation_to_netflow_monitor_policies = [ { @@ -1540,7 +1565,7 @@ resource "aci_bridge_domain" "test" { value = "test_value" }, ] - vrf_name = "vrf_name_1" + vrf_name = aci_vrf.test_vrf_0.name } rogue_coop_exceptions = [ { @@ -1572,7 +1597,7 @@ resource "aci_bridge_domain" "test" { } ` -const testConfigFvBDChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +const testConfigFvBDChildrenRemoveAllDependencyWithFvTenant = testChildDependencyConfigFvBD + testConfigFvTenantMin + ` resource "aci_bridge_domain" "test" { parent_dn = aci_tenant.test.id name = "test_name" @@ -1583,7 +1608,7 @@ resource "aci_bridge_domain" "test" { annotation = "annotation_1" annotations = [] tags = [] - end_point_retention_policy_name = "end_point_retention_policy_name_1" + end_point_retention_policy_name = "default" resolve_action = "inherit" } relation_to_first_hop_security_policy = {} @@ -1591,21 +1616,21 @@ resource "aci_bridge_domain" "test" { annotation = "annotation_1" annotations = [] tags = [] - igmp_snooping_policy_name = "igmp_snooping_policy_name_1" + igmp_snooping_policy_name = "default" } relation_to_l3_outsides = [] relation_to_mld_snooping_policy = { annotation = "annotation_1" annotations = [] tags = [] - mld_snooping_policy_name = "mld_snooping_policy_name_1" + mld_snooping_policy_name = "default" } relation_to_monitor_policy = {} relation_to_neighbor_discovery_interface_policy = { annotation = "annotation_1" annotations = [] tags = [] - neighbor_discovery_interface_policy_name = "neighbor_discovery_interface_policy_name_1" + neighbor_discovery_interface_policy_name = "default" } relation_to_netflow_monitor_policies = [] relation_to_route_control_profile = {} diff --git a/internal/provider/resource_aci_endpoint_security_group.go b/internal/provider/resource_aci_endpoint_security_group.go index e4fc192dd..ea948aaeb 100644 --- a/internal/provider/resource_aci_endpoint_security_group.go +++ b/internal/provider/resource_aci_endpoint_security_group.go @@ -1591,6 +1591,17 @@ func (r *FvESgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanR if GetMOName(stateData.DeprecatedFvRsScope.ValueString()) == attributeValues.TnFvCtxName.ValueString() && !attributeValues.TnFvCtxName.IsNull() { planData.DeprecatedFvRsScope = stateData.DeprecatedFvRsScope } + var stateAttributeValue, planAttributeValue FvRsScopeFvESgResourceModel + stateData.FvRsScope.As(ctx, &stateAttributeValue, basetypes.ObjectAsOptions{}) + planData.FvRsScope.As(ctx, &planAttributeValue, basetypes.ObjectAsOptions{}) + if stateAttributeValue.TagAnnotation.IsNull() && attributeValues.TagAnnotation.IsNull() { + planAttributeValue.TagAnnotation = basetypes.NewSetUnknown(TagAnnotationFvRsScopeFvESgType) + } + if stateAttributeValue.TagTag.IsNull() && attributeValues.TagTag.IsNull() { + planAttributeValue.TagTag = basetypes.NewSetUnknown(TagTagFvRsScopeFvESgType) + } + FvRsScopeObject, _ := types.ObjectValueFrom(ctx, FvRsScopeFvESgType, planAttributeValue) + planData.FvRsScope = FvRsScopeObject } } else if !configData.DeprecatedFvRsScope.IsNull() { var newAttributeValues FvRsScopeFvESgResourceModel @@ -1626,7 +1637,7 @@ func (r *FvESgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanR var newAttributeValues []FvRsConsFvESgResourceModelV1 if stateData != nil { - stateData.FvRsCons.ElementsAs(ctx, &newAttributeValues, false) + stateData.DeprecatedFvRsCons.ElementsAs(ctx, &newAttributeValues, false) } if len(attributeValues) > 0 { for _, attributeValue := range attributeValues { @@ -1700,7 +1711,7 @@ func (r *FvESgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanR var newAttributeValues []FvRsConsIfFvESgResourceModelV1 if stateData != nil { - stateData.FvRsConsIf.ElementsAs(ctx, &newAttributeValues, false) + stateData.DeprecatedFvRsConsIf.ElementsAs(ctx, &newAttributeValues, false) } if len(attributeValues) > 0 { for _, attributeValue := range attributeValues { @@ -1774,7 +1785,7 @@ func (r *FvESgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanR var newAttributeValues []FvRsProvFvESgResourceModelV1 if stateData != nil { - stateData.FvRsProv.ElementsAs(ctx, &newAttributeValues, false) + stateData.DeprecatedFvRsProv.ElementsAs(ctx, &newAttributeValues, false) } if len(attributeValues) > 0 { for _, attributeValue := range attributeValues { @@ -1926,6 +1937,7 @@ func (r *FvESgResource) Schema(ctx context.Context, req resource.SchemaRequest, DeprecationMessage: "Attribute `relation_fv_rs_cust_qos_pol` is deprecated. The attribute will be removed in the next major version of the provider.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, }, "relation_fv_rs_prot_by": schema.SetAttribute{ diff --git a/internal/provider/resource_aci_endpoint_security_group_test.go b/internal/provider/resource_aci_endpoint_security_group_test.go index de5dd66bf..c6b1eb23b 100644 --- a/internal/provider/resource_aci_endpoint_security_group_test.go +++ b/internal/provider/resource_aci_endpoint_security_group_test.go @@ -218,7 +218,7 @@ func TestAccResourceFvESgWithFvAp(t *testing.T) { resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_provided_contracts.1.match_criteria", "AtleastOne"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_provided_contracts.1.priority", "level2"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.annotation", "annotation_1"), - resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "default"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.1.key", "key_1"), @@ -391,7 +391,7 @@ func TestAccResourceFvESgWithFvAp(t *testing.T) { resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.1.key", "key_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.#", "2"), - resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "default"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.1.key", "key_1"), @@ -464,7 +464,7 @@ func TestAccResourceFvESgWithFvAp(t *testing.T) { resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.#", "1"), - resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "default"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.key", "key_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.#", "1"), @@ -485,7 +485,7 @@ func TestAccResourceFvESgWithFvAp(t *testing.T) { resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.annotation", "annotation_1"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.annotations.#", "0"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.tags.#", "0"), - resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "vrf_name_1"), + resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "relation_to_vrf.vrf_name", "default"), resource.TestCheckResourceAttr("aci_endpoint_security_group.test", "tags.#", "0"), ), }, @@ -606,7 +606,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name priority = "level1" }, { @@ -631,7 +631,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name priority = "level2" }, ] @@ -708,7 +708,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_0" + imported_contract_name = aci_imported_contract.test_imported_contract_0.name priority = "level1" }, { @@ -733,7 +733,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_1" + imported_contract_name = aci_imported_contract.test_imported_contract_1.name priority = "level2" }, ] @@ -760,7 +760,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name }, { annotation = "annotation_2" @@ -784,7 +784,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name }, ] relation_to_provided_contracts = [ @@ -810,7 +810,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_0" + contract_name = aci_contract.test_contract_0.name match_criteria = "All" priority = "level1" }, @@ -836,7 +836,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name match_criteria = "AtleastOne" priority = "level2" }, @@ -863,7 +863,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - vrf_name = "vrf_name_1" + vrf_name = "default" } tags = [ { @@ -910,7 +910,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name priority = "level2" }, ] @@ -947,7 +947,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - imported_contract_name = "imported_contract_name_1" + imported_contract_name = aci_imported_contract.test_imported_contract_1.name priority = "level2" }, ] @@ -966,7 +966,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name }, ] relation_to_provided_contracts = [ @@ -984,7 +984,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - contract_name = "contract_name_1" + contract_name = aci_contract.test_contract_1.name match_criteria = "AtleastOne" priority = "level2" }, @@ -1003,7 +1003,7 @@ resource "aci_endpoint_security_group" "test" { value = "test_value" }, ] - vrf_name = "vrf_name_1" + vrf_name = "default" } tags = [ { @@ -1028,7 +1028,7 @@ resource "aci_endpoint_security_group" "test" { annotation = "annotation_1" annotations = [] tags = [] - vrf_name = "vrf_name_1" + vrf_name = "default" } tags = [] }