Skip to content

Commit

Permalink
[ignore] add test configuration for legacy attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
akinross committed Jan 31, 2025
1 parent 9d2014e commit 5ea56e6
Show file tree
Hide file tree
Showing 9 changed files with 134 additions and 20 deletions.
32 changes: 26 additions & 6 deletions gen/templates/resource_test.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
4 changes: 2 additions & 2 deletions gen/templates/testvars.yaml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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 }}
Expand Down
14 changes: 7 additions & 7 deletions gen/testvars/fvAEPg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gen/testvars/fvBD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions gen/testvars/fvESg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 35 additions & 1 deletion internal/provider/resource_aci_application_epg_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 35 additions & 0 deletions internal/provider/resource_aci_bridge_domain_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions internal/provider/resource_aci_endpoint_security_group_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5ea56e6

Please sign in to comment.