diff --git a/gen/templates/resource_test.go.tmpl b/gen/templates/resource_test.go.tmpl index e8b2766d7..ef074b700 100644 --- a/gen/templates/resource_test.go.tmpl +++ b/gen/templates/resource_test.go.tmpl @@ -407,6 +407,22 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes ), }, {{- end}} + {{- if $.customtype}} + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfig{{$.resourceClassName}}CustomTypeDependencyWith{{capitalize .class_name}}, + ExpectNonEmptyPlan: {{.class_in_parent}}, + Check: resource.ComposeAggregateTestCheckFunc( + {{- range $key, $value := $.customtype}} + {{- if eq $key "target_dn" }} + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}", "{{$key}}", "{{getTestTargetDn $.targets $.resourceName $value false $target_classes 0}}"), + {{- else }} + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}", "{{$key}}", "{{$value}}"), + {{- end }} + {{- end}} + ), + }, + {{- end}} }, }) } {{- end}} @@ -800,6 +816,21 @@ func TestAccResource{{.resourceClassName}}(t *testing.T) { ), }, {{- end}} + {{- if $.customtype}} + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfig{{$.resourceClassName}}CustomType, + Check: resource.ComposeAggregateTestCheckFunc( + {{- range $key, $value := $.customtype}} + {{- if eq $key "target_dn" }} + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{getTestTargetDn $.targets $.resourceName $value false nil 0}}"), + {{- else }} + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + {{- end }} + {{- end}} + ), + }, + {{- end}} }, }) } @@ -1031,6 +1062,21 @@ resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClas {{- end}} {{- end}} } +` + {{- end}} + + {{if $.customtype}} +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}} + ` +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}_1{{- end }}" { + parent_dn = {{.parent_dn}} + {{- range $key, $value := $.customtype}} + {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true $target_classes 0}} + {{$key}} = {{if containsString $attributeValue "."}}{{$attributeValue}}{{else}}"{{$attributeValue}}"{{end}} + {{- else }} + {{$key}} = "{{$value}}" + {{- end }} + {{- end}} +} ` {{- end}} {{- end}} @@ -1193,6 +1239,15 @@ resource "aci_{{$.resourceName}}" "test" { {{- end}} } ` + {{- end}} + {{if $.customtype}} +const testConfig{{.resourceClassName}}CustomType = ` +resource "aci_{{$.resourceName}}" "test" { + {{- range $key, $value := $.customtype}} + {{$key}} = "{{$value}}" + {{- end}} +} +` {{- end}} {{- end}} \ No newline at end of file diff --git a/gen/templates/testvars.yaml.tmpl b/gen/templates/testvars.yaml.tmpl index 1b4eb8cf8..67244dfbf 100644 --- a/gen/templates/testvars.yaml.tmpl +++ b/gen/templates/testvars.yaml.tmpl @@ -51,6 +51,17 @@ resource_required: {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}: "{{overwritePropertyValue .PkgName $overwritePropertyName $testValue "resource_required" 0 $.Definitions}}" {{- end}} {{- end}} + {{- if .HasCustomTypeProperties}} + +customtype: + {{- range .Properties}}{{$testValue := createTestValue .SnakeCaseName}}{{$overwritePropertyName := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} + {{- if .HasCustomType}} + {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}: {{$validValuesMap := .ValidValuesMap}}{{range $key, $value := $validValuesMap}}{{if or (ne $value "unspecified") (eq (len $validValuesMap) 1)}}"{{$key}}"{{break}}{{end}}{{end}} + {{- else if or .IsNaming (or .IsRequired (isRequiredInTestValue .PkgName $overwritePropertyName $.Definitions "resource_required"))}} + {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}}: "{{overwritePropertyValue .PkgName $overwritePropertyName $testValue "resource_required" 0 $.Definitions}}" + {{- end}} + {{- end}} + {{- end}} {{- end }} {{- if .HasReadOnlyProperties}} diff --git a/gen/testvars/fvAEPg.yaml b/gen/testvars/fvAEPg.yaml index 171936156..0dfc712bc 100644 --- a/gen/testvars/fvAEPg.yaml +++ b/gen/testvars/fvAEPg.yaml @@ -26,6 +26,10 @@ datasource_required: resource_required: name: "test_name" +customtype: + name: "test_name" + priority: "1" + read_only: - "pc_tag" diff --git a/gen/testvars/fvRsCons.yaml b/gen/testvars/fvRsCons.yaml index a96cb3cb9..cccad5df5 100644 --- a/gen/testvars/fvRsCons.yaml +++ b/gen/testvars/fvRsCons.yaml @@ -15,6 +15,10 @@ datasource_required: resource_required: contract_name: "test_tn_vz_br_cp_name" +customtype: + priority: "1" + contract_name: "test_tn_vz_br_cp_name" + all: annotation: "annotation" priority: "level1" diff --git a/gen/testvars/fvRsConsIf.yaml b/gen/testvars/fvRsConsIf.yaml index ea9e6798d..063f97b69 100644 --- a/gen/testvars/fvRsConsIf.yaml +++ b/gen/testvars/fvRsConsIf.yaml @@ -15,6 +15,10 @@ datasource_required: resource_required: imported_contract_name: "test_tn_vz_cp_if_name" +customtype: + priority: "1" + imported_contract_name: "test_tn_vz_cp_if_name" + all: annotation: "annotation" priority: "level1" diff --git a/gen/testvars/fvRsProv.yaml b/gen/testvars/fvRsProv.yaml index ca0aaba9c..110469e90 100644 --- a/gen/testvars/fvRsProv.yaml +++ b/gen/testvars/fvRsProv.yaml @@ -16,6 +16,10 @@ datasource_required: resource_required: contract_name: "test_tn_vz_br_cp_name" +customtype: + priority: "1" + contract_name: "test_tn_vz_br_cp_name" + all: annotation: "annotation" match_criteria: "All" diff --git a/gen/testvars/mgmtInstP.yaml b/gen/testvars/mgmtInstP.yaml index 196612eb2..84f3ad378 100644 --- a/gen/testvars/mgmtInstP.yaml +++ b/gen/testvars/mgmtInstP.yaml @@ -17,6 +17,10 @@ datasource_required: resource_required: name: "test_name" +customtype: + name: "test_name" + priority: "1" + all: annotation: "annotation" description: "description_1" diff --git a/gen/testvars/mgmtRsOoBCons.yaml b/gen/testvars/mgmtRsOoBCons.yaml index a9bf36e80..5b44d18b2 100644 --- a/gen/testvars/mgmtRsOoBCons.yaml +++ b/gen/testvars/mgmtRsOoBCons.yaml @@ -15,6 +15,10 @@ datasource_required: resource_required: out_of_band_contract_name: "test_tn_vz_oob_br_cp_name" +customtype: + priority: "1" + out_of_band_contract_name: "test_tn_vz_oob_br_cp_name" + all: annotation: "annotation" priority: "level1" diff --git a/gen/testvars/netflowExporterPol.yaml b/gen/testvars/netflowExporterPol.yaml index afe802cfd..ed4f6fb22 100644 --- a/gen/testvars/netflowExporterPol.yaml +++ b/gen/testvars/netflowExporterPol.yaml @@ -27,6 +27,13 @@ resource_required: name: "netfow_exporter" source_ip_address: "1.1.1.1/10" +customtype: + qos_dscp_value: "0" + destination_ip_address: "2.2.2.1" + destination_port: "110" + name: "netfow_exporter" + source_ip_address: "1.1.1.1/10" + all: annotation: "annotation" description: "description_1" diff --git a/gen/testvars/qosDppPol.yaml b/gen/testvars/qosDppPol.yaml index 0b86bca5d..640e05be5 100644 --- a/gen/testvars/qosDppPol.yaml +++ b/gen/testvars/qosDppPol.yaml @@ -39,6 +39,17 @@ datasource_required: resource_required: name: "test_name" +customtype: + excessive_burst: "0xffffffffffffffff" + burst: "0xffffffffffffffff" + conform_mark_cos: "0xffff" + conform_mark_dscp: "0xffff" + exceed_mark_cos: "0xffff" + exceed_mark_dscp: "0xffff" + name: "test_name" + violate_mark_cos: "0xffff" + violate_mark_dscp: "0xffff" + all: admin_state: "disabled" annotation: "annotation" diff --git a/gen/testvars/vzOOBBrCP.yaml b/gen/testvars/vzOOBBrCP.yaml index b40fa57d9..c044e1ab3 100644 --- a/gen/testvars/vzOOBBrCP.yaml +++ b/gen/testvars/vzOOBBrCP.yaml @@ -22,6 +22,11 @@ datasource_required: resource_required: name: "test_name" +customtype: + name: "test_name" + priority: "1" + target_dscp: "0" + all: annotation: "annotation" description: "description_1" diff --git a/internal/provider/resource_aci_application_epg_test.go b/internal/provider/resource_aci_application_epg_test.go index 5c253f7ba..76fcd67c9 100644 --- a/internal/provider/resource_aci_application_epg_test.go +++ b/internal/provider/resource_aci_application_epg_test.go @@ -656,6 +656,15 @@ func TestAccResourceFvAEPgWithFvAp(t *testing.T) { resource.TestCheckResourceAttr("aci_application_epg.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvAEPgCustomTypeDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "1"), + ), + }, }, }) } @@ -1122,3 +1131,11 @@ resource "aci_application_epg" "test" { tags = [] } ` + +const testConfigFvAEPgCustomTypeDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + priority = "1" +} +` diff --git a/internal/provider/resource_aci_data_plane_policing_policy_test.go b/internal/provider/resource_aci_data_plane_policing_policy_test.go index a342f3906..86b187602 100644 --- a/internal/provider/resource_aci_data_plane_policing_policy_test.go +++ b/internal/provider/resource_aci_data_plane_policing_policy_test.go @@ -370,6 +370,22 @@ func TestAccResourceQosDppPolWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigQosDppPolCustomTypeDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "0xffffffffffffffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "0xffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "0xffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "0xffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "0xffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "excessive_burst", "0xffffffffffffffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "0xffff"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "0xffff"), + ), + }, }, }) } @@ -519,3 +535,18 @@ resource "aci_data_plane_policing_policy" "test" { tags = [] } ` + +const testConfigQosDppPolCustomTypeDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + burst = "0xffffffffffffffff" + conform_mark_cos = "0xffff" + conform_mark_dscp = "0xffff" + exceed_mark_cos = "0xffff" + exceed_mark_dscp = "0xffff" + excessive_burst = "0xffffffffffffffff" + name = "test_name" + violate_mark_cos = "0xffff" + violate_mark_dscp = "0xffff" +} +` diff --git a/internal/provider/resource_aci_external_management_network_instance_profile_test.go b/internal/provider/resource_aci_external_management_network_instance_profile_test.go index b228274bf..fd7083718 100644 --- a/internal/provider/resource_aci_external_management_network_instance_profile_test.go +++ b/internal/provider/resource_aci_external_management_network_instance_profile_test.go @@ -214,6 +214,14 @@ func TestAccResourceMgmtInstP(t *testing.T) { resource.TestCheckResourceAttr("aci_external_management_network_instance_profile.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigMgmtInstPCustomType, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_external_management_network_instance_profile.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_external_management_network_instance_profile.test", "priority", "1"), + ), + }, }, }) } @@ -330,3 +338,10 @@ resource "aci_external_management_network_instance_profile" "test" { tags = [] } ` + +const testConfigMgmtInstPCustomType = ` +resource "aci_external_management_network_instance_profile" "test" { + name = "test_name" + priority = "1" +} +` diff --git a/internal/provider/resource_aci_netflow_exporter_policy_test.go b/internal/provider/resource_aci_netflow_exporter_policy_test.go index 9453a1985..d2527be26 100644 --- a/internal/provider/resource_aci_netflow_exporter_policy_test.go +++ b/internal/provider/resource_aci_netflow_exporter_policy_test.go @@ -267,6 +267,18 @@ func TestAccResourceNetflowExporterPolWithFvTenant(t *testing.T) { resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_ip_address", "2.2.2.1"), + resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "destination_port", "110"), + resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "name", "netfow_exporter"), + resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "qos_dscp_value", "0"), + resource.TestCheckResourceAttr("aci_netflow_exporter_policy.test", "source_ip_address", "1.1.1.1/10"), + ), + }, }, }) } @@ -426,3 +438,14 @@ resource "aci_netflow_exporter_policy" "test" { tags = [] } ` + +const testConfigNetflowExporterPolCustomTypeDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_netflow_exporter_policy" "test" { + parent_dn = aci_tenant.test.id + destination_ip_address = "2.2.2.1" + destination_port = "110" + name = "netfow_exporter" + qos_dscp_value = "0" + source_ip_address = "1.1.1.1/10" +} +` diff --git a/internal/provider/resource_aci_out_of_band_contract_test.go b/internal/provider/resource_aci_out_of_band_contract_test.go index d7c9a6511..b2c5b414f 100644 --- a/internal/provider/resource_aci_out_of_band_contract_test.go +++ b/internal/provider/resource_aci_out_of_band_contract_test.go @@ -255,6 +255,15 @@ func TestAccResourceVzOOBBrCP(t *testing.T) { resource.TestCheckResourceAttr("aci_out_of_band_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigVzOOBBrCPCustomType, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_out_of_band_contract.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_out_of_band_contract.test", "priority", "1"), + resource.TestCheckResourceAttr("aci_out_of_band_contract.test", "target_dscp", "0"), + ), + }, }, }) } @@ -361,3 +370,11 @@ resource "aci_out_of_band_contract" "test" { tags = [] } ` + +const testConfigVzOOBBrCPCustomType = ` +resource "aci_out_of_band_contract" "test" { + name = "test_name" + priority = "1" + target_dscp = "0" +} +` diff --git a/internal/provider/resource_aci_relation_to_consumed_contract_test.go b/internal/provider/resource_aci_relation_to_consumed_contract_test.go index 1428ce088..c269b83ce 100644 --- a/internal/provider/resource_aci_relation_to_consumed_contract_test.go +++ b/internal/provider/resource_aci_relation_to_consumed_contract_test.go @@ -178,6 +178,15 @@ func TestAccResourceFvRsConsWithFvAEPg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsConsCustomTypeDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "contract_name", "test_tn_vz_br_cp_name"), + resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "priority", "1"), + ), + }, }, }) } @@ -348,6 +357,15 @@ func TestAccResourceFvRsConsWithFvESg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsConsCustomTypeDependencyWithFvESg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "contract_name", "test_tn_vz_br_cp_name"), + resource.TestCheckResourceAttr("aci_relation_to_consumed_contract.test", "priority", "1"), + ), + }, }, }) } @@ -450,6 +468,14 @@ resource "aci_relation_to_consumed_contract" "test" { } ` +const testConfigFvRsConsCustomTypeDependencyWithFvAEPg = testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_consumed_contract" "test" { + parent_dn = aci_application_epg.test.id + contract_name = "test_tn_vz_br_cp_name" + priority = "1" +} +` + const testConfigFvRsConsMinDependencyWithFvESgAllowExisting = testConfigFvESgMinDependencyWithFvAp + ` resource "aci_relation_to_consumed_contract" "allow_test" { parent_dn = aci_endpoint_security_group.test.id @@ -547,3 +573,11 @@ resource "aci_relation_to_consumed_contract" "test" { tags = [] } ` + +const testConfigFvRsConsCustomTypeDependencyWithFvESg = testConfigFvESgMinDependencyWithFvAp + ` +resource "aci_relation_to_consumed_contract" "test" { + parent_dn = aci_endpoint_security_group.test.id + contract_name = "test_tn_vz_br_cp_name" + priority = "1" +} +` diff --git a/internal/provider/resource_aci_relation_to_consumed_out_of_band_contract_test.go b/internal/provider/resource_aci_relation_to_consumed_out_of_band_contract_test.go index 6d4178b3b..4d9669a63 100644 --- a/internal/provider/resource_aci_relation_to_consumed_out_of_band_contract_test.go +++ b/internal/provider/resource_aci_relation_to_consumed_out_of_band_contract_test.go @@ -178,6 +178,15 @@ func TestAccResourceMgmtRsOoBConsWithMgmtInstP(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_consumed_out_of_band_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigMgmtRsOoBConsCustomTypeDependencyWithMgmtInstP, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_consumed_out_of_band_contract.test", "out_of_band_contract_name", "test_tn_vz_oob_br_cp_name"), + resource.TestCheckResourceAttr("aci_relation_to_consumed_out_of_band_contract.test", "priority", "1"), + ), + }, }, }) } @@ -279,3 +288,11 @@ resource "aci_relation_to_consumed_out_of_band_contract" "test" { tags = [] } ` + +const testConfigMgmtRsOoBConsCustomTypeDependencyWithMgmtInstP = testConfigMgmtInstPMin + ` +resource "aci_relation_to_consumed_out_of_band_contract" "test" { + parent_dn = aci_external_management_network_instance_profile.test.id + out_of_band_contract_name = "test_tn_vz_oob_br_cp_name" + priority = "1" +} +` diff --git a/internal/provider/resource_aci_relation_to_imported_contract_test.go b/internal/provider/resource_aci_relation_to_imported_contract_test.go index 87923dea6..ffd5f6ea4 100644 --- a/internal/provider/resource_aci_relation_to_imported_contract_test.go +++ b/internal/provider/resource_aci_relation_to_imported_contract_test.go @@ -178,6 +178,15 @@ func TestAccResourceFvRsConsIfWithFvAEPg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsConsIfCustomTypeDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "imported_contract_name", "test_tn_vz_cp_if_name"), + resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "priority", "1"), + ), + }, }, }) } @@ -348,6 +357,15 @@ func TestAccResourceFvRsConsIfWithFvESg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsConsIfCustomTypeDependencyWithFvESg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "imported_contract_name", "test_tn_vz_cp_if_name"), + resource.TestCheckResourceAttr("aci_relation_to_imported_contract.test", "priority", "1"), + ), + }, }, }) } @@ -450,6 +468,14 @@ resource "aci_relation_to_imported_contract" "test" { } ` +const testConfigFvRsConsIfCustomTypeDependencyWithFvAEPg = testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_imported_contract" "test" { + parent_dn = aci_application_epg.test.id + imported_contract_name = "test_tn_vz_cp_if_name" + priority = "1" +} +` + const testConfigFvRsConsIfMinDependencyWithFvESgAllowExisting = testConfigFvESgMinDependencyWithFvAp + ` resource "aci_relation_to_imported_contract" "allow_test" { parent_dn = aci_endpoint_security_group.test.id @@ -547,3 +573,11 @@ resource "aci_relation_to_imported_contract" "test" { tags = [] } ` + +const testConfigFvRsConsIfCustomTypeDependencyWithFvESg = testConfigFvESgMinDependencyWithFvAp + ` +resource "aci_relation_to_imported_contract" "test" { + parent_dn = aci_endpoint_security_group.test.id + imported_contract_name = "test_tn_vz_cp_if_name" + priority = "1" +} +` diff --git a/internal/provider/resource_aci_relation_to_provided_contract_test.go b/internal/provider/resource_aci_relation_to_provided_contract_test.go index 1cb02862f..0d40a9a30 100644 --- a/internal/provider/resource_aci_relation_to_provided_contract_test.go +++ b/internal/provider/resource_aci_relation_to_provided_contract_test.go @@ -186,6 +186,15 @@ func TestAccResourceFvRsProvWithFvAEPg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsProvCustomTypeDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "contract_name", "test_tn_vz_br_cp_name"), + resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "priority", "1"), + ), + }, }, }) } @@ -364,6 +373,15 @@ func TestAccResourceFvRsProvWithFvESg(t *testing.T) { resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "tags.#", "0"), ), }, + // Update with minimum config and customtype semantic equivalent values + { + Config: testConfigFvRsProvCustomTypeDependencyWithFvESg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "contract_name", "test_tn_vz_br_cp_name"), + resource.TestCheckResourceAttr("aci_relation_to_provided_contract.test", "priority", "1"), + ), + }, }, }) } @@ -468,6 +486,14 @@ resource "aci_relation_to_provided_contract" "test" { } ` +const testConfigFvRsProvCustomTypeDependencyWithFvAEPg = testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_provided_contract" "test" { + parent_dn = aci_application_epg.test.id + contract_name = "test_tn_vz_br_cp_name" + priority = "1" +} +` + const testConfigFvRsProvMinDependencyWithFvESgAllowExisting = testConfigFvESgMinDependencyWithFvAp + ` resource "aci_relation_to_provided_contract" "allow_test" { parent_dn = aci_endpoint_security_group.test.id @@ -567,3 +593,11 @@ resource "aci_relation_to_provided_contract" "test" { tags = [] } ` + +const testConfigFvRsProvCustomTypeDependencyWithFvESg = testConfigFvESgMinDependencyWithFvAp + ` +resource "aci_relation_to_provided_contract" "test" { + parent_dn = aci_endpoint_security_group.test.id + contract_name = "test_tn_vz_br_cp_name" + priority = "1" +} +`