diff --git a/gen/templates/resource_test.go.tmpl b/gen/templates/resource_test.go.tmpl index 6835ed1ba..5b482cb2e 100644 --- a/gen/templates/resource_test.go.tmpl +++ b/gen/templates/resource_test.go.tmpl @@ -2052,16 +2052,36 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{if $.custom_type}} -const testConfig{{$.resourceClassName}}CustomTypeDependencyWith{{capitalize .class_name}} = {{- if $dependencies }} testDependencyConfig{{$.resourceClassName}} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` +const testConfig{{$.resourceClassName}}CustomTypeDependencyWith{{capitalize .class_name}} = {{- if $dependencies }} testDependencyConfig{{$.resourceClassName}} + {{- end }}{{- if $childDependencies }} testChildDependencyConfig{{$.resourceClassName}} + {{- end }} {{if .class_name}}testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + {{- end}} ` resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}" { parent_dn = {{.parent_dn}} - {{- range $key, $value := $.custom_type}} - {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} + {{- range $key, $value := $.custom_type}} + {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0 false}} {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} - {{- else }} + {{- else }} {{$key}} = "{{$value}}" - {{- end }} - {{- end}} + {{- end }} + {{- end}} +} +` + {{- end}} + {{- if $.legacy_attributes }} +const testConfig{{$.resourceClassName}}LegacyAttributesWith{{capitalize .class_name}} = {{- if $dependencies }} testDependencyConfig{{$.resourceClassName}} + {{- end }}{{- if $childDependencies }} testChildDependencyConfig{{$.resourceClassName}} + {{- end }} {{if .class_name}}testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + {{- end}} ` +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}" { + {{- range $key, $value := $.legacy_attributes}} + {{- if isInterfaceSlice $value}}{{$list_value := index $value 0}} + {{$key}} = {{if isReference $list_value}}{{$value}}{{else}}["{{$list_value}}"]{{end}} + {{- else}} + {{$key}} = {{if isReference $value}}{{$value}}{{else}}"{{$value}}"{{end}} + {{- end}} + {{- end}} + {{- range $key, $value := $.legacy_blocks}} + {{$key}} { + {{- range $block_key, $block_value := $value}} + {{$block_key}} = {{if isReference $block_value}}{{$block_value}}{{else}}"{{$block_value}}"{{end}} + {{- end}} + } + {{- end}} } ` {{- end}} diff --git a/gen/templates/testvars.yaml.tmpl b/gen/templates/testvars.yaml.tmpl index 8bc57793f..7154ac6c4 100644 --- a/gen/templates/testvars.yaml.tmpl +++ b/gen/templates/testvars.yaml.tmpl @@ -9,7 +9,7 @@ legacy_attributes: {{- if eq (getMigrationType .ValueType) "String"}} {{.AttributeName}}: "{{getLegacyPropertyTestValue .Name $}}" {{- else if eq (getMigrationType .ValueType) "Set"}} - {{.AttributeName}}: "{{getLegacyPropertyTestValue .Name $}}" + {{.AttributeName}}: ["{{getLegacyPropertyTestValue .Name $}}"] {{- end}} {{- end}} {{- end }} @@ -23,7 +23,7 @@ legacy_blocks: {{- if eq (getMigrationType .ValueType) "String"}} {{.AttributeName}}: "{{getLegacyBlockTestValue $ClassName .Name $}}" {{- else if eq (getMigrationType .ValueType) "Set"}} - {{.AttributeName}}: "{{getLegacyBlockTestValue $ClassName .Name $}}" + {{.AttributeName}}: ["{{getLegacyBlockTestValue $ClassName .Name $}}"] {{- end}} {{- end}} {{- end }} diff --git a/gen/testvars/fvAEPg.yaml b/gen/testvars/fvAEPg.yaml index a056b8130..73a108de3 100644 --- a/gen/testvars/fvAEPg.yaml +++ b/gen/testvars/fvAEPg.yaml @@ -15,15 +15,15 @@ legacy_attributes: shutdown: "no" relation_fv_rs_aepg_mon_pol: "aci_monitoring_policy.test_monitoring_policy_0.id" relation_fv_rs_bd: "aci_bridge_domain.test_bridge_domain_1.id" - relation_fv_rs_cons: "aci_contract.test_contract_1.id" - relation_fv_rs_sec_inherited: "aci_application_epg.test_application_epg_0.id" + relation_fv_rs_cons: ["aci_contract.test_contract_1.id"] + relation_fv_rs_sec_inherited: ["aci_application_epg.test_application_epg_0.id"] relation_fv_rs_cust_qos_pol: "aci_custom_qos_policy.test_custom_qos_policy_0.id" relation_fv_rs_dpp_pol: "aci_data_plane_policing_policy.test_data_plane_policing_policy_1.id" - relation_fv_rs_fc_path_att: "topology/pod-1/paths-101/pathep-[eth1/1]" - relation_fv_rs_cons_if: "aci_imported_contract.test_imported_contract_1.id" - relation_fv_rs_intra_epg: "aci_contract.test_contract_1.id" - relation_fv_rs_prov: "aci_contract.test_contract_1.id" - relation_fv_rs_prot_by: "aci_taboo_contract.test_taboo_contract_1.id" + relation_fv_rs_fc_path_att: ["topology/pod-1/paths-101/pathep-[eth1/1]"] + relation_fv_rs_cons_if: ["aci_imported_contract.test_imported_contract_1.id"] + relation_fv_rs_intra_epg: ["aci_contract.test_contract_1.id"] + relation_fv_rs_prov: ["aci_contract.test_contract_1.id"] + relation_fv_rs_prot_by: ["aci_taboo_contract.test_taboo_contract_1.id"] relation_fv_rs_trust_ctrl: "aci_trust_control_policy.test_trust_control_policy_0.id" legacy_blocks: relation_fv_rs_node_att: diff --git a/gen/testvars/fvBD.yaml b/gen/testvars/fvBD.yaml index fd050ec48..ea0726062 100644 --- a/gen/testvars/fvBD.yaml +++ b/gen/testvars/fvBD.yaml @@ -22,7 +22,7 @@ legacy_attributes: relation_fv_rs_bd_to_ep_ret: "aci_end_point_retention_policy.test_end_point_retention_policy_1.id" relation_fv_rs_bd_to_fhs: "aci_first_hop_security_policy.test_first_hop_security_policy_1.id" relation_fv_rs_igmpsn: "aci_igmp_snooping_policy.test_igmp_snooping_policy_0.id" - relation_fv_rs_bd_to_out: "aci_l3_outside.test_l3_outside_1.id" + relation_fv_rs_bd_to_out: ["aci_l3_outside.test_l3_outside_1.id"] relation_fv_rs_mldsn: "aci_mld_snooping_policy.test_mld_snooping_policy_1.id" relation_fv_rs_abd_pol_mon_pol: "aci_monitoring_policy.test_monitoring_policy_0.id" relation_fv_rs_bd_to_nd_p: "aci_neighbor_discovery_interface_policy.test_neighbor_discovery_interface_policy_0.id" diff --git a/gen/testvars/fvESg.yaml b/gen/testvars/fvESg.yaml index 7bd0734bb..5ab2487f5 100644 --- a/gen/testvars/fvESg.yaml +++ b/gen/testvars/fvESg.yaml @@ -6,8 +6,8 @@ legacy_attributes: application_profile_dn: "aci_application_profile.test.id" pc_enf_pref: "enforced" pref_gr_memb: "exclude" - relation_fv_rs_sec_inherited: "aci_endpoint_security_group.test_endpoint_security_group_0.id" - relation_fv_rs_intra_epg: "aci_contract.test_contract_1.id" + relation_fv_rs_sec_inherited: ["aci_endpoint_security_group.test_endpoint_security_group_0.id"] + relation_fv_rs_intra_epg: ["aci_contract.test_contract_1.id"] relation_fv_rs_scope: "aci_vrf.test_vrf_0.id" legacy_blocks: relation_fv_rs_cons: diff --git a/internal/provider/resource_aci_application_epg_test.go b/internal/provider/resource_aci_application_epg_test.go index 30dccecf5..bc46469a9 100644 --- a/internal/provider/resource_aci_application_epg_test.go +++ b/internal/provider/resource_aci_application_epg_test.go @@ -2302,10 +2302,44 @@ resource "aci_application_epg" "test" { } ` -const testConfigFvAEPgCustomTypeDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` +const testConfigFvAEPgCustomTypeDependencyWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` resource "aci_application_epg" "test" { parent_dn = aci_application_profile.test.id name = "test_name" priority = "1" } ` +const testConfigFvAEPgLegacyAttributesWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + application_profile_dn = aci_application_profile.test.id + exception_tag = "test_exception_tag" + flood_on_encap = "disabled" + fwd_ctrl = "none" + has_mcast_source = "no" + is_attr_based_epg = "no" + match_t = "All" + pc_enf_pref = "enforced" + pref_gr_memb = "exclude" + prio = "level1" + relation_fv_rs_aepg_mon_pol = aci_monitoring_policy.test_monitoring_policy_0.id + relation_fv_rs_bd = aci_bridge_domain.test_bridge_domain_1.id + relation_fv_rs_cons = [aci_contract.test_contract_1.id] + relation_fv_rs_cons_if = [aci_imported_contract.test_imported_contract_1.id] + relation_fv_rs_cust_qos_pol = aci_custom_qos_policy.test_custom_qos_policy_0.id + relation_fv_rs_dpp_pol = aci_data_plane_policing_policy.test_data_plane_policing_policy_1.id + relation_fv_rs_fc_path_att = ["topology/pod-1/paths-101/pathep-[eth1/1]"] + relation_fv_rs_intra_epg = [aci_contract.test_contract_1.id] + relation_fv_rs_prot_by = [aci_taboo_contract.test_taboo_contract_1.id] + relation_fv_rs_prov = [aci_contract.test_contract_1.id] + relation_fv_rs_sec_inherited = [aci_application_epg.test_application_epg_0.id] + relation_fv_rs_trust_ctrl = aci_trust_control_policy.test_trust_control_policy_0.id + shutdown = "no" + relation_fv_rs_node_att { + deployment_immediacy = "immediate" + description = "description_1" + encap = "encapsulation_1" + mode = "native" + node_dn = "topology/pod-1/node-101" + } +} +` diff --git a/internal/provider/resource_aci_bridge_domain_test.go b/internal/provider/resource_aci_bridge_domain_test.go index 3a04f4185..d32a32a7e 100644 --- a/internal/provider/resource_aci_bridge_domain_test.go +++ b/internal/provider/resource_aci_bridge_domain_test.go @@ -1721,3 +1721,38 @@ resource "aci_bridge_domain" "test" { tags = [] } ` + +const testConfigFvBDLegacyAttributesWithFvTenant = testChildDependencyConfigFvBD + testConfigFvTenantMin + ` +resource "aci_bridge_domain" "test" { + arp_flood = "no" + ep_clear = "no" + ep_move_detect_mode = "garp" + host_based_routing = "no" + intersite_bum_traffic_allow = "no" + ipv6_mcast_allow = "no" + ll_addr = "test_ll_addr" + mac = "test_mac" + mcast_allow = "no" + multi_dst_pkt_act = "bd-flood" + relation_fv_rs_abd_pol_mon_pol = aci_monitoring_policy.test_monitoring_policy_0.id + relation_fv_rs_bd_to_ep_ret = aci_end_point_retention_policy.test_end_point_retention_policy_1.id + relation_fv_rs_bd_to_fhs = aci_first_hop_security_policy.test_first_hop_security_policy_1.id + relation_fv_rs_bd_to_nd_p = aci_neighbor_discovery_interface_policy.test_neighbor_discovery_interface_policy_0.id + relation_fv_rs_bd_to_out = [aci_l3_outside.test_l3_outside_1.id] + relation_fv_rs_bd_to_profile = aci_route_control_profile.test_route_control_profile_1.id + relation_fv_rs_bd_to_relay_p = aci_dhcp_relay_policy.test_dhcp_relay_policy_0.id + relation_fv_rs_ctx = aci_vrf.test_vrf_0.id + relation_fv_rs_igmpsn = aci_igmp_snooping_policy.test_igmp_snooping_policy_0.id + relation_fv_rs_mldsn = aci_mld_snooping_policy.test_mld_snooping_policy_1.id + tenant_dn = aci_tenant.test.id + unicast_route = "no" + unk_mac_ucast_act = "flood" + unk_mcast_act = "flood" + v6unk_mcast_act = "flood" + vmac = "test_vmac" + relation_fv_rs_bd_to_netflow_monitor_pol { + flt_type = "ce" + tn_netflow_monitor_pol_name = aci_netflow_monitor_policy.test_netflow_monitor_policy_1.id + } +} +` diff --git a/internal/provider/resource_aci_endpoint_security_group_test.go b/internal/provider/resource_aci_endpoint_security_group_test.go index fc50c9074..ff7de1925 100644 --- a/internal/provider/resource_aci_endpoint_security_group_test.go +++ b/internal/provider/resource_aci_endpoint_security_group_test.go @@ -1052,3 +1052,28 @@ resource "aci_endpoint_security_group" "test" { tags = [] } ` + +const testConfigFvESgLegacyAttributesWithFvAp = testChildDependencyConfigFvESg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_endpoint_security_group" "test" { + application_profile_dn = aci_application_profile.test.id + match_t = "All" + pc_enf_pref = "enforced" + pref_gr_memb = "exclude" + relation_fv_rs_intra_epg = [aci_contract.test_contract_1.id] + relation_fv_rs_scope = aci_vrf.test_vrf_0.id + relation_fv_rs_sec_inherited = [aci_endpoint_security_group.test_endpoint_security_group_0.id] + relation_fv_rs_cons { + prio = "level1" + target_dn = aci_contract.test_contract_0.id + } + relation_fv_rs_cons_if { + prio = "level1" + target_dn = aci_imported_contract.test_imported_contract_0.id + } + relation_fv_rs_prov { + match_t = "All" + prio = "level1" + target_dn = aci_contract.test_contract_0.id + } +} +` diff --git a/internal/provider/resource_aci_netflow_exporter_policy_test.go b/internal/provider/resource_aci_netflow_exporter_policy_test.go index 76b273ad8..db14fbd6e 100644 --- a/internal/provider/resource_aci_netflow_exporter_policy_test.go +++ b/internal/provider/resource_aci_netflow_exporter_policy_test.go @@ -546,7 +546,7 @@ resource "aci_netflow_exporter_policy" "test" { } ` -const testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant = testConfigFvTenantMin + ` +const testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant = testChildDependencyConfigNetflowExporterPol + testConfigFvTenantMin + ` resource "aci_netflow_exporter_policy" "test" { parent_dn = aci_tenant.test.id destination_ip_address = "2.2.2.1"