diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index 30071b579..8827613bd 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -53,6 +53,7 @@ data "aci_annotation" "example_application_epg" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) @@ -74,7 +75,6 @@ data "aci_annotation" "example_application_epg" { - [aci_certificate_authority](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/certificate_authority) ([pkiTP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/pkiTP/overview)) - [aci_route_control_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/route_control_profile) ([rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)) - [aci_contract_interface](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract_interface) ([vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)) - - [aci_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/out_of_band_contract) ([vzOOBBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzOOBBrCP/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/relation_to_fallback_route_group.md b/docs/data-sources/relation_to_fallback_route_group.md index da9da0235..93c21c91d 100644 --- a/docs/data-sources/relation_to_fallback_route_group.md +++ b/docs/data-sources/relation_to_fallback_route_group.md @@ -32,7 +32,7 @@ Data source for Relation To Fallback Route Group data "aci_relation_to_fallback_route_group" "example_l3_outside" { parent_dn = aci_l3_outside.example.id - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" } ``` diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 854ea5fc6..ebfa0a706 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -53,6 +53,7 @@ data "aci_tag" "example_application_epg" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) @@ -74,7 +75,6 @@ data "aci_tag" "example_application_epg" { - [aci_certificate_authority](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/certificate_authority) ([pkiTP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/pkiTP/overview)) - [aci_route_control_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/route_control_profile) ([rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)) - [aci_contract_interface](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract_interface) ([vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)) - - [aci_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/out_of_band_contract) ([vzOOBBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzOOBBrCP/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index 081c2a91c..ed8f540f1 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -62,6 +62,7 @@ All examples for the Annotation resource can be found in the [examples](https:// ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) @@ -83,7 +84,6 @@ All examples for the Annotation resource can be found in the [examples](https:// - [aci_certificate_authority](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/certificate_authority) ([pkiTP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/pkiTP/overview)) - [aci_route_control_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/route_control_profile) ([rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)) - [aci_contract_interface](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract_interface) ([vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)) - - [aci_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/out_of_band_contract) ([vzOOBBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzOOBBrCP/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/docs/resources/relation_to_fallback_route_group.md b/docs/resources/relation_to_fallback_route_group.md index c7acf8bd1..a4db87ef4 100644 --- a/docs/resources/relation_to_fallback_route_group.md +++ b/docs/resources/relation_to_fallback_route_group.md @@ -36,7 +36,7 @@ The configuration snippet below creates a Relation To Fallback Route Group with resource "aci_relation_to_fallback_route_group" "example_l3_outside" { parent_dn = aci_l3_outside.example.id - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" } ``` @@ -49,7 +49,7 @@ The configuration snippet below shows all possible attributes of the Relation To resource "aci_relation_to_fallback_route_group" "full_example_l3_outside" { parent_dn = aci_l3_outside.example.id annotation = "annotation" - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" annotations = [ { key = "key_0" @@ -81,7 +81,7 @@ All examples for the Relation To Fallback Route Group resource can be found in t * `id` - (string) The distinguished name (DN) of the Relation To Fallback Route Group object. ### Optional ### - + * `annotation` (annotation) - (string) The annotation of the Relation To Fallback Route Group object. - Default: `orchestrator:terraform` diff --git a/docs/resources/tag.md b/docs/resources/tag.md index 7f631b822..8bc93541e 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -62,6 +62,7 @@ All examples for the Tag resource can be found in the [examples](https://github. ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) @@ -83,7 +84,6 @@ All examples for the Tag resource can be found in the [examples](https://github. - [aci_certificate_authority](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/certificate_authority) ([pkiTP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/pkiTP/overview)) - [aci_route_control_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/route_control_profile) ([rtctrlProfile](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/rtctrlProfile/overview)) - [aci_contract_interface](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract_interface) ([vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)) - - [aci_out_of_band_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/out_of_band_contract) ([vzOOBBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzOOBBrCP/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/examples/data-sources/aci_relation_to_fallback_route_group/data-source.tf b/examples/data-sources/aci_relation_to_fallback_route_group/data-source.tf index 147b177a0..680c0d76e 100644 --- a/examples/data-sources/aci_relation_to_fallback_route_group/data-source.tf +++ b/examples/data-sources/aci_relation_to_fallback_route_group/data-source.tf @@ -1,5 +1,5 @@ data "aci_relation_to_fallback_route_group" "example_l3_outside" { parent_dn = aci_l3_outside.example.id - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" } diff --git a/examples/resources/aci_relation_to_fallback_route_group/resource-all-attributes.tf b/examples/resources/aci_relation_to_fallback_route_group/resource-all-attributes.tf index 34cbde73b..c41f3512d 100644 --- a/examples/resources/aci_relation_to_fallback_route_group/resource-all-attributes.tf +++ b/examples/resources/aci_relation_to_fallback_route_group/resource-all-attributes.tf @@ -2,7 +2,7 @@ resource "aci_relation_to_fallback_route_group" "full_example_l3_outside" { parent_dn = aci_l3_outside.example.id annotation = "annotation" - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" annotations = [ { key = "key_0" diff --git a/examples/resources/aci_relation_to_fallback_route_group/resource.tf b/examples/resources/aci_relation_to_fallback_route_group/resource.tf index 7649dd8fd..8f6f2ac0b 100644 --- a/examples/resources/aci_relation_to_fallback_route_group/resource.tf +++ b/examples/resources/aci_relation_to_fallback_route_group/resource.tf @@ -1,5 +1,5 @@ resource "aci_relation_to_fallback_route_group" "example_l3_outside" { parent_dn = aci_l3_outside.example.id - target_dn = aci_vrf_fallback_route_group.test.id + target_dn = "aci_vrf_fallback_route_group.test.id" } diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index 26fdee17e..db621b3fd 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -211,11 +211,11 @@ l3extRsOutToFBRGroup: tDn: "The distinguished name of the VRF Fallback Route Group object." test_values: resource_required: - target_dn: aci_vrf_fallback_route_group.test.id + target_dn: "aci_vrf_fallback_route_group.test.id" datasource_required: - target_dn: aci_vrf_fallback_route_group.test.id + target_dn: "aci_vrf_fallback_route_group.test.id" datasource_non_existing: - target_dn: aci_vrf_fallback_route_group.test.id + target_dn: "aci_vrf_fallback_route_group.test.id" parents: - class_name: "l3extOut" parent_dependency: "fvTenant" diff --git a/gen/generator.go b/gen/generator.go index 1ae6b8dc0..405d56b4f 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -222,6 +222,9 @@ func LookupTestValue(classPkgName, propertyName string, testVars map[string]inte if strVal, ok := val.(string); ok { if isMultiLine(propertyName, classPkgName, definitions) { lookupValue = processMultiLine(strVal) + } else if strings.Contains(strVal, "_dn") { + fmt.Println(propertyName, strVal) + lookupValue = fmt.Sprintf(`%s`, strVal) } else { lookupValue = fmt.Sprintf(`"%s"`, strVal) } @@ -855,48 +858,8 @@ type Model struct { DnFormats []interface{} TargetProperties map[string]Property TargetNamedProperties map[string]Property - Properties map[string]Property - NamedProperties map[string]Property - Children map[string]Model - Configuration map[string]interface{} - TestVars map[string]interface{} - Definitions Definitions ResourceNameAsDescription string - PkgName string - Label string - Name string - RnFormat string - RnPrepend string - Comment string - ResourceClassName string - ResourceName string - ResourceNameDocReference string - ChildResourceName string - ExampleDataSource string - ExampleResource string - ExampleResourceFull string - SubCategory string - RelationshipClass string - RelationshipResourceName string - Versions string TestType []TestClassification - ChildClasses []string - ContainedBy []string - Contains []string - DocumentationDnFormats []string - DocumentationParentDns []string - DocumentationExamples []string - DocumentationChildren []string - ResourceNotes []string - ResourceWarnings []string - DatasourceNotes []string - DatasourceWarnings []string - Parents []string - UiLocations []string - RnFormatMap map[string]string - RnFormatMapWithWrapperClass map[string]string - IdentifiedBy []interface{} - DnFormats []interface{} PlatformFlavors map[string][]interface{} MultiParentFormats map[string]MultiParentFormat MultiParentFormatsTestTypes map[string]string diff --git a/gen/templates/resource_test.go.tmpl b/gen/templates/resource_test.go.tmpl index 29783859e..8ff0f7853 100644 --- a/gen/templates/resource_test.go.tmpl +++ b/gen/templates/resource_test.go.tmpl @@ -128,11 +128,6 @@ PreCheck: func() { {{- end }} {{- end }} {{- end}} - {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} - {{- if not $contains}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), - {{- end}} - {{- end}} {{- if $.resource_required }} {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} @@ -596,6 +591,7 @@ const testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name resource "aci_{{$.resourceName}}" "test" { {{- if ne .parent_dn ""}} parent_dn = {{.parent_dn}} + {{- end}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} {{$key}} = {{$value}} @@ -603,7 +599,6 @@ resource "aci_{{$.resourceName}}" "test" { {{$key}} = "{{$value}}" {{- end }} {{- end}} - {{- end}} } ` @@ -622,13 +617,8 @@ resource "aci_{{$.resourceName}}" "test" { {{- end}} {{- end}} {{- range $key, $value := $.all}} - {{- if or (contains $value "< 0 { - tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationPkiTPList) - data.TagAnnotation = tagAnnotationSet - } - if len(TagTagPkiTPList) > 0 { - tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagPkiTPList) - data.TagTag = tagTagSet - } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationPkiTPList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagPkiTPList) + data.TagTag = tagTagSet } else { diags.AddError( "too many results in response", diff --git a/internal/provider/resource_aci_certificate_authority_test.go b/internal/provider/resource_aci_certificate_authority_test.go index 87a26d6af..19bf938a9 100644 --- a/internal/provider/resource_aci_certificate_authority_test.go +++ b/internal/provider/resource_aci_certificate_authority_test.go @@ -427,18 +427,18 @@ const testConfigPkiTPChildrenRemoveOneDependencyWithPolUni = testConfigPolUniMin resource "aci_certificate_authority" "test" { certificate_chain = "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----" name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` @@ -525,18 +525,18 @@ resource "aci_certificate_authority" "test" { parent_dn = aci_tenant.test.id certificate_chain = "-----BEGIN CERTIFICATE-----\nMIICODCCAaGgAwIBAgIJAIt8XMntue0VMA0GCSqGSIb3DQEBCwUAMDQxDjAMBgNV\nBAMMBUFkbWluMRUwEwYDVQQKDAxZb3VyIENvbXBhbnkxCzAJBgNVBAYTAlVTMCAX\nDTE4MDEwOTAwNTk0NFoYDzIxMTcxMjE2MDA1OTQ0WjA0MQ4wDAYDVQQDDAVBZG1p\nbjEVMBMGA1UECgwMWW91ciBDb21wYW55MQswCQYDVQQGEwJVUzCBnzANBgkqhkiG\n9w0BAQEFAAOBjQAwgYkCgYEAohG/7axtt7CbSaMP7r+2mhTKbNgh0Ww36C7Ta14i\nv+VmLyKkQHnXinKGhp6uy3Nug+15a+eIu7CrgpBVMQeCiWfsnwRocKcQJWIYDrWl\nXHxGQn31yYKR6mylE7Dcj3rMFybnyhezr5D8GcP85YRPmwG9H2hO/0Y1FUnWu9Iw\nAQkCAwEAAaNQME4wHQYDVR0OBBYEFD0jLXfpkrU/ChzRvfruRs/fy1VXMB8GA1Ud\nIwQYMBaAFD0jLXfpkrU/ChzRvfruRs/fy1VXMAwGA1UdEwQFMAMBAf8wDQYJKoZI\nhvcNAQELBQADgYEAOmvre+5tgZ0+F3DgsfxNQqLTrGiBgGCIymPkP/cBXXkNuJyl\n3ac7tArHQc7WEA4U2R2rZbEq8FC3UJJm4nUVtCPvEh3G9OhN2xwYev79yt6pIn/l\nKU0Td2OpVyo0eLqjoX5u2G90IBWzhyjFbo+CcKMrSVKj1YOdG0E3OuiJf00=\n-----END CERTIFICATE-----" name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_endpoint_tag_ip_test.go b/internal/provider/resource_aci_endpoint_tag_ip_test.go index 205ce1180..702fdfdec 100644 --- a/internal/provider/resource_aci_endpoint_tag_ip_test.go +++ b/internal/provider/resource_aci_endpoint_tag_ip_test.go @@ -241,18 +241,18 @@ resource "aci_endpoint_tag_ip" "test" { parent_dn = aci_tenant.test.id ip = "10.0.0.2" vrf_name = "test_ctx_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_endpoint_tag_mac_test.go b/internal/provider/resource_aci_endpoint_tag_mac_test.go index e501ffc89..d77b6ee07 100644 --- a/internal/provider/resource_aci_endpoint_tag_mac_test.go +++ b/internal/provider/resource_aci_endpoint_tag_mac_test.go @@ -241,18 +241,18 @@ resource "aci_endpoint_tag_mac" "test" { parent_dn = aci_tenant.test.id bd_name = "test_bd_name" mac = "00:00:00:00:00:01" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` 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 e0cc23377..987e2c904 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 @@ -241,20 +241,20 @@ resource "aci_external_management_network_instance_profile" "test" { const testConfigMgmtInstPChildrenRemoveOne = ` resource "aci_external_management_network_instance_profile" "test" { name = "test_name" - annotations = [ + annotations = [ { key = "key_1" value = "value_2" }, ] - relation_to_consumed_out_of_band_contracts = [ + relation_to_consumed_out_of_band_contracts = [ { annotation = "annotation_2" out_of_band_contract_name = "out_of_band_contract_name_1" priority = "level2" }, ] - tags = [ + tags = [ { key = "key_1" value = "value_2" diff --git a/internal/provider/resource_aci_external_management_network_subnet_test.go b/internal/provider/resource_aci_external_management_network_subnet_test.go index 57f171760..b2eb28f7c 100644 --- a/internal/provider/resource_aci_external_management_network_subnet_test.go +++ b/internal/provider/resource_aci_external_management_network_subnet_test.go @@ -228,18 +228,18 @@ const testConfigMgmtSubnetChildrenRemoveOneDependencyWithMgmtInstP = testConfigM resource "aci_external_management_network_subnet" "test" { parent_dn = aci_external_management_network_instance_profile.test.id ip = "1.1.1.0/24" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_key_ring.go b/internal/provider/resource_aci_key_ring.go index 173bb734c..f33842e1d 100644 --- a/internal/provider/resource_aci_key_ring.go +++ b/internal/provider/resource_aci_key_ring.go @@ -622,14 +622,10 @@ func getAndSetPkiKeyRingAttributes(ctx context.Context, diags *diag.Diagnostics, } } } - if len(TagAnnotationPkiKeyRingList) > 0 { - tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationPkiKeyRingList) - data.TagAnnotation = tagAnnotationSet - } - if len(TagTagPkiKeyRingList) > 0 { - tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagPkiKeyRingList) - data.TagTag = tagTagSet - } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationPkiKeyRingList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagPkiKeyRingList) + data.TagTag = tagTagSet } else { diags.AddError( "too many results in response", diff --git a/internal/provider/resource_aci_key_ring_test.go b/internal/provider/resource_aci_key_ring_test.go index 92cd15629..a9a6d68f5 100644 --- a/internal/provider/resource_aci_key_ring_test.go +++ b/internal/provider/resource_aci_key_ring_test.go @@ -513,18 +513,18 @@ resource "aci_key_ring" "test" { const testConfigPkiKeyRingChildrenRemoveOneDependencyWithPolUni = testConfigPolUniMinDependencyWithPkiTP + ` resource "aci_key_ring" "test" { name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` @@ -620,18 +620,18 @@ const testConfigPkiKeyRingChildrenRemoveOneDependencyWithFvTenant = testConfigFv resource "aci_key_ring" "test" { parent_dn = aci_tenant.test.id name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_l3out_consumer_label_test.go b/internal/provider/resource_aci_l3out_consumer_label_test.go index b3bcd4563..11d043fa2 100644 --- a/internal/provider/resource_aci_l3out_consumer_label_test.go +++ b/internal/provider/resource_aci_l3out_consumer_label_test.go @@ -252,18 +252,18 @@ const testConfigL3extConsLblChildrenRemoveOneDependencyWithL3extOut = testConfig resource "aci_l3out_consumer_label" "test" { parent_dn = aci_l3_outside.test.id name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_l3out_redistribute_policy_test.go b/internal/provider/resource_aci_l3out_redistribute_policy_test.go index ac4946980..30adc530e 100644 --- a/internal/provider/resource_aci_l3out_redistribute_policy_test.go +++ b/internal/provider/resource_aci_l3out_redistribute_policy_test.go @@ -217,18 +217,18 @@ resource "aci_l3out_redistribute_policy" "test" { parent_dn = aci_l3_outside.test.id route_control_profile_name = "test_tn_rtctrl_profile_name" source = "direct" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` 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 a52f23dad..b03be6bab 100644 --- a/internal/provider/resource_aci_out_of_band_contract_test.go +++ b/internal/provider/resource_aci_out_of_band_contract_test.go @@ -265,13 +265,13 @@ resource "aci_out_of_band_contract" "test" { const testConfigVzOOBBrCPChildrenRemoveOne = ` resource "aci_out_of_band_contract" "test" { name = "test_name" - annotations = [ + annotations = [ { key = "key_1" value = "value_2" }, ] - tags = [ + tags = [ { key = "key_1" value = "value_2" diff --git a/internal/provider/resource_aci_pim_route_map_entry_test.go b/internal/provider/resource_aci_pim_route_map_entry_test.go index b6d354753..f618465b6 100644 --- a/internal/provider/resource_aci_pim_route_map_entry_test.go +++ b/internal/provider/resource_aci_pim_route_map_entry_test.go @@ -260,18 +260,18 @@ const testConfigPimRouteMapEntryChildrenRemoveOneDependencyWithPimRouteMapPol = resource "aci_pim_route_map_entry" "test" { parent_dn = aci_pim_route_map_policy.test.id order = "1" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_pim_route_map_policy_test.go b/internal/provider/resource_aci_pim_route_map_policy_test.go index d427e4761..aaf919752 100644 --- a/internal/provider/resource_aci_pim_route_map_policy_test.go +++ b/internal/provider/resource_aci_pim_route_map_policy_test.go @@ -236,18 +236,18 @@ const testConfigPimRouteMapPolChildrenRemoveOneDependencyWithFvTenant = testConf resource "aci_pim_route_map_policy" "test" { parent_dn = aci_tenant.test.id name = "test_name" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` 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 8f2eafa96..92823d60f 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 @@ -212,18 +212,18 @@ const testConfigMgmtRsOoBConsChildrenRemoveOneDependencyWithMgmtInstP = testConf 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" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_relation_to_fallback_route_group.go b/internal/provider/resource_aci_relation_to_fallback_route_group.go index 008b9e309..e81efa717 100644 --- a/internal/provider/resource_aci_relation_to_fallback_route_group.go +++ b/internal/provider/resource_aci_relation_to_fallback_route_group.go @@ -98,6 +98,7 @@ func (r *L3extRsOutToFBRGroupResource) Schema(ctx context.Context, req resource. Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the Relation To Fallback Route Group object.`, @@ -106,6 +107,7 @@ func (r *L3extRsOutToFBRGroupResource) Schema(ctx context.Context, req resource. Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The distinguished name of the VRF Fallback Route Group object.`, @@ -356,6 +358,12 @@ func getAndSetL3extRsOutToFBRGroupAttributes(ctx context.Context, diags *diag.Di data.TDn = basetypes.NewStringValue(attributeValue.(string)) } } + if data.Annotation.IsUnknown() { + data.Annotation = types.StringNull() + } + if data.TDn.IsUnknown() { + data.TDn = types.StringNull() + } TagAnnotationL3extRsOutToFBRGroupList := make([]TagAnnotationL3extRsOutToFBRGroupResourceModel, 0) TagTagL3extRsOutToFBRGroupList := make([]TagTagL3extRsOutToFBRGroupResourceModel, 0) _, ok := classReadInfo[0].(map[string]interface{})["children"] diff --git a/internal/provider/resource_aci_relation_to_fallback_route_group_test.go b/internal/provider/resource_aci_relation_to_fallback_route_group_test.go index 6d59993bf..c847d9e57 100644 --- a/internal/provider/resource_aci_relation_to_fallback_route_group_test.go +++ b/internal/provider/resource_aci_relation_to_fallback_route_group_test.go @@ -13,7 +13,9 @@ import ( func TestAccResourceL3extRsOutToFBRGroupWithL3extOut(t *testing.T) { resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { + testAccPreCheck(t, "apic") + }, ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, Steps: []resource.TestStep{ // Create with minimum config and verify default APIC values @@ -136,6 +138,9 @@ func TestAccResourceL3extRsOutToFBRGroupWithL3extOut(t *testing.T) { ), }, }, + CheckDestroy: resource.ComposeAggregateTestCheckFunc( + testCheckResourceDestroy, + ), }) } @@ -173,25 +178,25 @@ resource "aci_relation_to_fallback_route_group" "test" { parent_dn = aci_l3_outside.test.id target_dn = aci_vrf_fallback_route_group.test.id annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] } ` @@ -207,16 +212,16 @@ resource "aci_relation_to_fallback_route_group" "test" { parent_dn = aci_l3_outside.test.id target_dn = aci_vrf_fallback_route_group.test.id annotations = [ - { + { key = "key_1" value = "value_2" - }, + }, ] tags = [ - { + { key = "key_1" value = "value_2" - }, + }, ] } ` diff --git a/internal/provider/resource_aci_vrf_fallback_route_group_member_test.go b/internal/provider/resource_aci_vrf_fallback_route_group_member_test.go index ed528a056..dd507079c 100644 --- a/internal/provider/resource_aci_vrf_fallback_route_group_member_test.go +++ b/internal/provider/resource_aci_vrf_fallback_route_group_member_test.go @@ -228,18 +228,18 @@ const testConfigFvFBRMemberChildrenRemoveOneDependencyWithFvFBRGroup = testConfi resource "aci_vrf_fallback_route_group_member" "test" { parent_dn = aci_vrf_fallback_route_group.test.id fallback_member = "2.2.2.3" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] } ` diff --git a/internal/provider/resource_aci_vrf_fallback_route_group_test.go b/internal/provider/resource_aci_vrf_fallback_route_group_test.go index 6df0b549e..2bd28984e 100644 --- a/internal/provider/resource_aci_vrf_fallback_route_group_test.go +++ b/internal/provider/resource_aci_vrf_fallback_route_group_test.go @@ -274,27 +274,27 @@ const testConfigFvFBRGroupChildrenRemoveOneDependencyWithFvCtx = testConfigFvCtx resource "aci_vrf_fallback_route_group" "test" { parent_dn = aci_vrf.test.id name = "fallback_route_group" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] - vrf_fallback_route_group_members = [ - { - annotation = "annotation_2" - description = "description_2" - fallback_member = "2.2.2.3" - name = "name_2" - name_alias = "name_alias_2" - }, - ] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] + vrf_fallback_route_group_members = [ + { + annotation = "annotation_2" + description = "description_2" + fallback_member = "2.2.2.3" + name = "name_2" + name_alias = "name_alias_2" + }, + ] } `