From 2d7150ac9e86dae41a98c6120bc4263c979016d7 Mon Sep 17 00:00:00 2001 From: Gaspard Micol Date: Tue, 6 Aug 2024 10:25:26 -0400 Subject: [PATCH] [ignore] Re generate all files after Rebase. --- docs/data-sources/annotation.md | 5 - docs/data-sources/tag.md | 5 - docs/resources/annotation.md | 5 - docs/resources/epg_useg_ad_group_attribute.md | 10 +- docs/resources/epg_useg_block_statement.md | 8 +- docs/resources/epg_useg_dns_attribute.md | 10 +- docs/resources/epg_useg_ip_attribute.md | 8 +- docs/resources/epg_useg_mac_attribute.md | 8 +- .../resources/epg_useg_sub_block_statement.md | 16 +- docs/resources/epg_useg_vm_attribute.md | 16 +- docs/resources/tag.md | 5 - .../resource-all-attributes.tf | 10 +- .../resource-all-attributes.tf | 8 +- .../resource-all-attributes.tf | 10 +- .../resource-all-attributes.tf | 8 +- .../resource-all-attributes.tf | 8 +- .../resource-all-attributes.tf | 16 +- .../resource-all-attributes.tf | 16 +- gen/testvars/fvCrtrn.yaml | 12 +- gen/testvars/fvDnsAttr.yaml | 14 +- gen/testvars/fvIdGroupAttr.yaml | 14 +- gen/testvars/fvIpAttr.yaml | 12 +- gen/testvars/fvMacAttr.yaml | 12 +- gen/testvars/fvSCrtrn.yaml | 12 +- gen/testvars/fvVmAttr.yaml | 12 +- ...urce_aci_access_interface_override_test.go | 2 +- ...a_source_aci_relation_to_host_path_test.go | 2 +- ...esource_aci_epg_useg_ad_group_attribute.go | 62 ++++- ...ce_aci_epg_useg_ad_group_attribute_test.go | 102 +++---- .../resource_aci_epg_useg_block_statement.go | 66 ++++- ...ource_aci_epg_useg_block_statement_test.go | 114 ++++---- .../resource_aci_epg_useg_dns_attribute.go | 62 ++++- ...esource_aci_epg_useg_dns_attribute_test.go | 102 +++---- .../resource_aci_epg_useg_ip_attribute.go | 64 ++++- ...resource_aci_epg_useg_ip_attribute_test.go | 106 +++---- .../resource_aci_epg_useg_mac_attribute.go | 62 ++++- ...esource_aci_epg_useg_mac_attribute_test.go | 98 +++---- ...source_aci_epg_useg_sub_block_statement.go | 62 ++++- ...e_aci_epg_useg_sub_block_statement_test.go | 196 ++++++------- .../resource_aci_epg_useg_vm_attribute.go | 70 ++++- ...resource_aci_epg_useg_vm_attribute_test.go | 260 +++++++++--------- 41 files changed, 1017 insertions(+), 673 deletions(-) diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index 5b3ce1372..6c087cbdb 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -74,11 +74,6 @@ data "aci_annotation" "example_application_epg" { - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 2a6838520..e5380d291 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -74,11 +74,6 @@ data "aci_tag" "example_application_epg" { - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/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 a1dde48be..66636e3a5 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -83,11 +83,6 @@ All examples for the Annotation resource can be found in the [examples](https:// - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/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/epg_useg_ad_group_attribute.md b/docs/resources/epg_useg_ad_group_attribute.md index 6614d6077..c64e34353 100644 --- a/docs/resources/epg_useg_ad_group_attribute.md +++ b/docs/resources/epg_useg_ad_group_attribute.md @@ -49,11 +49,11 @@ The configuration snippet below shows all possible attributes of the EPG uSeg AD resource "aci_epg_useg_ad_group_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" - name = "name" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + description = "description_1" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" annotations = [ { diff --git a/docs/resources/epg_useg_block_statement.md b/docs/resources/epg_useg_block_statement.md index 4a4ccf40a..0d5907473 100644 --- a/docs/resources/epg_useg_block_statement.md +++ b/docs/resources/epg_useg_block_statement.md @@ -48,12 +48,12 @@ The configuration snippet below shows all possible attributes of the EPG uSeg Bl resource "aci_epg_useg_block_statement" "full_example_application_epg" { parent_dn = aci_application_epg.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" precedence = "1" scope = "scope-bd" annotations = [ diff --git a/docs/resources/epg_useg_dns_attribute.md b/docs/resources/epg_useg_dns_attribute.md index 26816ff74..edd394cfe 100644 --- a/docs/resources/epg_useg_dns_attribute.md +++ b/docs/resources/epg_useg_dns_attribute.md @@ -49,12 +49,12 @@ The configuration snippet below shows all possible attributes of the EPG uSeg DN resource "aci_epg_useg_dns_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" - filter = "filter" + description = "description_1" + filter = "filter_1" name = "dns_attribute" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/docs/resources/epg_useg_ip_attribute.md b/docs/resources/epg_useg_ip_attribute.md index 08568725e..c74569724 100644 --- a/docs/resources/epg_useg_ip_attribute.md +++ b/docs/resources/epg_useg_ip_attribute.md @@ -50,12 +50,12 @@ The configuration snippet below shows all possible attributes of the EPG uSeg IP resource "aci_epg_useg_ip_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" ip = "131.107.1.200" name = "131" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" use_epg_subnet = "yes" annotations = [ { diff --git a/docs/resources/epg_useg_mac_attribute.md b/docs/resources/epg_useg_mac_attribute.md index b52c2f149..c4609652f 100644 --- a/docs/resources/epg_useg_mac_attribute.md +++ b/docs/resources/epg_useg_mac_attribute.md @@ -50,12 +50,12 @@ The configuration snippet below shows all possible attributes of the EPG uSeg MA resource "aci_epg_useg_mac_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" mac = "AA:BB:CC:DD:EE:FF" name = "mac_attr" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/docs/resources/epg_useg_sub_block_statement.md b/docs/resources/epg_useg_sub_block_statement.md index 4a629e3d9..b02695c4a 100644 --- a/docs/resources/epg_useg_sub_block_statement.md +++ b/docs/resources/epg_useg_sub_block_statement.md @@ -55,12 +55,12 @@ The configuration snippet below shows all possible attributes of the EPG uSeg Su resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "sub_criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" @@ -78,12 +78,12 @@ resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_block_stateme resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_sub_block_statement" { parent_dn = aci_epg_useg_sub_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "sub_criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/docs/resources/epg_useg_vm_attribute.md b/docs/resources/epg_useg_vm_attribute.md index ffc3d47a9..70624d83c 100644 --- a/docs/resources/epg_useg_vm_attribute.md +++ b/docs/resources/epg_useg_vm_attribute.md @@ -59,13 +59,13 @@ resource "aci_epg_useg_vm_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" name = "vm_attribute" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "default_value" annotations = [ @@ -86,13 +86,13 @@ resource "aci_epg_useg_vm_attribute" "full_example_epg_useg_sub_block_statement" parent_dn = aci_epg_useg_sub_block_statement.example.id annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" name = "vm_attribute" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "default_value" annotations = [ diff --git a/docs/resources/tag.md b/docs/resources/tag.md index 4aaf65e6d..20488a22c 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -83,11 +83,6 @@ All examples for the Tag resource can be found in the [examples](https://github. - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/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/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf index 6b1a72628..696d10a21 100644 --- a/examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf @@ -2,11 +2,11 @@ resource "aci_epg_useg_ad_group_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" - name = "name" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + description = "description_1" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" annotations = [ { diff --git a/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf b/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf index 0eb3c1a23..389238fe2 100644 --- a/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf @@ -2,12 +2,12 @@ resource "aci_epg_useg_block_statement" "full_example_application_epg" { parent_dn = aci_application_epg.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" precedence = "1" scope = "scope-bd" annotations = [ diff --git a/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf index 3b70a87bd..ebc1bda40 100644 --- a/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf @@ -2,12 +2,12 @@ resource "aci_epg_useg_dns_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" - filter = "filter" + description = "description_1" + filter = "filter_1" name = "dns_attribute" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf index c665c8f31..dcdfd4b28 100644 --- a/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf @@ -2,12 +2,12 @@ resource "aci_epg_useg_ip_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" ip = "131.107.1.200" name = "131" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" use_epg_subnet = "yes" annotations = [ { diff --git a/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf index 7db6246a6..9170d7720 100644 --- a/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf @@ -2,12 +2,12 @@ resource "aci_epg_useg_mac_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" mac = "AA:BB:CC:DD:EE:FF" name = "mac_attr" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/examples/resources/aci_epg_useg_sub_block_statement/resource-all-attributes.tf b/examples/resources/aci_epg_useg_sub_block_statement/resource-all-attributes.tf index 10e4dd78c..273b12583 100644 --- a/examples/resources/aci_epg_useg_sub_block_statement/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_sub_block_statement/resource-all-attributes.tf @@ -2,12 +2,12 @@ resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "sub_criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" @@ -25,12 +25,12 @@ resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_block_stateme resource "aci_epg_useg_sub_block_statement" "full_example_epg_useg_sub_block_statement" { parent_dn = aci_epg_useg_sub_block_statement.example.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "sub_criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" annotations = [ { key = "key_0" diff --git a/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf index 06e195d02..938c6462f 100644 --- a/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf @@ -3,13 +3,13 @@ resource "aci_epg_useg_vm_attribute" "full_example_epg_useg_block_statement" { parent_dn = aci_epg_useg_block_statement.example.id annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" name = "vm_attribute" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "default_value" annotations = [ @@ -30,13 +30,13 @@ resource "aci_epg_useg_vm_attribute" "full_example_epg_useg_sub_block_statement" parent_dn = aci_epg_useg_sub_block_statement.example.id annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" name = "vm_attribute" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "default_value" annotations = [ diff --git a/gen/testvars/fvCrtrn.yaml b/gen/testvars/fvCrtrn.yaml index c8f420e60..071f0a25d 100644 --- a/gen/testvars/fvCrtrn.yaml +++ b/gen/testvars/fvCrtrn.yaml @@ -16,12 +16,12 @@ default: all: annotation: "annotation" - description: "description" + description: "description_1" match: "all" name: "criterion" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" precedence: "1" scope: "scope-bd" @@ -31,14 +31,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvAEPg" diff --git a/gen/testvars/fvDnsAttr.yaml b/gen/testvars/fvDnsAttr.yaml index c19dfa884..23cc9e140 100644 --- a/gen/testvars/fvDnsAttr.yaml +++ b/gen/testvars/fvDnsAttr.yaml @@ -21,11 +21,11 @@ resource_required: all: annotation: "annotation" - description: "description" - filter: "filter" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + description: "description_1" + filter: "filter_1" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" children: annotations: @@ -33,14 +33,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/gen/testvars/fvIdGroupAttr.yaml b/gen/testvars/fvIdGroupAttr.yaml index 0522b4730..b37f0226c 100644 --- a/gen/testvars/fvIdGroupAttr.yaml +++ b/gen/testvars/fvIdGroupAttr.yaml @@ -21,11 +21,11 @@ resource_required: all: annotation: "annotation" - description: "description" - name: "name" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + description: "description_1" + name: "name_1" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" children: annotations: @@ -33,14 +33,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/gen/testvars/fvIpAttr.yaml b/gen/testvars/fvIpAttr.yaml index 68f031d8f..a230834c3 100644 --- a/gen/testvars/fvIpAttr.yaml +++ b/gen/testvars/fvIpAttr.yaml @@ -23,11 +23,11 @@ resource_required: all: annotation: "annotation" - description: "description" + description: "description_1" ip: "0.0.0.0" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" use_epg_subnet: "yes" children: @@ -36,14 +36,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/gen/testvars/fvMacAttr.yaml b/gen/testvars/fvMacAttr.yaml index b80e88269..c83fa86c7 100644 --- a/gen/testvars/fvMacAttr.yaml +++ b/gen/testvars/fvMacAttr.yaml @@ -22,11 +22,11 @@ resource_required: all: annotation: "annotation" - description: "description" + description: "description_1" mac: "AA:BB:CC:BB:BB:EE" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" children: annotations: @@ -34,14 +34,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/gen/testvars/fvSCrtrn.yaml b/gen/testvars/fvSCrtrn.yaml index aaf9b75b4..8885d235c 100644 --- a/gen/testvars/fvSCrtrn.yaml +++ b/gen/testvars/fvSCrtrn.yaml @@ -21,11 +21,11 @@ resource_required: all: annotation: "annotation" - description: "description" + description: "description_1" match: "all" - name_alias: "name_alias" - owner_key: "owner_key" - owner_tag: "owner_tag" + name_alias: "name_alias_1" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" children: annotations: @@ -33,14 +33,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/gen/testvars/fvVmAttr.yaml b/gen/testvars/fvVmAttr.yaml index cbe072d58..b5bcbb294 100644 --- a/gen/testvars/fvVmAttr.yaml +++ b/gen/testvars/fvVmAttr.yaml @@ -27,12 +27,12 @@ resource_required: all: annotation: "annotation" category: "all_category" - description: "description" + description: "description_1" label_name: "label_name" - name_alias: "name_alias" + name_alias: "name_alias_1" operator: "contains" - owner_key: "owner_key" - owner_tag: "owner_tag" + owner_key: "owner_key_1" + owner_tag: "owner_tag_1" type: "domain" value: "all_value" @@ -42,14 +42,14 @@ children: value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" tags: - key: "key_0" value: "value_1" - key: "key_1" - value: "value_2" + value: "test_value" parents: - class_name: "fvCrtrn" diff --git a/internal/provider/data_source_aci_access_interface_override_test.go b/internal/provider/data_source_aci_access_interface_override_test.go index 47f5c6922..111cf3ea2 100644 --- a/internal/provider/data_source_aci_access_interface_override_test.go +++ b/internal/provider/data_source_aci_access_interface_override_test.go @@ -43,7 +43,7 @@ data "aci_access_interface_override" "test" { ` const testConfigInfraHPathSNotExisting = testConfigInfraHPathSAll + ` -data "aci_access_interface_override" "test" { +data "aci_access_interface_override" "test_non_existing" { name = "host_path_selector_non_existing" } ` diff --git a/internal/provider/data_source_aci_relation_to_host_path_test.go b/internal/provider/data_source_aci_relation_to_host_path_test.go index f04471a87..c30cc1005 100644 --- a/internal/provider/data_source_aci_relation_to_host_path_test.go +++ b/internal/provider/data_source_aci_relation_to_host_path_test.go @@ -41,7 +41,7 @@ data "aci_relation_to_host_path" "test" { } ` -const testConfigInfraRsHPathAttNotExistingInfraHPathS = testConfigInfraRsHPathAttMinDependencyWithInfraHPathS + ` +const testConfigInfraRsHPathAttNotExistingInfraHPathS = testConfigInfraHPathSMin + ` data "aci_relation_to_host_path" "test_non_existing" { parent_dn = aci_access_interface_override.test.id target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]_not_existing" diff --git a/internal/provider/resource_aci_epg_useg_ad_group_attribute.go b/internal/provider/resource_aci_epg_useg_ad_group_attribute.go index 12632dd36..b207cc0ae 100644 --- a/internal/provider/resource_aci_epg_useg_ad_group_attribute.go +++ b/internal/provider/resource_aci_epg_useg_ad_group_attribute.go @@ -13,6 +13,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -54,18 +55,58 @@ type FvIdGroupAttrResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvIdGroupAttrResourceModel() *FvIdGroupAttrResourceModel { + return &FvIdGroupAttrResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + Selector: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvIdGroupAttrResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvIdGroupAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvIdGroupAttrResourceModel() TagAnnotationFvIdGroupAttrResourceModel { + return TagAnnotationFvIdGroupAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvIdGroupAttrResourceModel describes the resource data model for the children without relation ships. type TagTagFvIdGroupAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvIdGroupAttrResourceModel() TagTagFvIdGroupAttrResourceModel { + return TagTagFvIdGroupAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvIdGroupAttrIdentifier struct { Selector types.String } @@ -128,6 +169,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg AD Group Attribute object.`, @@ -137,6 +179,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg AD Group Attribute object.`, }, @@ -145,6 +188,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name of the EPG uSeg AD Group Attribute object.`, }, @@ -153,6 +197,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg AD Group Attribute object.`, }, @@ -161,6 +206,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -169,6 +215,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -176,6 +223,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The selector of the EPG uSeg AD Group Attribute object. Represents the DN or expression to select an identity group.`, @@ -418,6 +466,8 @@ func (r *FvIdGroupAttrResource) ImportState(ctx context.Context, req resource.Im func getAndSetFvIdGroupAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIdGroupAttrResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvIdGroupAttr,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvIdGroupAttrResourceModel() + if diags.HasError() { return } @@ -461,7 +511,7 @@ func getAndSetFvIdGroupAttrAttributes(ctx context.Context, diags *diag.Diagnosti for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvIdGroupAttr := TagAnnotationFvIdGroupAttrResourceModel{} + TagAnnotationFvIdGroupAttr := getEmptyTagAnnotationFvIdGroupAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvIdGroupAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -473,7 +523,7 @@ func getAndSetFvIdGroupAttrAttributes(ctx context.Context, diags *diag.Diagnosti TagAnnotationFvIdGroupAttrList = append(TagAnnotationFvIdGroupAttrList, TagAnnotationFvIdGroupAttr) } if childClassName == "tagTag" { - TagTagFvIdGroupAttr := TagTagFvIdGroupAttrResourceModel{} + TagTagFvIdGroupAttr := getEmptyTagTagFvIdGroupAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvIdGroupAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -540,10 +590,10 @@ func getFvIdGroupAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -579,10 +629,10 @@ func getFvIdGroupAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagno tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_ad_group_attribute_test.go b/internal/provider/resource_aci_epg_useg_ad_group_attribute_test.go index bb246b0b9..0f94fca18 100644 --- a/internal/provider/resource_aci_epg_useg_ad_group_attribute_test.go +++ b/internal/provider/resource_aci_epg_useg_ad_group_attribute_test.go @@ -22,20 +22,20 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -64,20 +64,20 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -108,11 +108,11 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", "name"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", "name_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", "owner_tag_1"), ), }, // Update with minimum config and verify config is unchanged @@ -158,11 +158,11 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -179,12 +179,12 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.#", "2"), ), }, @@ -194,10 +194,10 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.#", "1"), ), }, @@ -215,14 +215,14 @@ func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { } const testConfigFvIdGroupAttrMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_ad_group_attribute" "test" { +resource "aci_epg_useg_ad_group_attribute" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" } -resource "aci_epg_useg_ad_group_attribute" "test_2" { +resource "aci_epg_useg_ad_group_attribute" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" - depends_on = [aci_epg_useg_ad_group_attribute.test] + depends_on = [aci_epg_useg_ad_group_attribute.allow_test] } ` @@ -238,11 +238,11 @@ resource "aci_epg_useg_ad_group_attribute" "test" { parent_dn = aci_epg_useg_block_statement.test.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" annotation = "annotation" - description = "description" - name = "name" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + description = "description_1" + name = "name_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" } ` @@ -269,7 +269,7 @@ resource "aci_epg_useg_ad_group_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -279,7 +279,7 @@ resource "aci_epg_useg_ad_group_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -299,13 +299,13 @@ resource "aci_epg_useg_ad_group_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_block_statement.go b/internal/provider/resource_aci_epg_useg_block_statement.go index e89910c96..2aec3c938 100644 --- a/internal/provider/resource_aci_epg_useg_block_statement.go +++ b/internal/provider/resource_aci_epg_useg_block_statement.go @@ -12,6 +12,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -56,18 +57,60 @@ type FvCrtrnResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvCrtrnResourceModel() *FvCrtrnResourceModel { + return &FvCrtrnResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Match: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + Prec: basetypes.NewStringNull(), + Scope: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvCrtrnResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvCrtrnResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvCrtrnResourceModel() TagAnnotationFvCrtrnResourceModel { + return TagAnnotationFvCrtrnResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvCrtrnResourceModel describes the resource data model for the children without relation ships. type TagTagFvCrtrnResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvCrtrnResourceModel() TagTagFvCrtrnResourceModel { + return TagTagFvCrtrnResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + func (r *FvCrtrnResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { if !req.Plan.Raw.IsNull() { var planData, stateData *FvCrtrnResourceModel @@ -126,6 +169,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg Block Statement object.`, @@ -135,6 +179,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg Block Statement object.`, }, @@ -143,6 +188,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("all", "any"), @@ -154,6 +200,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name of the EPG uSeg Block Statement object.`, }, @@ -162,6 +209,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg Block Statement object.`, }, @@ -170,6 +218,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -178,6 +227,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -186,6 +236,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The precedence of the EPG uSeg Block Statement object.`, }, @@ -194,6 +245,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("scope-bd", "scope-vrf"), @@ -438,6 +490,8 @@ func (r *FvCrtrnResource) ImportState(ctx context.Context, req resource.ImportSt func getAndSetFvCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvCrtrnResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvCrtrn,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvCrtrnResourceModel() + if diags.HasError() { return } @@ -487,7 +541,7 @@ func getAndSetFvCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, cl for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvCrtrn := TagAnnotationFvCrtrnResourceModel{} + TagAnnotationFvCrtrn := getEmptyTagAnnotationFvCrtrnResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -499,7 +553,7 @@ func getAndSetFvCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, cl TagAnnotationFvCrtrnList = append(TagAnnotationFvCrtrnList, TagAnnotationFvCrtrn) } if childClassName == "tagTag" { - TagTagFvCrtrn := TagTagFvCrtrnResourceModel{} + TagTagFvCrtrn := getEmptyTagTagFvCrtrnResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -560,10 +614,10 @@ func getFvCrtrnTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagn tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -599,10 +653,10 @@ func getFvCrtrnTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_block_statement_test.go b/internal/provider/resource_aci_epg_useg_block_statement_test.go index 5fc19112f..557ad7534 100644 --- a/internal/provider/resource_aci_epg_useg_block_statement_test.go +++ b/internal/provider/resource_aci_epg_useg_block_statement_test.go @@ -22,24 +22,24 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { Config: testConfigFvCrtrnMinDependencyWithFvAEPgAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "scope", "scope-bd"), ), }, }, @@ -68,24 +68,24 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { Config: testConfigFvCrtrnMinDependencyWithFvAEPgAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test_2", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test", "scope", "scope-bd"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.allow_test_2", "scope", "scope-bd"), ), }, }, @@ -117,12 +117,12 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "all"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", "criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", "owner_tag_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), ), @@ -172,11 +172,11 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -193,12 +193,12 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.#", "2"), ), }, @@ -208,10 +208,10 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.#", "1"), ), }, @@ -229,12 +229,12 @@ func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { } const testConfigFvCrtrnMinDependencyWithFvAEPgAllowExisting = testConfigFvAEPgMin + ` -resource "aci_epg_useg_block_statement" "test" { +resource "aci_epg_useg_block_statement" "allow_test" { parent_dn = aci_application_epg.test.id } -resource "aci_epg_useg_block_statement" "test_2" { +resource "aci_epg_useg_block_statement" "allow_test_2" { parent_dn = aci_application_epg.test.id - depends_on = [aci_epg_useg_block_statement.test] + depends_on = [aci_epg_useg_block_statement.allow_test] } ` @@ -248,12 +248,12 @@ const testConfigFvCrtrnAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` resource "aci_epg_useg_block_statement" "test" { parent_dn = aci_application_epg.test.id annotation = "annotation" - description = "description" + description = "description_1" match = "all" name = "criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" precedence = "1" scope = "scope-bd" } @@ -283,7 +283,7 @@ resource "aci_epg_useg_block_statement" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -293,7 +293,7 @@ resource "aci_epg_useg_block_statement" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -311,13 +311,13 @@ resource "aci_epg_useg_block_statement" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_dns_attribute.go b/internal/provider/resource_aci_epg_useg_dns_attribute.go index 9df23da8b..7ff6a5da9 100644 --- a/internal/provider/resource_aci_epg_useg_dns_attribute.go +++ b/internal/provider/resource_aci_epg_useg_dns_attribute.go @@ -13,6 +13,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -54,18 +55,58 @@ type FvDnsAttrResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvDnsAttrResourceModel() *FvDnsAttrResourceModel { + return &FvDnsAttrResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Filter: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvDnsAttrResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvDnsAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvDnsAttrResourceModel() TagAnnotationFvDnsAttrResourceModel { + return TagAnnotationFvDnsAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvDnsAttrResourceModel describes the resource data model for the children without relation ships. type TagTagFvDnsAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvDnsAttrResourceModel() TagTagFvDnsAttrResourceModel { + return TagTagFvDnsAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvDnsAttrIdentifier struct { Name types.String } @@ -128,6 +169,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg DNS Attribute object.`, @@ -137,6 +179,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg DNS Attribute object.`, }, @@ -145,6 +188,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The domain name filter of the EPG uSeg DNS Attribute object.`, }, @@ -152,6 +196,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The name of the EPG uSeg DNS Attribute object.`, @@ -161,6 +206,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg DNS Attribute object.`, }, @@ -169,6 +215,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -177,6 +224,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -418,6 +466,8 @@ func (r *FvDnsAttrResource) ImportState(ctx context.Context, req resource.Import func getAndSetFvDnsAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvDnsAttrResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvDnsAttr,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvDnsAttrResourceModel() + if diags.HasError() { return } @@ -461,7 +511,7 @@ func getAndSetFvDnsAttrAttributes(ctx context.Context, diags *diag.Diagnostics, for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvDnsAttr := TagAnnotationFvDnsAttrResourceModel{} + TagAnnotationFvDnsAttr := getEmptyTagAnnotationFvDnsAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvDnsAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -473,7 +523,7 @@ func getAndSetFvDnsAttrAttributes(ctx context.Context, diags *diag.Diagnostics, TagAnnotationFvDnsAttrList = append(TagAnnotationFvDnsAttrList, TagAnnotationFvDnsAttr) } if childClassName == "tagTag" { - TagTagFvDnsAttr := TagTagFvDnsAttrResourceModel{} + TagTagFvDnsAttr := getEmptyTagTagFvDnsAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvDnsAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -540,10 +590,10 @@ func getFvDnsAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Dia tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -579,10 +629,10 @@ func getFvDnsAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostic tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_dns_attribute_test.go b/internal/provider/resource_aci_epg_useg_dns_attribute_test.go index 8a8453b47..c7494b25a 100644 --- a/internal/provider/resource_aci_epg_useg_dns_attribute_test.go +++ b/internal/provider/resource_aci_epg_useg_dns_attribute_test.go @@ -22,20 +22,20 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvDnsAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -64,20 +64,20 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvDnsAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -108,11 +108,11 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", "filter"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", "description_1"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", "filter_1"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", "owner_tag_1"), ), }, // Update with minimum config and verify config is unchanged @@ -158,11 +158,11 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -179,12 +179,12 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.#", "2"), ), }, @@ -194,10 +194,10 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.#", "1"), ), }, @@ -215,14 +215,14 @@ func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { } const testConfigFvDnsAttrMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_dns_attribute" "test" { +resource "aci_epg_useg_dns_attribute" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id name = "dns_attribute" } -resource "aci_epg_useg_dns_attribute" "test_2" { +resource "aci_epg_useg_dns_attribute" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id name = "dns_attribute" - depends_on = [aci_epg_useg_dns_attribute.test] + depends_on = [aci_epg_useg_dns_attribute.allow_test] } ` @@ -238,11 +238,11 @@ resource "aci_epg_useg_dns_attribute" "test" { parent_dn = aci_epg_useg_block_statement.test.id name = "dns_attribute" annotation = "annotation" - description = "description" - filter = "filter" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + description = "description_1" + filter = "filter_1" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" } ` @@ -269,7 +269,7 @@ resource "aci_epg_useg_dns_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -279,7 +279,7 @@ resource "aci_epg_useg_dns_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -299,13 +299,13 @@ resource "aci_epg_useg_dns_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_ip_attribute.go b/internal/provider/resource_aci_epg_useg_ip_attribute.go index d8ce68bc1..223ccc876 100644 --- a/internal/provider/resource_aci_epg_useg_ip_attribute.go +++ b/internal/provider/resource_aci_epg_useg_ip_attribute.go @@ -14,6 +14,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -57,18 +58,59 @@ type FvIpAttrResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvIpAttrResourceModel() *FvIpAttrResourceModel { + return &FvIpAttrResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Ip: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + UsefvSubnet: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvIpAttrResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvIpAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvIpAttrResourceModel() TagAnnotationFvIpAttrResourceModel { + return TagAnnotationFvIpAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvIpAttrResourceModel describes the resource data model for the children without relation ships. type TagTagFvIpAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvIpAttrResourceModel() TagTagFvIpAttrResourceModel { + return TagTagFvIpAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvIpAttrIdentifier struct { Name types.String } @@ -131,6 +173,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg IP Attribute object.`, @@ -140,6 +183,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg IP Attribute object.`, }, @@ -147,6 +191,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The device IP address of the EPG uSeg IP Attribute object.`, }, @@ -154,6 +199,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The name of the EPG uSeg IP Attribute object.`, @@ -163,6 +209,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg IP Attribute object.`, }, @@ -171,6 +218,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -179,6 +227,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -187,6 +236,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("no", "yes"), @@ -431,6 +481,8 @@ func (r *FvIpAttrResource) ImportState(ctx context.Context, req resource.ImportS func getAndSetFvIpAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIpAttrResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvIpAttr,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvIpAttrResourceModel() + if diags.HasError() { return } @@ -477,7 +529,7 @@ func getAndSetFvIpAttrAttributes(ctx context.Context, diags *diag.Diagnostics, c for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvIpAttr := TagAnnotationFvIpAttrResourceModel{} + TagAnnotationFvIpAttr := getEmptyTagAnnotationFvIpAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvIpAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -489,7 +541,7 @@ func getAndSetFvIpAttrAttributes(ctx context.Context, diags *diag.Diagnostics, c TagAnnotationFvIpAttrList = append(TagAnnotationFvIpAttrList, TagAnnotationFvIpAttr) } if childClassName == "tagTag" { - TagTagFvIpAttr := TagTagFvIpAttrResourceModel{} + TagTagFvIpAttr := getEmptyTagTagFvIpAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvIpAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -556,10 +608,10 @@ func getFvIpAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diag tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -595,10 +647,10 @@ func getFvIpAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_ip_attribute_test.go b/internal/provider/resource_aci_epg_useg_ip_attribute_test.go index 352178dce..94a4c95e8 100644 --- a/internal/provider/resource_aci_epg_useg_ip_attribute_test.go +++ b/internal/provider/resource_aci_epg_useg_ip_attribute_test.go @@ -22,22 +22,22 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvIpAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_epg_subnet", "no"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "use_epg_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "use_epg_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "use_epg_subnet", "no"), ), }, }, @@ -66,22 +66,22 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvIpAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_epg_subnet", "no"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test_2", "use_epg_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test", "use_epg_subnet", "no"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.allow_test_2", "use_epg_subnet", "no"), ), }, }, @@ -113,11 +113,11 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "0.0.0.0"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", "owner_tag_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_epg_subnet", "yes"), ), }, @@ -167,11 +167,11 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -188,12 +188,12 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.#", "2"), ), }, @@ -203,10 +203,10 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.#", "1"), ), }, @@ -224,16 +224,16 @@ func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { } const testConfigFvIpAttrMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_ip_attribute" "test" { +resource "aci_epg_useg_ip_attribute" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id ip = "131.107.1.200" name = "131" } -resource "aci_epg_useg_ip_attribute" "test_2" { +resource "aci_epg_useg_ip_attribute" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id ip = "131.107.1.200" name = "131" - depends_on = [aci_epg_useg_ip_attribute.test] + depends_on = [aci_epg_useg_ip_attribute.allow_test] } ` @@ -250,11 +250,11 @@ resource "aci_epg_useg_ip_attribute" "test" { parent_dn = aci_epg_useg_block_statement.test.id name = "131" annotation = "annotation" - description = "description" + description = "description_1" ip = "0.0.0.0" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" use_epg_subnet = "yes" } ` @@ -284,7 +284,7 @@ resource "aci_epg_useg_ip_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -294,7 +294,7 @@ resource "aci_epg_useg_ip_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -316,13 +316,13 @@ resource "aci_epg_useg_ip_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_mac_attribute.go b/internal/provider/resource_aci_epg_useg_mac_attribute.go index bfaefb031..19144cb50 100644 --- a/internal/provider/resource_aci_epg_useg_mac_attribute.go +++ b/internal/provider/resource_aci_epg_useg_mac_attribute.go @@ -13,6 +13,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -54,18 +55,58 @@ type FvMacAttrResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvMacAttrResourceModel() *FvMacAttrResourceModel { + return &FvMacAttrResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Mac: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvMacAttrResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvMacAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvMacAttrResourceModel() TagAnnotationFvMacAttrResourceModel { + return TagAnnotationFvMacAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvMacAttrResourceModel describes the resource data model for the children without relation ships. type TagTagFvMacAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvMacAttrResourceModel() TagTagFvMacAttrResourceModel { + return TagTagFvMacAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvMacAttrIdentifier struct { Name types.String } @@ -128,6 +169,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg MAC Attribute object.`, @@ -137,6 +179,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg MAC Attribute object.`, }, @@ -144,6 +187,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The MAC address of the EPG uSeg MAC Attribute object.`, }, @@ -151,6 +195,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The name of the EPG uSeg MAC Attribute object.`, @@ -160,6 +205,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg MAC Attribute object.`, }, @@ -168,6 +214,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -176,6 +223,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -417,6 +465,8 @@ func (r *FvMacAttrResource) ImportState(ctx context.Context, req resource.Import func getAndSetFvMacAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvMacAttrResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvMacAttr,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvMacAttrResourceModel() + if diags.HasError() { return } @@ -460,7 +510,7 @@ func getAndSetFvMacAttrAttributes(ctx context.Context, diags *diag.Diagnostics, for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvMacAttr := TagAnnotationFvMacAttrResourceModel{} + TagAnnotationFvMacAttr := getEmptyTagAnnotationFvMacAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvMacAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -472,7 +522,7 @@ func getAndSetFvMacAttrAttributes(ctx context.Context, diags *diag.Diagnostics, TagAnnotationFvMacAttrList = append(TagAnnotationFvMacAttrList, TagAnnotationFvMacAttr) } if childClassName == "tagTag" { - TagTagFvMacAttr := TagTagFvMacAttrResourceModel{} + TagTagFvMacAttr := getEmptyTagTagFvMacAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvMacAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -539,10 +589,10 @@ func getFvMacAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Dia tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -578,10 +628,10 @@ func getFvMacAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostic tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_mac_attribute_test.go b/internal/provider/resource_aci_epg_useg_mac_attribute_test.go index 70d5ef3f6..1098ed01f 100644 --- a/internal/provider/resource_aci_epg_useg_mac_attribute_test.go +++ b/internal/provider/resource_aci_epg_useg_mac_attribute_test.go @@ -22,20 +22,20 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvMacAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -64,20 +64,20 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvMacAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.allow_test_2", "owner_tag", ""), ), }, }, @@ -108,11 +108,11 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:BB:BB:EE"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", "owner_tag_1"), ), }, // Update with minimum config and verify config is unchanged @@ -159,11 +159,11 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -180,12 +180,12 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.#", "2"), ), }, @@ -195,10 +195,10 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.#", "1"), ), }, @@ -216,16 +216,16 @@ func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { } const testConfigFvMacAttrMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_mac_attribute" "test" { +resource "aci_epg_useg_mac_attribute" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id mac = "AA:BB:CC:DD:EE:FF" name = "mac_attr" } -resource "aci_epg_useg_mac_attribute" "test_2" { +resource "aci_epg_useg_mac_attribute" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id mac = "AA:BB:CC:DD:EE:FF" name = "mac_attr" - depends_on = [aci_epg_useg_mac_attribute.test] + depends_on = [aci_epg_useg_mac_attribute.allow_test] } ` @@ -242,11 +242,11 @@ resource "aci_epg_useg_mac_attribute" "test" { parent_dn = aci_epg_useg_block_statement.test.id name = "mac_attr" annotation = "annotation" - description = "description" + description = "description_1" mac = "AA:BB:CC:BB:BB:EE" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" } ` @@ -274,7 +274,7 @@ resource "aci_epg_useg_mac_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -284,7 +284,7 @@ resource "aci_epg_useg_mac_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -306,13 +306,13 @@ resource "aci_epg_useg_mac_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_sub_block_statement.go b/internal/provider/resource_aci_epg_useg_sub_block_statement.go index a71f6d546..ce88b1af6 100644 --- a/internal/provider/resource_aci_epg_useg_sub_block_statement.go +++ b/internal/provider/resource_aci_epg_useg_sub_block_statement.go @@ -14,6 +14,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -56,18 +57,58 @@ type FvSCrtrnResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvSCrtrnResourceModel() *FvSCrtrnResourceModel { + return &FvSCrtrnResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Match: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvSCrtrnResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvSCrtrnResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvSCrtrnResourceModel() TagAnnotationFvSCrtrnResourceModel { + return TagAnnotationFvSCrtrnResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvSCrtrnResourceModel describes the resource data model for the children without relation ships. type TagTagFvSCrtrnResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvSCrtrnResourceModel() TagTagFvSCrtrnResourceModel { + return TagTagFvSCrtrnResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvSCrtrnIdentifier struct { Name types.String } @@ -130,6 +171,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg Sub Block Statement object.`, @@ -139,6 +181,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg Sub Block Statement object.`, }, @@ -147,6 +190,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("all", "any"), @@ -157,6 +201,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The name of the EPG uSeg Sub Block Statement object.`, @@ -166,6 +211,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg Sub Block Statement object.`, }, @@ -174,6 +220,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -182,6 +229,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -423,6 +471,8 @@ func (r *FvSCrtrnResource) ImportState(ctx context.Context, req resource.ImportS func getAndSetFvSCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvSCrtrnResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvSCrtrn,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvSCrtrnResourceModel() + if diags.HasError() { return } @@ -466,7 +516,7 @@ func getAndSetFvSCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, c for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvSCrtrn := TagAnnotationFvSCrtrnResourceModel{} + TagAnnotationFvSCrtrn := getEmptyTagAnnotationFvSCrtrnResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvSCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -478,7 +528,7 @@ func getAndSetFvSCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, c TagAnnotationFvSCrtrnList = append(TagAnnotationFvSCrtrnList, TagAnnotationFvSCrtrn) } if childClassName == "tagTag" { - TagTagFvSCrtrn := TagTagFvSCrtrnResourceModel{} + TagTagFvSCrtrn := getEmptyTagTagFvSCrtrnResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvSCrtrn.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -545,10 +595,10 @@ func getFvSCrtrnTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diag tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -584,10 +634,10 @@ func getFvSCrtrnTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_sub_block_statement_test.go b/internal/provider/resource_aci_epg_useg_sub_block_statement_test.go index 0e1556b9d..611903452 100644 --- a/internal/provider/resource_aci_epg_useg_sub_block_statement_test.go +++ b/internal/provider/resource_aci_epg_useg_sub_block_statement_test.go @@ -22,20 +22,20 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { Config: testConfigFvSCrtrnMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_tag", ""), ), }, }, @@ -64,20 +64,20 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { Config: testConfigFvSCrtrnMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_tag", ""), ), }, }, @@ -108,11 +108,11 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name", "sub_criterion"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "all"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", "owner_tag_1"), ), }, // Update with minimum config and verify config is unchanged @@ -158,11 +158,11 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -179,12 +179,12 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.#", "2"), ), }, @@ -194,10 +194,10 @@ func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.#", "1"), ), }, @@ -224,20 +224,20 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { Config: testConfigFvSCrtrnMinDependencyWithFvSCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_tag", ""), ), }, }, @@ -266,20 +266,20 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { Config: testConfigFvSCrtrnMinDependencyWithFvSCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_0", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.allow_test_2", "owner_tag", ""), ), }, }, @@ -310,11 +310,11 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "name", "sub_criterion"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "match", "all"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "name_alias", "name_alias_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "owner_tag", "owner_tag_1"), ), }, // Update with minimum config and verify config is unchanged @@ -360,11 +360,11 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -381,12 +381,12 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.#", "2"), ), }, @@ -396,10 +396,10 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test_1", "tags.#", "1"), ), }, @@ -417,14 +417,14 @@ func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { } const testConfigFvSCrtrnMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_sub_block_statement" "test" { +resource "aci_epg_useg_sub_block_statement" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id name = "sub_criterion" } -resource "aci_epg_useg_sub_block_statement" "test_2" { +resource "aci_epg_useg_sub_block_statement" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id name = "sub_criterion" - depends_on = [aci_epg_useg_sub_block_statement.test] + depends_on = [aci_epg_useg_sub_block_statement.allow_test] } ` @@ -440,11 +440,11 @@ resource "aci_epg_useg_sub_block_statement" "test" { parent_dn = aci_epg_useg_block_statement.test.id name = "sub_criterion" annotation = "annotation" - description = "description" + description = "description_1" match = "all" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" } ` @@ -471,7 +471,7 @@ resource "aci_epg_useg_sub_block_statement" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -481,7 +481,7 @@ resource "aci_epg_useg_sub_block_statement" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -501,13 +501,13 @@ resource "aci_epg_useg_sub_block_statement" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -523,14 +523,14 @@ resource "aci_epg_useg_sub_block_statement" "test" { ` const testConfigFvSCrtrnMinDependencyWithFvSCrtrnAllowExisting = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` -resource "aci_epg_useg_sub_block_statement" "test_0" { +resource "aci_epg_useg_sub_block_statement" "allow_test" { parent_dn = aci_epg_useg_sub_block_statement.test.id name = "sub_criterion" } -resource "aci_epg_useg_sub_block_statement" "test_2" { +resource "aci_epg_useg_sub_block_statement" "allow_test_2" { parent_dn = aci_epg_useg_sub_block_statement.test.id name = "sub_criterion" - depends_on = [aci_epg_useg_sub_block_statement.test_0] + depends_on = [aci_epg_useg_sub_block_statement.allow_test] } ` @@ -546,11 +546,11 @@ resource "aci_epg_useg_sub_block_statement" "test_1" { parent_dn = aci_epg_useg_sub_block_statement.test.id name = "sub_criterion" annotation = "annotation" - description = "description" + description = "description_1" match = "all" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" + name_alias = "name_alias_1" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" } ` @@ -577,7 +577,7 @@ resource "aci_epg_useg_sub_block_statement" "test_1" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -587,7 +587,7 @@ resource "aci_epg_useg_sub_block_statement" "test_1" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -607,13 +607,13 @@ resource "aci_epg_useg_sub_block_statement" "test_1" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } diff --git a/internal/provider/resource_aci_epg_useg_vm_attribute.go b/internal/provider/resource_aci_epg_useg_vm_attribute.go index fe5606a30..3dfbc1bea 100644 --- a/internal/provider/resource_aci_epg_useg_vm_attribute.go +++ b/internal/provider/resource_aci_epg_useg_vm_attribute.go @@ -14,6 +14,7 @@ import ( "github.com/ciscoecosystem/aci-go-client/v2/client" "github.com/ciscoecosystem/aci-go-client/v2/container" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" "github.com/hashicorp/terraform-plugin-framework/diag" "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" @@ -60,18 +61,62 @@ type FvVmAttrResourceModel struct { TagTag types.Set `tfsdk:"tags"` } +func getEmptyFvVmAttrResourceModel() *FvVmAttrResourceModel { + return &FvVmAttrResourceModel{ + Id: basetypes.NewStringNull(), + ParentDn: basetypes.NewStringNull(), + Annotation: basetypes.NewStringNull(), + Category: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + LabelName: basetypes.NewStringNull(), + Name: basetypes.NewStringNull(), + NameAlias: basetypes.NewStringNull(), + Operator: basetypes.NewStringNull(), + OwnerKey: basetypes.NewStringNull(), + OwnerTag: basetypes.NewStringNull(), + Type: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + TagAnnotation: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + TagTag: types.SetNull(types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": types.StringType, + "value": types.StringType, + }, + }), + } +} + // TagAnnotationFvVmAttrResourceModel describes the resource data model for the children without relation ships. type TagAnnotationFvVmAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagAnnotationFvVmAttrResourceModel() TagAnnotationFvVmAttrResourceModel { + return TagAnnotationFvVmAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + // TagTagFvVmAttrResourceModel describes the resource data model for the children without relation ships. type TagTagFvVmAttrResourceModel struct { Key types.String `tfsdk:"key"` Value types.String `tfsdk:"value"` } +func getEmptyTagTagFvVmAttrResourceModel() TagTagFvVmAttrResourceModel { + return TagTagFvVmAttrResourceModel{ + Key: basetypes.NewStringNull(), + Value: basetypes.NewStringNull(), + } +} + type FvVmAttrIdentifier struct { Name types.String } @@ -134,6 +179,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Default: stringdefault.StaticString(globalAnnotation), MarkdownDescription: `The annotation of the EPG uSeg VM Attribute object.`, @@ -143,6 +189,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The category of the EPG uSeg VM Attribute object.`, }, @@ -151,6 +198,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The description of the EPG uSeg VM Attribute object.`, }, @@ -159,6 +207,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The label name of the EPG uSeg VM Attribute object.`, }, @@ -166,6 +215,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), stringplanmodifier.RequiresReplace(), }, MarkdownDescription: `The name of the EPG uSeg VM Attribute object.`, @@ -175,6 +225,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The name alias of the EPG uSeg VM Attribute object.`, }, @@ -183,6 +234,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("contains", "endsWith", "equals", "notEquals", "startsWith"), @@ -194,6 +246,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, }, @@ -202,6 +255,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, }, @@ -210,6 +264,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Computed: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, Validators: []validator.String{ stringvalidator.OneOf("custom-label", "domain", "guest-os", "hv", "rootContName", "tag", "vm", "vm-folder", "vm-name", "vmfolder-path", "vnic"), @@ -220,6 +275,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), + SetToStringNullWhenStateIsNullPlanIsUnknownDuringUpdate(), }, MarkdownDescription: `The value of the EPG uSeg VM Attribute object.`, }, @@ -461,6 +517,8 @@ func (r *FvVmAttrResource) ImportState(ctx context.Context, req resource.ImportS func getAndSetFvVmAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvVmAttrResourceModel) { requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvVmAttr,tagAnnotation,tagTag"), "GET", nil) + *data = *getEmptyFvVmAttrResourceModel() + if diags.HasError() { return } @@ -516,7 +574,7 @@ func getAndSetFvVmAttrAttributes(ctx context.Context, diags *diag.Diagnostics, c for childClassName, childClassDetails := range child.(map[string]interface{}) { childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) if childClassName == "tagAnnotation" { - TagAnnotationFvVmAttr := TagAnnotationFvVmAttrResourceModel{} + TagAnnotationFvVmAttr := getEmptyTagAnnotationFvVmAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagAnnotationFvVmAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -528,7 +586,7 @@ func getAndSetFvVmAttrAttributes(ctx context.Context, diags *diag.Diagnostics, c TagAnnotationFvVmAttrList = append(TagAnnotationFvVmAttrList, TagAnnotationFvVmAttr) } if childClassName == "tagTag" { - TagTagFvVmAttr := TagTagFvVmAttrResourceModel{} + TagTagFvVmAttr := getEmptyTagTagFvVmAttrResourceModel() for childAttributeName, childAttributeValue := range childAttributes { if childAttributeName == "key" { TagTagFvVmAttr.Key = basetypes.NewStringValue(childAttributeValue.(string)) @@ -595,10 +653,10 @@ func getFvVmAttrTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diag tagAnnotationIdentifiers := []TagAnnotationIdentifier{} for _, tagAnnotation := range tagAnnotationPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagAnnotation.Key.IsUnknown() { + if !tagAnnotation.Key.IsUnknown() && !tagAnnotation.Key.IsNull() { childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() } - if !tagAnnotation.Value.IsUnknown() { + if !tagAnnotation.Value.IsUnknown() && !tagAnnotation.Value.IsNull() { childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) @@ -634,10 +692,10 @@ func getFvVmAttrTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics tagTagIdentifiers := []TagTagIdentifier{} for _, tagTag := range tagTagPlan { childMap := map[string]map[string]interface{}{"attributes": {}} - if !tagTag.Key.IsUnknown() { + if !tagTag.Key.IsUnknown() && !tagTag.Key.IsNull() { childMap["attributes"]["key"] = tagTag.Key.ValueString() } - if !tagTag.Value.IsUnknown() { + if !tagTag.Value.IsUnknown() && !tagTag.Value.IsNull() { childMap["attributes"]["value"] = tagTag.Value.ValueString() } childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) diff --git a/internal/provider/resource_aci_epg_useg_vm_attribute_test.go b/internal/provider/resource_aci_epg_useg_vm_attribute_test.go index 1d7e61d7f..7791b85b5 100644 --- a/internal/provider/resource_aci_epg_useg_vm_attribute_test.go +++ b/internal/provider/resource_aci_epg_useg_vm_attribute_test.go @@ -22,28 +22,28 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvVmAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "value", "default_value"), ), }, }, @@ -72,28 +72,28 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvVmAttrMinDependencyWithFvCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "value", "default_value"), ), }, }, @@ -129,12 +129,12 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "annotation"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", "all_category"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", "label_name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "contains"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", "owner_tag_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "domain"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "all_value"), ), @@ -191,11 +191,11 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -212,12 +212,12 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "2"), ), }, @@ -227,10 +227,10 @@ func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "1"), ), }, @@ -257,28 +257,28 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { Config: testConfigFvVmAttrMinDependencyWithFvSCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "value", "default_value"), ), }, }, @@ -307,28 +307,28 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { Config: testConfigFvVmAttrMinDependencyWithFvSCrtrnAllowExisting, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test_2", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.allow_test_2", "value", "default_value"), ), }, }, @@ -364,12 +364,12 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "annotation"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", "all_category"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", "description_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", "label_name"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "contains"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", "owner_key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", "owner_tag_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "domain"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "all_value"), ), @@ -426,11 +426,11 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "test_value"), ), }, // Import testing with children @@ -447,12 +447,12 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "2"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_0"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.1.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "2"), ), }, @@ -462,10 +462,10 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "1"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.0.value", "test_value"), resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "1"), ), }, @@ -483,16 +483,16 @@ func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { } const testConfigFvVmAttrMinDependencyWithFvCrtrnAllowExisting = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -resource "aci_epg_useg_vm_attribute" "test" { +resource "aci_epg_useg_vm_attribute" "allow_test" { parent_dn = aci_epg_useg_block_statement.test.id name = "vm_attribute" value = "default_value" } -resource "aci_epg_useg_vm_attribute" "test_2" { +resource "aci_epg_useg_vm_attribute" "allow_test_2" { parent_dn = aci_epg_useg_block_statement.test.id name = "vm_attribute" value = "default_value" - depends_on = [aci_epg_useg_vm_attribute.test] + depends_on = [aci_epg_useg_vm_attribute.allow_test] } ` @@ -510,12 +510,12 @@ resource "aci_epg_useg_vm_attribute" "test" { name = "vm_attribute" annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "all_value" } @@ -549,7 +549,7 @@ resource "aci_epg_useg_vm_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -559,7 +559,7 @@ resource "aci_epg_useg_vm_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -581,13 +581,13 @@ resource "aci_epg_useg_vm_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -604,16 +604,16 @@ resource "aci_epg_useg_vm_attribute" "test" { ` const testConfigFvVmAttrMinDependencyWithFvSCrtrnAllowExisting = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` -resource "aci_epg_useg_vm_attribute" "test" { +resource "aci_epg_useg_vm_attribute" "allow_test" { parent_dn = aci_epg_useg_sub_block_statement.test.id name = "vm_attribute" value = "default_value" } -resource "aci_epg_useg_vm_attribute" "test_2" { +resource "aci_epg_useg_vm_attribute" "allow_test_2" { parent_dn = aci_epg_useg_sub_block_statement.test.id name = "vm_attribute" value = "default_value" - depends_on = [aci_epg_useg_vm_attribute.test] + depends_on = [aci_epg_useg_vm_attribute.allow_test] } ` @@ -631,12 +631,12 @@ resource "aci_epg_useg_vm_attribute" "test" { name = "vm_attribute" annotation = "annotation" category = "all_category" - description = "description" + description = "description_1" label_name = "label_name" - name_alias = "name_alias" + name_alias = "name_alias_1" operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" + owner_key = "owner_key_1" + owner_tag = "owner_tag_1" type = "domain" value = "all_value" } @@ -670,7 +670,7 @@ resource "aci_epg_useg_vm_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ @@ -680,7 +680,7 @@ resource "aci_epg_useg_vm_attribute" "test" { }, { key = "key_1" - value = "value_2" + value = "test_value" }, ] } @@ -702,13 +702,13 @@ resource "aci_epg_useg_vm_attribute" "test" { annotations = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] tags = [ { key = "key_1" - value = "value_2" + value = "test_value" }, ] }