diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index b421b2c3e..ce2256e17 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -55,19 +55,19 @@ data "aci_annotation" "example_application_epg" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) + - [aci_epg_useg_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) + - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/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)) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) diff --git a/docs/data-sources/epg_useg_criterion_identity_group_attribute.md b/docs/data-sources/epg_useg_ad_group_attribute.md similarity index 66% rename from docs/data-sources/epg_useg_criterion_identity_group_attribute.md rename to docs/data-sources/epg_useg_ad_group_attribute.md index 9b82dc4f1..3925fcf9e 100644 --- a/docs/data-sources/epg_useg_criterion_identity_group_attribute.md +++ b/docs/data-sources/epg_useg_ad_group_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_identity_group_attribute" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_identity_group_attribute" +page_title: "ACI: aci_epg_useg_ad_group_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_ad_group_attribute" description: |- - Data source for EPG uSeg Criterion Identity Group Attribute + Data source for EPG uSeg AD Group Attribute --- -# aci_epg_useg_criterion_identity_group_attribute # +# aci_epg_useg_ad_group_attribute # -Data source for EPG uSeg Criterion Identity Group Attribute +Data source for EPG uSeg AD Group Attribute ## API Information ## @@ -30,8 +30,8 @@ Data source for EPG uSeg Criterion Identity Group Attribute ```hcl -data "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_ad_group_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" } @@ -42,16 +42,16 @@ data "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criteri ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `selector` (selector) - (string) The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `selector` (selector) - (string) The selector of the EPG uSeg AD Group Attribute object. Represents the DN or expression to select an identity group. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion Identity Group Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion Identity Group Attribute object. -* `name` (name) - (string) The name of the EPG uSeg Criterion Identity Group Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion Identity Group Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg AD Group Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg AD Group Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg AD Group Attribute object. +* `name` (name) - (string) The name of the EPG uSeg AD Group Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg AD Group Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. diff --git a/docs/data-sources/epg_useg_criterion.md b/docs/data-sources/epg_useg_block_statement.md similarity index 78% rename from docs/data-sources/epg_useg_criterion.md rename to docs/data-sources/epg_useg_block_statement.md index efa84414f..2c5c660cb 100644 --- a/docs/data-sources/epg_useg_criterion.md +++ b/docs/data-sources/epg_useg_block_statement.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion" +page_title: "ACI: aci_epg_useg_block_statement" +sidebar_current: "docs-aci-data-source-aci_epg_useg_block_statement" description: |- - Data source for EPG uSeg Criterion + Data source for EPG uSeg Block Statement --- -# aci_epg_useg_criterion # +# aci_epg_useg_block_statement # -Data source for EPG uSeg Criterion +Data source for EPG uSeg Block Statement ## API Information ## @@ -30,7 +30,7 @@ Data source for EPG uSeg Criterion ```hcl -data "aci_epg_useg_criterion" "example_application_epg" { +data "aci_epg_useg_block_statement" "example_application_epg" { parent_dn = aci_application_epg.example.id } @@ -45,16 +45,16 @@ data "aci_epg_useg_criterion" "example_application_epg" { ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion object. -* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Criterion object. -* `name` (name) - (string) The name of the EPG uSeg Criterion object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg Block Statement object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Block Statement object. +* `description` (descr) - (string) The description of the EPG uSeg Block Statement object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Block Statement object. +* `name` (name) - (string) The name of the EPG uSeg Block Statement object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Block Statement object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `precedence` (prec) - (string) The precedence of the EPG uSeg Criterion object. -* `scope` (scope) - (string) The scope of the EPG uSeg Criterion object. +* `precedence` (prec) - (string) The precedence of the EPG uSeg Block Statement object. +* `scope` (scope) - (string) The scope of the EPG uSeg Block Statement object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. * `key` (key) - (string) The key used to uniquely identify this configuration object. diff --git a/docs/data-sources/epg_useg_criterion_dns_attribute.md b/docs/data-sources/epg_useg_dns_attribute.md similarity index 70% rename from docs/data-sources/epg_useg_criterion_dns_attribute.md rename to docs/data-sources/epg_useg_dns_attribute.md index 2aeb72480..917ef0bb6 100644 --- a/docs/data-sources/epg_useg_criterion_dns_attribute.md +++ b/docs/data-sources/epg_useg_dns_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_dns_attribute" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_dns_attribute" +page_title: "ACI: aci_epg_useg_dns_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_dns_attribute" description: |- - Data source for EPG uSeg Criterion DNS Attribute + Data source for EPG uSeg DNS Attribute --- -# aci_epg_useg_criterion_dns_attribute # +# aci_epg_useg_dns_attribute # -Data source for EPG uSeg Criterion DNS Attribute +Data source for EPG uSeg DNS Attribute ## API Information ## @@ -30,8 +30,8 @@ Data source for EPG uSeg Criterion DNS Attribute ```hcl -data "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_dns_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "dns_attribute" } @@ -42,16 +42,16 @@ data "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion DNS Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg DNS Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion DNS Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion DNS Attribute object. -* `filter` (filter) - (string) The domain name filter of the EPG uSeg Criterion DNS Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion DNS Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg DNS Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg DNS Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg DNS Attribute object. +* `filter` (filter) - (string) The domain name filter of the EPG uSeg DNS Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg DNS Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. diff --git a/docs/data-sources/epg_useg_criterion_ip_attribute.md b/docs/data-sources/epg_useg_ip_attribute.md similarity index 68% rename from docs/data-sources/epg_useg_criterion_ip_attribute.md rename to docs/data-sources/epg_useg_ip_attribute.md index 1e5b1d6e1..3fabb8068 100644 --- a/docs/data-sources/epg_useg_criterion_ip_attribute.md +++ b/docs/data-sources/epg_useg_ip_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_ip_attribute" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_ip_attribute" +page_title: "ACI: aci_epg_useg_ip_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_ip_attribute" description: |- - Data source for EPG uSeg Criterion IP Attribute + Data source for EPG uSeg IP Attribute --- -# aci_epg_useg_criterion_ip_attribute # +# aci_epg_useg_ip_attribute # -Data source for EPG uSeg Criterion IP Attribute +Data source for EPG uSeg IP Attribute ## API Information ## @@ -30,8 +30,8 @@ Data source for EPG uSeg Criterion IP Attribute ```hcl -data "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_ip_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "131" } @@ -42,19 +42,19 @@ data "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion IP Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg IP Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion IP Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion IP Attribute object. -* `ip` (ip) - (string) The device IP address of the EPG uSeg Criterion IP Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion IP Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg IP Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg IP Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg IP Attribute object. +* `ip` (ip) - (string) The device IP address of the EPG uSeg IP Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg IP Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object. +* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg IP Attribute object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. * `key` (key) - (string) The key used to uniquely identify this configuration object. diff --git a/docs/data-sources/epg_useg_criterion_mac_attribute.md b/docs/data-sources/epg_useg_mac_attribute.md similarity index 68% rename from docs/data-sources/epg_useg_criterion_mac_attribute.md rename to docs/data-sources/epg_useg_mac_attribute.md index bf84963de..00e0c0071 100644 --- a/docs/data-sources/epg_useg_criterion_mac_attribute.md +++ b/docs/data-sources/epg_useg_mac_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_mac_attribute" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_mac_attribute" +page_title: "ACI: aci_epg_useg_mac_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_mac_attribute" description: |- - Data source for EPG uSeg Criterion MAC Attribute + Data source for EPG uSeg MAC Attribute --- -# aci_epg_useg_criterion_mac_attribute # +# aci_epg_useg_mac_attribute # -Data source for EPG uSeg Criterion MAC Attribute +Data source for EPG uSeg MAC Attribute ## API Information ## @@ -30,8 +30,8 @@ Data source for EPG uSeg Criterion MAC Attribute ```hcl -data "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_mac_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "mac_attr" } @@ -42,16 +42,16 @@ data "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion MAC Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg MAC Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion MAC Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion MAC Attribute object. -* `mac` (mac) - (string) The MAC address of the EPG uSeg Criterion MAC Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion MAC Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg MAC Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg MAC Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg MAC Attribute object. +* `mac` (mac) - (string) The MAC address of the EPG uSeg MAC Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg MAC Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. diff --git a/docs/data-sources/epg_useg_sub_criterion.md b/docs/data-sources/epg_useg_sub_block_statement.md similarity index 63% rename from docs/data-sources/epg_useg_sub_criterion.md rename to docs/data-sources/epg_useg_sub_block_statement.md index d4766e02d..264c72a2c 100644 --- a/docs/data-sources/epg_useg_sub_criterion.md +++ b/docs/data-sources/epg_useg_sub_block_statement.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_sub_criterion" -sidebar_current: "docs-aci-data-source-aci_epg_useg_sub_criterion" +page_title: "ACI: aci_epg_useg_sub_block_statement" +sidebar_current: "docs-aci-data-source-aci_epg_useg_sub_block_statement" description: |- - Data source for EPG uSeg Sub Criterion + Data source for EPG uSeg Sub Block Statement --- -# aci_epg_useg_sub_criterion # +# aci_epg_useg_sub_block_statement # -Data source for EPG uSeg Sub Criterion +Data source for EPG uSeg Sub Block Statement ## API Information ## @@ -30,8 +30,13 @@ Data source for EPG uSeg Sub Criterion ```hcl -data "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_sub_block_statement" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "sub_criterion" +} + +data "aci_epg_useg_sub_block_statement" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id name = "sub_criterion" } @@ -42,16 +47,17 @@ data "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Sub Criterion object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Sub Block Statement object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Criterion object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Criterion object. -* `description` (descr) - (string) The description of the EPG uSeg Sub Criterion object. -* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Criterion object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Criterion object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Block Statement object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Block Statement object. +* `description` (descr) - (string) The description of the EPG uSeg Sub Block Statement object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Block Statement object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Block Statement object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. diff --git a/docs/data-sources/epg_useg_criterion_vm_attribute.md b/docs/data-sources/epg_useg_vm_attribute.md similarity index 61% rename from docs/data-sources/epg_useg_criterion_vm_attribute.md rename to docs/data-sources/epg_useg_vm_attribute.md index ba95cdf91..9eac43a9c 100644 --- a/docs/data-sources/epg_useg_criterion_vm_attribute.md +++ b/docs/data-sources/epg_useg_vm_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_vm_attribute" -sidebar_current: "docs-aci-data-source-aci_epg_useg_criterion_vm_attribute" +page_title: "ACI: aci_epg_useg_vm_attribute" +sidebar_current: "docs-aci-data-source-aci_epg_useg_vm_attribute" description: |- - Data source for EPG uSeg Criterion VM Attribute + Data source for EPG uSeg VM Attribute --- -# aci_epg_useg_criterion_vm_attribute # +# aci_epg_useg_vm_attribute # -Data source for EPG uSeg Criterion VM Attribute +Data source for EPG uSeg VM Attribute ## API Information ## @@ -32,13 +32,13 @@ Data source for EPG uSeg Criterion VM Attribute ```hcl -data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +data "aci_epg_useg_vm_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "vm_attribute" } -data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id +data "aci_epg_useg_vm_attribute" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id name = "vm_attribute" } @@ -49,23 +49,23 @@ data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion VM Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg VM Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object. -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion VM Attribute object. -* `category` (category) - (string) The category of the EPG uSeg Criterion VM Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion VM Attribute object. -* `label_name` (labelName) - (string) The label name of the EPG uSeg Criterion VM Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion VM Attribute object. -* `operator` (operator) - (string) The operator of the EPG uSeg Criterion VM Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg VM Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg VM Attribute object. +* `category` (category) - (string) The category of the EPG uSeg VM Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg VM Attribute object. +* `label_name` (labelName) - (string) The label name of the EPG uSeg VM Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg VM Attribute object. +* `operator` (operator) - (string) The operator of the EPG uSeg VM Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `type` (type) - (string) The type of the EPG uSeg Criterion VM Attribute object. -* `value` (value) - (string) The value of the EPG uSeg Criterion VM Attribute object. +* `type` (type) - (string) The type of the EPG uSeg VM Attribute object. +* `value` (value) - (string) The value of the EPG uSeg VM Attribute object. * `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). This attribute is supported in ACI versions: 3.2(1l) and later. * `key` (key) - (string) The key used to uniquely identify this configuration object. diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 93a5b34e4..d73b55932 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -55,19 +55,19 @@ data "aci_tag" "example_application_epg" { * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) + - [aci_epg_useg_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) + - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/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)) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index d27e94329..7d8001b02 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -64,19 +64,19 @@ All examples for the Annotation resource can be found in the [examples](https:// * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) + - [aci_epg_useg_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) + - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/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)) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) diff --git a/docs/resources/epg_useg_criterion_identity_group_attribute.md b/docs/resources/epg_useg_ad_group_attribute.md similarity index 60% rename from docs/resources/epg_useg_criterion_identity_group_attribute.md rename to docs/resources/epg_useg_ad_group_attribute.md index 55ede7363..6614d6077 100644 --- a/docs/resources/epg_useg_criterion_identity_group_attribute.md +++ b/docs/resources/epg_useg_ad_group_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_identity_group_attribute" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_identity_group_attribute" +page_title: "ACI: aci_epg_useg_ad_group_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_ad_group_attribute" description: |- - Manages ACI EPG uSeg Criterion Identity Group Attribute + Manages ACI EPG uSeg AD Group Attribute --- -# aci_epg_useg_criterion_identity_group_attribute # +# aci_epg_useg_ad_group_attribute # -Manages ACI EPG uSeg Criterion Identity Group Attribute +Manages ACI EPG uSeg AD Group Attribute @@ -30,24 +30,24 @@ Manages ACI EPG uSeg Criterion Identity Group Attribute ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion Identity Group Attribute with only required attributes. +The configuration snippet below creates a EPG uSeg AD Group Attribute with only required attributes. ```hcl -resource "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_ad_group_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion Identity Group Attribute. +The configuration snippet below shows all possible attributes of the EPG uSeg AD Group Attribute. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion_identity_group_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" @@ -71,27 +71,27 @@ resource "aci_epg_useg_criterion_identity_group_attribute" "full_example_epg_use ``` -All examples for the EPG uSeg Criterion Identity Group Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_identity_group_attribute) folder. +All examples for the EPG uSeg AD Group Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_ad_group_attribute) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `selector` (selector) - (string) The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `selector` (selector) - (string) The selector of the EPG uSeg AD Group Attribute object. Represents the DN or expression to select an identity group. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg AD Group Attribute object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion Identity Group Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg AD Group Attribute object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Criterion Identity Group Attribute object. -* `name` (name) - (string) The name of the EPG uSeg Criterion Identity Group Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion Identity Group Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg AD Group Attribute object. +* `name` (name) - (string) The name of the EPG uSeg AD Group Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg AD Group Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. @@ -111,18 +111,18 @@ All examples for the EPG uSeg Criterion Identity Group Attribute resource can be ## Importing -An existing EPG uSeg Criterion Identity Group Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg AD Group Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion_identity_group_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}] +terraform import aci_epg_useg_ad_group_attribute.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}] ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion Identity Group Attribute can be imported +Starting in Terraform version 1.5, an existing EPG uSeg AD Group Attribute can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]" - to = aci_epg_useg_criterion_identity_group_attribute.example_epg_useg_criterion + to = aci_epg_useg_ad_group_attribute.example_epg_useg_block_statement } ``` diff --git a/docs/resources/epg_useg_criterion.md b/docs/resources/epg_useg_block_statement.md similarity index 63% rename from docs/resources/epg_useg_criterion.md rename to docs/resources/epg_useg_block_statement.md index 9bcd91170..4a4ccf40a 100644 --- a/docs/resources/epg_useg_criterion.md +++ b/docs/resources/epg_useg_block_statement.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion" +page_title: "ACI: aci_epg_useg_block_statement" +sidebar_current: "docs-aci-resource-aci_epg_useg_block_statement" description: |- - Manages ACI EPG uSeg Criterion + Manages ACI EPG uSeg Block Statement --- -# aci_epg_useg_criterion # +# aci_epg_useg_block_statement # -Manages ACI EPG uSeg Criterion +Manages ACI EPG uSeg Block Statement @@ -30,22 +30,22 @@ Manages ACI EPG uSeg Criterion ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion with only required attributes. +The configuration snippet below creates a EPG uSeg Block Statement with only required attributes. ```hcl -resource "aci_epg_useg_criterion" "example_application_epg" { +resource "aci_epg_useg_block_statement" "example_application_epg" { parent_dn = aci_application_epg.example.id } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion. +The configuration snippet below shows all possible attributes of the EPG uSeg Block Statement. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion" "full_example_application_epg" { +resource "aci_epg_useg_block_statement" "full_example_application_epg" { parent_dn = aci_application_epg.example.id annotation = "annotation" description = "description" @@ -72,7 +72,7 @@ resource "aci_epg_useg_criterion" "full_example_application_epg" { ``` -All examples for the EPG uSeg Criterion resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion) folder. +All examples for the EPG uSeg Block Statement resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_block_statement) folder. ## Schema ## @@ -83,22 +83,22 @@ All examples for the EPG uSeg Criterion resource can be found in the [examples]( ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg Block Statement object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Block Statement object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Criterion object. -* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Criterion object. +* `description` (descr) - (string) The description of the EPG uSeg Block Statement object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Block Statement object. - Default: `any` - Valid Values: `all`, `any`. -* `name` (name) - (string) The name of the EPG uSeg Criterion object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion object. +* `name` (name) - (string) The name of the EPG uSeg Block Statement object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Block Statement object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `precedence` (prec) - (string) The precedence of the EPG uSeg Criterion object. -* `scope` (scope) - (string) The scope of the EPG uSeg Criterion object. +* `precedence` (prec) - (string) The precedence of the EPG uSeg Block Statement object. +* `scope` (scope) - (string) The scope of the EPG uSeg Block Statement object. - Default: `scope-bd` - Valid Values: `scope-bd`, `scope-vrf`. @@ -118,26 +118,26 @@ All examples for the EPG uSeg Criterion resource can be found in the [examples]( ## Importing -An existing EPG uSeg Criterion can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg Block Statement can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/crtrn +terraform import aci_epg_useg_block_statement.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/crtrn ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion can be imported +Starting in Terraform version 1.5, an existing EPG uSeg Block Statement can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn" - to = aci_epg_useg_criterion.example_application_epg + to = aci_epg_useg_block_statement.example_application_epg } ``` ## Child Resources - - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) \ No newline at end of file + - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) \ No newline at end of file diff --git a/docs/resources/epg_useg_criterion_dns_attribute.md b/docs/resources/epg_useg_dns_attribute.md similarity index 63% rename from docs/resources/epg_useg_criterion_dns_attribute.md rename to docs/resources/epg_useg_dns_attribute.md index 4d5504522..26816ff74 100644 --- a/docs/resources/epg_useg_criterion_dns_attribute.md +++ b/docs/resources/epg_useg_dns_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_dns_attribute" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_dns_attribute" +page_title: "ACI: aci_epg_useg_dns_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_dns_attribute" description: |- - Manages ACI EPG uSeg Criterion DNS Attribute + Manages ACI EPG uSeg DNS Attribute --- -# aci_epg_useg_criterion_dns_attribute # +# aci_epg_useg_dns_attribute # -Manages ACI EPG uSeg Criterion DNS Attribute +Manages ACI EPG uSeg DNS Attribute @@ -30,24 +30,24 @@ Manages ACI EPG uSeg Criterion DNS Attribute ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion DNS Attribute with only required attributes. +The configuration snippet below creates a EPG uSeg DNS Attribute with only required attributes. ```hcl -resource "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_dns_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "dns_attribute" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion DNS Attribute. +The configuration snippet below shows all possible attributes of the EPG uSeg DNS Attribute. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion_dns_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" @@ -71,27 +71,27 @@ resource "aci_epg_useg_criterion_dns_attribute" "full_example_epg_useg_criterion ``` -All examples for the EPG uSeg Criterion DNS Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_dns_attribute) folder. +All examples for the EPG uSeg DNS Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_dns_attribute) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion DNS Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg DNS Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg DNS Attribute object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion DNS Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg DNS Attribute object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Criterion DNS Attribute object. -* `filter` (filter) - (string) The domain name filter of the EPG uSeg Criterion DNS Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion DNS Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg DNS Attribute object. +* `filter` (filter) - (string) The domain name filter of the EPG uSeg DNS Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg DNS Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. @@ -111,18 +111,18 @@ All examples for the EPG uSeg Criterion DNS Attribute resource can be found in t ## Importing -An existing EPG uSeg Criterion DNS Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg DNS Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion_dns_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name} +terraform import aci_epg_useg_dns_attribute.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name} ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion DNS Attribute can be imported +Starting in Terraform version 1.5, an existing EPG uSeg DNS Attribute can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}" - to = aci_epg_useg_criterion_dns_attribute.example_epg_useg_criterion + to = aci_epg_useg_dns_attribute.example_epg_useg_block_statement } ``` diff --git a/docs/resources/epg_useg_criterion_ip_attribute.md b/docs/resources/epg_useg_ip_attribute.md similarity index 63% rename from docs/resources/epg_useg_criterion_ip_attribute.md rename to docs/resources/epg_useg_ip_attribute.md index 54217f68d..3f2b53c98 100644 --- a/docs/resources/epg_useg_criterion_ip_attribute.md +++ b/docs/resources/epg_useg_ip_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_ip_attribute" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_ip_attribute" +page_title: "ACI: aci_epg_useg_ip_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_ip_attribute" description: |- - Manages ACI EPG uSeg Criterion IP Attribute + Manages ACI EPG uSeg IP Attribute --- -# aci_epg_useg_criterion_ip_attribute # +# aci_epg_useg_ip_attribute # -Manages ACI EPG uSeg Criterion IP Attribute +Manages ACI EPG uSeg IP Attribute @@ -30,25 +30,25 @@ Manages ACI EPG uSeg Criterion IP Attribute ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion IP Attribute with only required attributes. +The configuration snippet below creates a EPG uSeg IP Attribute with only required attributes. ```hcl -resource "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_ip_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id ip = "131.107.1.200" name = "131" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion IP Attribute. +The configuration snippet below shows all possible attributes of the EPG uSeg IP Attribute. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion_ip_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" ip = "131.107.1.200" @@ -73,30 +73,30 @@ resource "aci_epg_useg_criterion_ip_attribute" "full_example_epg_useg_criterion" ``` -All examples for the EPG uSeg Criterion IP Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_ip_attribute) folder. +All examples for the EPG uSeg IP Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_ip_attribute) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `ip` (ip) - (string) The device IP address of the EPG uSeg Criterion IP Attribute object. -* `name` (name) - (string) The name of the EPG uSeg Criterion IP Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `ip` (ip) - (string) The device IP address of the EPG uSeg IP Attribute object. +* `name` (name) - (string) The name of the EPG uSeg IP Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg IP Attribute object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion IP Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg IP Attribute object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Criterion IP Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion IP Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg IP Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg IP Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object. +* `use_fv_subnet` (usefvSubnet) - (string) The usefvSubnet flag of the EPG uSeg IP Attribute object. - Default: `no` - Valid Values: `no`, `yes`. @@ -116,18 +116,18 @@ All examples for the EPG uSeg Criterion IP Attribute resource can be found in th ## Importing -An existing EPG uSeg Criterion IP Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg IP Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion_ip_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name} +terraform import aci_epg_useg_ip_attribute.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name} ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion IP Attribute can be imported +Starting in Terraform version 1.5, an existing EPG uSeg IP Attribute can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/ipattr-{name}" - to = aci_epg_useg_criterion_ip_attribute.example_epg_useg_criterion + to = aci_epg_useg_ip_attribute.example_epg_useg_block_statement } ``` diff --git a/docs/resources/epg_useg_criterion_mac_attribute.md b/docs/resources/epg_useg_mac_attribute.md similarity index 63% rename from docs/resources/epg_useg_criterion_mac_attribute.md rename to docs/resources/epg_useg_mac_attribute.md index 9cff1252c..b52c2f149 100644 --- a/docs/resources/epg_useg_criterion_mac_attribute.md +++ b/docs/resources/epg_useg_mac_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_mac_attribute" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_mac_attribute" +page_title: "ACI: aci_epg_useg_mac_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_mac_attribute" description: |- - Manages ACI EPG uSeg Criterion MAC Attribute + Manages ACI EPG uSeg MAC Attribute --- -# aci_epg_useg_criterion_mac_attribute # +# aci_epg_useg_mac_attribute # -Manages ACI EPG uSeg Criterion MAC Attribute +Manages ACI EPG uSeg MAC Attribute @@ -30,25 +30,25 @@ Manages ACI EPG uSeg Criterion MAC Attribute ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion MAC Attribute with only required attributes. +The configuration snippet below creates a EPG uSeg MAC Attribute with only required attributes. ```hcl -resource "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_mac_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id mac = "AA:BB:CC:DD:EE:FF" name = "mac_attr" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion MAC Attribute. +The configuration snippet below shows all possible attributes of the EPG uSeg MAC Attribute. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion_mac_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" mac = "AA:BB:CC:DD:EE:FF" @@ -72,27 +72,27 @@ resource "aci_epg_useg_criterion_mac_attribute" "full_example_epg_useg_criterion ``` -All examples for the EPG uSeg Criterion MAC Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_mac_attribute) folder. +All examples for the EPG uSeg MAC Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_mac_attribute) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `mac` (mac) - (string) The MAC address of the EPG uSeg Criterion MAC Attribute object. -* `name` (name) - (string) The name of the EPG uSeg Criterion MAC Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) +* `mac` (mac) - (string) The MAC address of the EPG uSeg MAC Attribute object. +* `name` (name) - (string) The name of the EPG uSeg MAC Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg MAC Attribute object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion MAC Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg MAC Attribute object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Criterion MAC Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion MAC Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg MAC Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg MAC Attribute object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. @@ -112,18 +112,18 @@ All examples for the EPG uSeg Criterion MAC Attribute resource can be found in t ## Importing -An existing EPG uSeg Criterion MAC Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg MAC Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion_mac_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name} +terraform import aci_epg_useg_mac_attribute.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name} ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion MAC Attribute can be imported +Starting in Terraform version 1.5, an existing EPG uSeg MAC Attribute can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/macattr-{name}" - to = aci_epg_useg_criterion_mac_attribute.example_epg_useg_criterion + to = aci_epg_useg_mac_attribute.example_epg_useg_block_statement } ``` diff --git a/docs/resources/epg_useg_sub_criterion.md b/docs/resources/epg_useg_sub_block_statement.md similarity index 50% rename from docs/resources/epg_useg_sub_criterion.md rename to docs/resources/epg_useg_sub_block_statement.md index ea4d9a99f..4a629e3d9 100644 --- a/docs/resources/epg_useg_sub_criterion.md +++ b/docs/resources/epg_useg_sub_block_statement.md @@ -4,16 +4,17 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_sub_criterion" -sidebar_current: "docs-aci-resource-aci_epg_useg_sub_criterion" +page_title: "ACI: aci_epg_useg_sub_block_statement" +sidebar_current: "docs-aci-resource-aci_epg_useg_sub_block_statement" description: |- - Manages ACI EPG uSeg Sub Criterion + Manages ACI EPG uSeg Sub Block Statement --- -# aci_epg_useg_sub_criterion # +# aci_epg_useg_sub_block_statement # -Manages ACI EPG uSeg Sub Criterion +Manages ACI EPG uSeg Sub Block Statement + -> The `aci_epg_useg_sub_block_statement` is used to create nested sub-block statements by referencing itself. ## API Information ## @@ -30,24 +31,52 @@ Manages ACI EPG uSeg Sub Criterion ## Example Usage ## -The configuration snippet below creates a EPG uSeg Sub Criterion with only required attributes. +The configuration snippet below creates a EPG uSeg Sub Block Statement with only required attributes. ```hcl -resource "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_sub_block_statement" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "sub_criterion" +} + +resource "aci_epg_useg_sub_block_statement" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id name = "sub_criterion" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Sub Criterion. +The configuration snippet below shows all possible attributes of the EPG uSeg Sub Block Statement. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_sub_criterion" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" + match = "all" + name = "sub_criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +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" match = "all" @@ -71,29 +100,30 @@ resource "aci_epg_useg_sub_criterion" "full_example_epg_useg_criterion" { ``` -All examples for the EPG uSeg Sub Criterion resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_sub_criterion) folder. +All examples for the EPG uSeg Sub Block Statement resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_sub_block_statement) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Sub Criterion object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg Sub Block Statement object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Criterion object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg Sub Block Statement object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Criterion object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg Sub Block Statement object. - Default: `orchestrator:terraform` -* `description` (descr) - (string) The description of the EPG uSeg Sub Criterion object. -* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Criterion object. +* `description` (descr) - (string) The description of the EPG uSeg Sub Block Statement object. +* `match` (match) - (string) The Matching Rule Type of the EPG uSeg Sub Block Statement object. - Default: `any` - Valid Values: `all`, `any`. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Criterion object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Sub Block Statement object. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. @@ -113,25 +143,25 @@ All examples for the EPG uSeg Sub Criterion resource can be found in the [exampl ## Importing -An existing EPG uSeg Sub Criterion can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg Sub Block Statement can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_sub_criterion.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name} +terraform import aci_epg_useg_sub_block_statement.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name} ``` -Starting in Terraform version 1.5, an existing EPG uSeg Sub Criterion can be imported +Starting in Terraform version 1.5, an existing EPG uSeg Sub Block Statement can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}" - to = aci_epg_useg_sub_criterion.example_epg_useg_criterion + to = aci_epg_useg_sub_block_statement.example_epg_useg_block_statement } ``` ## Child Resources - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) \ No newline at end of file + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) \ No newline at end of file diff --git a/docs/resources/epg_useg_criterion_vm_attribute.md b/docs/resources/epg_useg_vm_attribute.md similarity index 62% rename from docs/resources/epg_useg_criterion_vm_attribute.md rename to docs/resources/epg_useg_vm_attribute.md index 2ae7847dc..ffc3d47a9 100644 --- a/docs/resources/epg_useg_criterion_vm_attribute.md +++ b/docs/resources/epg_useg_vm_attribute.md @@ -4,15 +4,15 @@ # More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). subcategory: "Application Management" layout: "aci" -page_title: "ACI: aci_epg_useg_criterion_vm_attribute" -sidebar_current: "docs-aci-resource-aci_epg_useg_criterion_vm_attribute" +page_title: "ACI: aci_epg_useg_vm_attribute" +sidebar_current: "docs-aci-resource-aci_epg_useg_vm_attribute" description: |- - Manages ACI EPG uSeg Criterion VM Attribute + Manages ACI EPG uSeg VM Attribute --- -# aci_epg_useg_criterion_vm_attribute # +# aci_epg_useg_vm_attribute # -Manages ACI EPG uSeg Criterion VM Attribute +Manages ACI EPG uSeg VM Attribute @@ -32,31 +32,31 @@ Manages ACI EPG uSeg Criterion VM Attribute ## Example Usage ## -The configuration snippet below creates a EPG uSeg Criterion VM Attribute with only required attributes. +The configuration snippet below creates a EPG uSeg VM Attribute with only required attributes. ```hcl -resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +resource "aci_epg_useg_vm_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id name = "vm_attribute" value = "default_value" } -resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id +resource "aci_epg_useg_vm_attribute" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id name = "vm_attribute" value = "default_value" } ``` -The configuration snippet below shows all possible attributes of the EPG uSeg Criterion VM Attribute. +The configuration snippet below shows all possible attributes of the EPG uSeg VM Attribute. !> This example might not be valid configuration and is only used to show all possible attributes. ```hcl -resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" @@ -82,8 +82,8 @@ resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" ] } -resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id +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" @@ -111,36 +111,36 @@ resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_sub_criter ``` -All examples for the EPG uSeg Criterion VM Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_criterion_vm_attribute) folder. +All examples for the EPG uSeg VM Attribute resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_epg_useg_vm_attribute) folder. ## Schema ## ### Required ### * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) -* `name` (name) - (string) The name of the EPG uSeg Criterion VM Attribute object. -* `value` (value) - (string) The value of the EPG uSeg Criterion VM Attribute object. + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) +* `name` (name) - (string) The name of the EPG uSeg VM Attribute object. +* `value` (value) - (string) The value of the EPG uSeg VM Attribute object. ### Read-Only ### -* `id` - (string) The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object. +* `id` - (string) The distinguished name (DN) of the EPG uSeg VM Attribute object. ### Optional ### -* `annotation` (annotation) - (string) The annotation of the EPG uSeg Criterion VM Attribute object. +* `annotation` (annotation) - (string) The annotation of the EPG uSeg VM Attribute object. - Default: `orchestrator:terraform` -* `category` (category) - (string) The category of the EPG uSeg Criterion VM Attribute object. -* `description` (descr) - (string) The description of the EPG uSeg Criterion VM Attribute object. -* `label_name` (labelName) - (string) The label name of the EPG uSeg Criterion VM Attribute object. -* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg Criterion VM Attribute object. -* `operator` (operator) - (string) The operator of the EPG uSeg Criterion VM Attribute object. +* `category` (category) - (string) The category of the EPG uSeg VM Attribute object. +* `description` (descr) - (string) The description of the EPG uSeg VM Attribute object. +* `label_name` (labelName) - (string) The label name of the EPG uSeg VM Attribute object. +* `name_alias` (nameAlias) - (string) The name alias of the EPG uSeg VM Attribute object. +* `operator` (operator) - (string) The operator of the EPG uSeg VM Attribute object. - Default: `equals` - Valid Values: `contains`, `endsWith`, `equals`, `notEquals`, `startsWith`. * `owner_key` (ownerKey) - (string) The key for enabling clients to own their data for entity correlation. * `owner_tag` (ownerTag) - (string) A tag for enabling clients to add their own data. For example, to indicate who created this object. -* `type` (type) - (string) The type of the EPG uSeg Criterion VM Attribute object. +* `type` (type) - (string) The type of the EPG uSeg VM Attribute object. - Default: `vm-name` - Valid Values: `custom-label`, `domain`, `guest-os`, `hv`, `rootContName`, `tag`, `vm`, `vm-folder`, `vm-name`, `vmfolder-path`, `vnic`. @@ -160,18 +160,18 @@ All examples for the EPG uSeg Criterion VM Attribute resource can be found in th ## Importing -An existing EPG uSeg Criterion VM Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: +An existing EPG uSeg VM Attribute can be [imported](https://www.terraform.io/docs/import/index.html) into this resource with its distinguished name (DN), via the following command: ``` -terraform import aci_epg_useg_criterion_vm_attribute.example_epg_useg_criterion uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name} +terraform import aci_epg_useg_vm_attribute.example_epg_useg_block_statement uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name} ``` -Starting in Terraform version 1.5, an existing EPG uSeg Criterion VM Attribute can be imported +Starting in Terraform version 1.5, an existing EPG uSeg VM Attribute can be imported using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: ``` import { - id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}" - to = aci_epg_useg_criterion_vm_attribute.example_epg_useg_criterion + id = "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}" + to = aci_epg_useg_vm_attribute.example_epg_useg_block_statement } ``` diff --git a/docs/resources/tag.md b/docs/resources/tag.md index a9280a316..3194f0ced 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -64,19 +64,19 @@ All examples for the Tag resource can be found in the [examples](https://github. * `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: - Too many parent DNs to display, see model documentation for all possible parents of [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview). - [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) ([fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) - - [aci_epg_useg_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) + - [aci_epg_useg_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_block_statement) ([fvCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCrtrn/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - - [aci_epg_useg_criterion_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) + - [aci_epg_useg_dns_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_dns_attribute) ([fvDnsAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvDnsAttr/overview)) - [aci_endpoint_tag_ip](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_ip) ([fvEpIpTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpIpTag/overview)) - [aci_endpoint_tag_mac](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_tag_mac) ([fvEpMacTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvEpMacTag/overview)) - [aci_vrf_fallback_route_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group) ([fvFBRGroup](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRGroup/overview)) - [aci_vrf_fallback_route_group_member](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route_group_member) ([fvFBRMember](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRMember/overview)) - - [aci_epg_useg_criterion_identity_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_identity_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) - - [aci_epg_useg_criterion_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) - - [aci_epg_useg_criterion_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) - - [aci_epg_useg_sub_criterion](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_criterion) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/overview)) + - [aci_epg_useg_ad_group_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ad_group_attribute) ([fvIdGroupAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIdGroupAttr/overview)) + - [aci_epg_useg_ip_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_ip_attribute) ([fvIpAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvIpAttr/overview)) + - [aci_epg_useg_mac_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_mac_attribute) ([fvMacAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvMacAttr/overview)) + - [aci_epg_useg_sub_block_statement](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_sub_block_statement) ([fvSCrtrn](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvSCrtrn/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)) - - [aci_epg_useg_criterion_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_criterion_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) + - [aci_epg_useg_vm_attribute](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/epg_useg_vm_attribute) ([fvVmAttr](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvVmAttr/overview)) - [aci_l3out_consumer_label](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_consumer_label) ([l3extConsLbl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extConsLbl/overview)) - [aci_logical_node_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/logical_node_profile) ([l3extLNodeP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLNodeP/overview)) - [aci_l3out_loopback_interface_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/l3out_loopback_interface_profile) ([l3extLoopBackIfP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/l3extLoopBackIfP/overview)) diff --git a/examples/data-sources/aci_epg_useg_ad_group_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_ad_group_attribute/data-source.tf new file mode 100644 index 000000000..38fae855b --- /dev/null +++ b/examples/data-sources/aci_epg_useg_ad_group_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_ad_group_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} diff --git a/examples/data-sources/aci_epg_useg_criterion/provider.tf b/examples/data-sources/aci_epg_useg_ad_group_attribute/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion/provider.tf rename to examples/data-sources/aci_epg_useg_ad_group_attribute/provider.tf diff --git a/examples/data-sources/aci_epg_useg_block_statement/data-source.tf b/examples/data-sources/aci_epg_useg_block_statement/data-source.tf new file mode 100644 index 000000000..c07e8af99 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_block_statement/data-source.tf @@ -0,0 +1,4 @@ + +data "aci_epg_useg_block_statement" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} diff --git a/examples/data-sources/aci_epg_useg_criterion_dns_attribute/provider.tf b/examples/data-sources/aci_epg_useg_block_statement/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion_dns_attribute/provider.tf rename to examples/data-sources/aci_epg_useg_block_statement/provider.tf diff --git a/examples/data-sources/aci_epg_useg_criterion/data-source.tf b/examples/data-sources/aci_epg_useg_criterion/data-source.tf deleted file mode 100644 index ea12145c9..000000000 --- a/examples/data-sources/aci_epg_useg_criterion/data-source.tf +++ /dev/null @@ -1,4 +0,0 @@ - -data "aci_epg_useg_criterion" "example_application_epg" { - parent_dn = aci_application_epg.example.id -} diff --git a/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf deleted file mode 100644 index fd1b5dee2..000000000 --- a/examples/data-sources/aci_epg_useg_criterion_dns_attribute/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ - -data "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "dns_attribute" -} diff --git a/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf deleted file mode 100644 index 1d1c9c71d..000000000 --- a/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ - -data "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" -} diff --git a/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf deleted file mode 100644 index d9959e4f1..000000000 --- a/examples/data-sources/aci_epg_useg_criterion_ip_attribute/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ - -data "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "131" -} diff --git a/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf deleted file mode 100644 index f78c5c969..000000000 --- a/examples/data-sources/aci_epg_useg_criterion_mac_attribute/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ - -data "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "mac_attr" -} diff --git a/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf deleted file mode 100644 index 2c31998b2..000000000 --- a/examples/data-sources/aci_epg_useg_criterion_vm_attribute/data-source.tf +++ /dev/null @@ -1,10 +0,0 @@ - -data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "vm_attribute" -} - -data "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id - name = "vm_attribute" -} diff --git a/examples/data-sources/aci_epg_useg_dns_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_dns_attribute/data-source.tf new file mode 100644 index 000000000..fc5260a90 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_dns_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_dns_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "dns_attribute" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/provider.tf b/examples/data-sources/aci_epg_useg_dns_attribute/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion_identity_group_attribute/provider.tf rename to examples/data-sources/aci_epg_useg_dns_attribute/provider.tf diff --git a/examples/data-sources/aci_epg_useg_ip_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_ip_attribute/data-source.tf new file mode 100644 index 000000000..9104d067c --- /dev/null +++ b/examples/data-sources/aci_epg_useg_ip_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_ip_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "131" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_ip_attribute/provider.tf b/examples/data-sources/aci_epg_useg_ip_attribute/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion_ip_attribute/provider.tf rename to examples/data-sources/aci_epg_useg_ip_attribute/provider.tf diff --git a/examples/data-sources/aci_epg_useg_mac_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_mac_attribute/data-source.tf new file mode 100644 index 000000000..4eb1dc521 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_mac_attribute/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_epg_useg_mac_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "mac_attr" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_mac_attribute/provider.tf b/examples/data-sources/aci_epg_useg_mac_attribute/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion_mac_attribute/provider.tf rename to examples/data-sources/aci_epg_useg_mac_attribute/provider.tf diff --git a/examples/data-sources/aci_epg_useg_sub_block_statement/data-source.tf b/examples/data-sources/aci_epg_useg_sub_block_statement/data-source.tf new file mode 100644 index 000000000..eb3241749 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_sub_block_statement/data-source.tf @@ -0,0 +1,10 @@ + +data "aci_epg_useg_sub_block_statement" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "sub_criterion" +} + +data "aci_epg_useg_sub_block_statement" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id + name = "sub_criterion" +} diff --git a/examples/data-sources/aci_epg_useg_criterion_vm_attribute/provider.tf b/examples/data-sources/aci_epg_useg_sub_block_statement/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_criterion_vm_attribute/provider.tf rename to examples/data-sources/aci_epg_useg_sub_block_statement/provider.tf diff --git a/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf b/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf deleted file mode 100644 index 7adadc33a..000000000 --- a/examples/data-sources/aci_epg_useg_sub_criterion/data-source.tf +++ /dev/null @@ -1,5 +0,0 @@ - -data "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "sub_criterion" -} diff --git a/examples/data-sources/aci_epg_useg_vm_attribute/data-source.tf b/examples/data-sources/aci_epg_useg_vm_attribute/data-source.tf new file mode 100644 index 000000000..8498197e3 --- /dev/null +++ b/examples/data-sources/aci_epg_useg_vm_attribute/data-source.tf @@ -0,0 +1,10 @@ + +data "aci_epg_useg_vm_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "vm_attribute" +} + +data "aci_epg_useg_vm_attribute" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id + name = "vm_attribute" +} diff --git a/examples/data-sources/aci_epg_useg_sub_criterion/provider.tf b/examples/data-sources/aci_epg_useg_vm_attribute/provider.tf similarity index 100% rename from examples/data-sources/aci_epg_useg_sub_criterion/provider.tf rename to examples/data-sources/aci_epg_useg_vm_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion/provider.tf b/examples/resources/aci_epg_useg_ad_group_attribute/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion/provider.tf rename to examples/resources/aci_epg_useg_ad_group_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf similarity index 73% rename from examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf index 3e64253a6..6b1a72628 100644 --- a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_ad_group_attribute/resource-all-attributes.tf @@ -1,6 +1,6 @@ -resource "aci_epg_useg_criterion_identity_group_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" diff --git a/examples/resources/aci_epg_useg_ad_group_attribute/resource.tf b/examples/resources/aci_epg_useg_ad_group_attribute/resource.tf new file mode 100644 index 000000000..f3d96e688 --- /dev/null +++ b/examples/resources/aci_epg_useg_ad_group_attribute/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_epg_useg_ad_group_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" +} diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/provider.tf b/examples/resources/aci_epg_useg_block_statement/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion_dns_attribute/provider.tf rename to examples/resources/aci_epg_useg_block_statement/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf b/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf similarity index 85% rename from examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf index 33b616d5e..0eb3c1a23 100644 --- a/examples/resources/aci_epg_useg_criterion/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_block_statement/resource-all-attributes.tf @@ -1,5 +1,5 @@ -resource "aci_epg_useg_criterion" "full_example_application_epg" { +resource "aci_epg_useg_block_statement" "full_example_application_epg" { parent_dn = aci_application_epg.example.id annotation = "annotation" description = "description" diff --git a/examples/resources/aci_epg_useg_block_statement/resource.tf b/examples/resources/aci_epg_useg_block_statement/resource.tf new file mode 100644 index 000000000..979e244e5 --- /dev/null +++ b/examples/resources/aci_epg_useg_block_statement/resource.tf @@ -0,0 +1,4 @@ + +resource "aci_epg_useg_block_statement" "example_application_epg" { + parent_dn = aci_application_epg.example.id +} diff --git a/examples/resources/aci_epg_useg_criterion/resource.tf b/examples/resources/aci_epg_useg_criterion/resource.tf deleted file mode 100644 index 717dd4565..000000000 --- a/examples/resources/aci_epg_useg_criterion/resource.tf +++ /dev/null @@ -1,4 +0,0 @@ - -resource "aci_epg_useg_criterion" "example_application_epg" { - parent_dn = aci_application_epg.example.id -} diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf deleted file mode 100644 index 10aec07b7..000000000 --- a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource.tf +++ /dev/null @@ -1,5 +0,0 @@ - -resource "aci_epg_useg_criterion_dns_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "dns_attribute" -} diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf deleted file mode 100644 index 2ee611257..000000000 --- a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/resource.tf +++ /dev/null @@ -1,5 +0,0 @@ - -resource "aci_epg_useg_criterion_identity_group_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" -} diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf deleted file mode 100644 index d2d0ee7e7..000000000 --- a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource.tf +++ /dev/null @@ -1,6 +0,0 @@ - -resource "aci_epg_useg_criterion_ip_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - ip = "131.107.1.200" - name = "131" -} diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf deleted file mode 100644 index 03bf22870..000000000 --- a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource.tf +++ /dev/null @@ -1,6 +0,0 @@ - -resource "aci_epg_useg_criterion_mac_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" -} diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf b/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf deleted file mode 100644 index 4aecc213c..000000000 --- a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource.tf +++ /dev/null @@ -1,12 +0,0 @@ - -resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "vm_attribute" - value = "default_value" -} - -resource "aci_epg_useg_criterion_vm_attribute" "example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id - name = "vm_attribute" - value = "default_value" -} diff --git a/examples/resources/aci_epg_useg_criterion_identity_group_attribute/provider.tf b/examples/resources/aci_epg_useg_dns_attribute/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion_identity_group_attribute/provider.tf rename to examples/resources/aci_epg_useg_dns_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf similarity index 72% rename from examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf index 0357f9fdf..3b70a87bd 100644 --- a/examples/resources/aci_epg_useg_criterion_dns_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_dns_attribute/resource-all-attributes.tf @@ -1,6 +1,6 @@ -resource "aci_epg_useg_criterion_dns_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" diff --git a/examples/resources/aci_epg_useg_dns_attribute/resource.tf b/examples/resources/aci_epg_useg_dns_attribute/resource.tf new file mode 100644 index 000000000..430addb39 --- /dev/null +++ b/examples/resources/aci_epg_useg_dns_attribute/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_epg_useg_dns_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "dns_attribute" +} diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/provider.tf b/examples/resources/aci_epg_useg_ip_attribute/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion_ip_attribute/provider.tf rename to examples/resources/aci_epg_useg_ip_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf similarity index 74% rename from examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf index e55d218e6..779c37eab 100644 --- a/examples/resources/aci_epg_useg_criterion_ip_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_ip_attribute/resource-all-attributes.tf @@ -1,6 +1,6 @@ -resource "aci_epg_useg_criterion_ip_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" ip = "131.107.1.200" diff --git a/examples/resources/aci_epg_useg_ip_attribute/resource.tf b/examples/resources/aci_epg_useg_ip_attribute/resource.tf new file mode 100644 index 000000000..08d03471d --- /dev/null +++ b/examples/resources/aci_epg_useg_ip_attribute/resource.tf @@ -0,0 +1,6 @@ + +resource "aci_epg_useg_ip_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + ip = "131.107.1.200" + name = "131" +} diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/provider.tf b/examples/resources/aci_epg_useg_mac_attribute/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion_mac_attribute/provider.tf rename to examples/resources/aci_epg_useg_mac_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf similarity index 72% rename from examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf index d4cb2291c..7db6246a6 100644 --- a/examples/resources/aci_epg_useg_criterion_mac_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_mac_attribute/resource-all-attributes.tf @@ -1,6 +1,6 @@ -resource "aci_epg_useg_criterion_mac_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" mac = "AA:BB:CC:DD:EE:FF" diff --git a/examples/resources/aci_epg_useg_mac_attribute/resource.tf b/examples/resources/aci_epg_useg_mac_attribute/resource.tf new file mode 100644 index 000000000..7af23d47d --- /dev/null +++ b/examples/resources/aci_epg_useg_mac_attribute/resource.tf @@ -0,0 +1,6 @@ + +resource "aci_epg_useg_mac_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/provider.tf b/examples/resources/aci_epg_useg_sub_block_statement/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_criterion_vm_attribute/provider.tf rename to examples/resources/aci_epg_useg_sub_block_statement/provider.tf 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 new file mode 100644 index 000000000..10e4dd78c --- /dev/null +++ b/examples/resources/aci_epg_useg_sub_block_statement/resource-all-attributes.tf @@ -0,0 +1,46 @@ + +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" + match = "all" + name = "sub_criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +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" + match = "all" + name = "sub_criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_epg_useg_sub_block_statement/resource.tf b/examples/resources/aci_epg_useg_sub_block_statement/resource.tf new file mode 100644 index 000000000..c3399dc35 --- /dev/null +++ b/examples/resources/aci_epg_useg_sub_block_statement/resource.tf @@ -0,0 +1,10 @@ + +resource "aci_epg_useg_sub_block_statement" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "sub_criterion" +} + +resource "aci_epg_useg_sub_block_statement" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id + name = "sub_criterion" +} diff --git a/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf b/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf deleted file mode 100644 index b5c564521..000000000 --- a/examples/resources/aci_epg_useg_sub_criterion/resource-all-attributes.tf +++ /dev/null @@ -1,23 +0,0 @@ - -resource "aci_epg_useg_sub_criterion" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - annotation = "annotation" - description = "description" - match = "all" - name = "sub_criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" - annotations = [ - { - key = "key_0" - value = "value_1" - } - ] - tags = [ - { - key = "key_0" - value = "value_1" - } - ] -} diff --git a/examples/resources/aci_epg_useg_sub_criterion/resource.tf b/examples/resources/aci_epg_useg_sub_criterion/resource.tf deleted file mode 100644 index a3ad85efb..000000000 --- a/examples/resources/aci_epg_useg_sub_criterion/resource.tf +++ /dev/null @@ -1,5 +0,0 @@ - -resource "aci_epg_useg_sub_criterion" "example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id - name = "sub_criterion" -} diff --git a/examples/resources/aci_epg_useg_sub_criterion/provider.tf b/examples/resources/aci_epg_useg_vm_attribute/provider.tf similarity index 100% rename from examples/resources/aci_epg_useg_sub_criterion/provider.tf rename to examples/resources/aci_epg_useg_vm_attribute/provider.tf diff --git a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf b/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf similarity index 77% rename from examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf rename to examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf index 3e8b86cbc..06e195d02 100644 --- a/examples/resources/aci_epg_useg_criterion_vm_attribute/resource-all-attributes.tf +++ b/examples/resources/aci_epg_useg_vm_attribute/resource-all-attributes.tf @@ -1,6 +1,6 @@ -resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" { - parent_dn = aci_epg_useg_criterion.example.id +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" @@ -26,8 +26,8 @@ resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_criterion" ] } -resource "aci_epg_useg_criterion_vm_attribute" "full_example_epg_useg_sub_criterion" { - parent_dn = aci_epg_useg_sub_criterion.example.id +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" diff --git a/examples/resources/aci_epg_useg_vm_attribute/resource.tf b/examples/resources/aci_epg_useg_vm_attribute/resource.tf new file mode 100644 index 000000000..353f420c0 --- /dev/null +++ b/examples/resources/aci_epg_useg_vm_attribute/resource.tf @@ -0,0 +1,12 @@ + +resource "aci_epg_useg_vm_attribute" "example_epg_useg_block_statement" { + parent_dn = aci_epg_useg_block_statement.example.id + name = "vm_attribute" + value = "default_value" +} + +resource "aci_epg_useg_vm_attribute" "example_epg_useg_sub_block_statement" { + parent_dn = aci_epg_useg_sub_block_statement.example.id + name = "vm_attribute" + value = "default_value" +} diff --git a/gen/definitions/classes.yaml b/gen/definitions/classes.yaml index 9c1b6d85b..b3edcb1b2 100644 --- a/gen/definitions/classes.yaml +++ b/gen/definitions/classes.yaml @@ -220,49 +220,40 @@ mplsNodeSidP: - "l3extLoopBackIfP" fvCrtrn: - resource_name: "epg_useg_criterion" + resource_name: "epg_useg_block_statement" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" include: true fvSCrtrn: - resource_name: "epg_useg_sub_criterion" + resource_name: "epg_useg_sub_block_statement" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" - dn_formats: - - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}" - contained_by: - - "fvCrtrn" + resource_notes: + - "The `aci_epg_useg_sub_block_statement` is used to create nested sub-block statements by referencing itself." fvVmAttr: - resource_name: "epg_useg_criterion_vm_attribute" + resource_name: "epg_useg_vm_attribute" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" - dn_formats: - - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/vmattr-{name}" - - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/crtrn-{name}/vmattr-{name}" fvIdGroupAttr: - resource_name: "epg_useg_criterion_identity_group_attribute" + resource_name: "epg_useg_ad_group_attribute" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" - dn_formats: - - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/idgattr-[{selector}]" fvDnsAttr: - resource_name: "epg_useg_criterion_dns_attribute" + resource_name: "epg_useg_dns_attribute" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" - dn_formats: - - "uni/tn-{name}/ap-{name}/epg-{name}/crtrn/dnsattr-{name}" fvMacAttr: - resource_name: "epg_useg_criterion_mac_attribute" + resource_name: "epg_useg_mac_attribute" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" @@ -272,7 +263,7 @@ fvMacAttr: - "fvCrtrn" fvIpAttr: - resource_name: "epg_useg_criterion_ip_attribute" + resource_name: "epg_useg_ip_attribute" ui_locations: - "Tenants -> Application Profiles -> uSeg EPGs -> uSeg Attributes" sub_category: "Application Management" diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index c0fdc9c17..067d5ade0 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -29,6 +29,7 @@ global: Dns: "DNS" Mac: "MAC" Ip: "IP" + Ad: "AD" ignores: - "userdom" @@ -356,6 +357,9 @@ fvCrtrn: name: "criterion" datasource_non_existing: name: "criterion_non_existing" + parents: + - class_name: "fvAEPg" + parent_dn: "aci_application_epg.test.id" fvSCrtrn: documentation: @@ -371,6 +375,13 @@ fvSCrtrn: name: "sub_criterion" datasource_non_existing: name: "sub_criterion_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" + - class_name: "fvSCrtrn" + parent_dependency: "fvCrtrn" + parent_dn: "epg_useg_sub_block_statement.test.id" fvVmAttr: resource_required: @@ -401,6 +412,13 @@ fvVmAttr: name: "vm_attribute" datasource_non_existing: name: "vm_attribute_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" + - class_name: "fvSCrtrn" + parent_dependency: "fvCrtrn" + parent_dn: "epg_useg_sub_block_statement.test.id" fvIdGroupAttr: documentation: @@ -412,6 +430,10 @@ fvIdGroupAttr: selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" datasource_non_existing: selector: "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" fvDnsAttr: documentation: @@ -424,6 +446,10 @@ fvDnsAttr: name: "dns_attribute" datasource_non_existing: name: "dns_attribute_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" fvMacAttr: resource_required: @@ -440,6 +466,10 @@ fvMacAttr: name: "mac_attr" datasource_non_existing: name: "mac_attr_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" fvIpAttr: resource_required: @@ -466,3 +496,7 @@ fvIpAttr: name: "131" datasource_non_existing: name: "131_non_existing" + parents: + - class_name: "fvCrtrn" + parent_dependency: "fvAEPg" + parent_dn: "epg_useg_block_statement.test.id" diff --git a/gen/templates/datasource_test.go.tmpl b/gen/templates/datasource_test.go.tmpl index 96bdd28e7..34582e841 100644 --- a/gen/templates/datasource_test.go.tmpl +++ b/gen/templates/datasource_test.go.tmpl @@ -13,6 +13,7 @@ import ( {{- if .parents}} {{- range .parents}} +{{- $parentClassName := capitalize .class_name }} func TestAccDataSource{{$.resourceClassName}}With{{capitalize .class_name}} (t *testing.T) { resource.Test(t, resource.TestCase{ @@ -25,19 +26,19 @@ func TestAccDataSource{{$.resourceClassName}}With{{capitalize .class_name}} (t * Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.datasource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.default}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("data.aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} ), @@ -86,8 +87,9 @@ func TestAccDataSource{{.resourceClassName}}(t *testing.T) { {{- if .parents}} {{- range .parents}} +{{- $parentClassName := capitalize .class_name }} const testConfig{{$.resourceClassName}}DataSourceDependencyWith{{capitalize .class_name}} = testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name}} + ` -data "aci_{{$.resourceName}}" "test" { +data "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.datasource_required}} {{- if eq $key "target_dn" }} @@ -96,7 +98,7 @@ data "aci_{{$.resourceName}}" "test" { {{$key}} = "{{$value}}" {{- end }} {{- end}} - depends_on = [aci_{{$.resourceName}}.test] + depends_on = [aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}] } ` @@ -128,7 +130,7 @@ data "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}NotExisting = testConfig{{.resourceClassName}}All + ` -data "aci_{{$.resourceName}}" "test" { +data "aci_{{$.resourceName}}" "test_non_existing" { {{- range $key, $value := $.datasource_non_existing}} {{- if eq $key "target_dn" }} {{$key}} = "{{$.targetDn}}_not_existing" diff --git a/gen/templates/resource_test.go.tmpl b/gen/templates/resource_test.go.tmpl index 1e1734ab8..d165a60a7 100644 --- a/gen/templates/resource_test.go.tmpl +++ b/gen/templates/resource_test.go.tmpl @@ -12,6 +12,7 @@ import ( {{- if .parents}} {{- range .parents}} +{{- $parentClassName := capitalize .class_name }} func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *testing.T) { resource.Test(t, resource.TestCase{ @@ -26,20 +27,20 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.default}} {{- if not $contains}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- end}} {{- range $key, $value := $.default}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} ), @@ -52,20 +53,20 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.all}} {{- if not $contains}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- end}} {{- range $key, $value := $.all}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} ), @@ -77,19 +78,19 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.all}}{{$contains := definedInMap $key $.all}} {{- if not $contains}} {{- if ne $key "annotation"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- else}} {{- range $dkey, $dvalue := $.default}} {{- if eq $dkey "annotation"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$dkey}}", "{{$dvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$dkey}}", "{{$dvalue}}"), {{- end}} {{- end}} {{- end}} @@ -104,20 +105,20 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- end}} @@ -125,26 +126,26 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes }, // Import testing { - ResourceName: "aci_{{$.resourceName}}.test", + ResourceName: "aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", ImportState: true, ImportStateVerify: true, Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- end}} @@ -158,20 +159,20 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- end}} @@ -179,7 +180,7 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes {{- range $child_index, $child := $value}} {{- range $child_key, $child_value := $child}} {{- if ne $child_key "deletable_child"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), {{- end}} {{- end}} {{- end}} @@ -188,26 +189,26 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes }, // Import testing with children { - ResourceName: "aci_{{$.resourceName}}.test", + ResourceName: "aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", ImportState: true, ImportStateVerify: true, Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$.targetDn}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$.targetDn}}"), {{- else }} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end }} {{- end}} {{- range $key, $value := $.default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- end}} @@ -215,7 +216,7 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes {{- range $child_index, $child := $value}} {{- range $child_key, $child_value := $child}} {{- if ne $child_key "deletable_child"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), {{- end}} {{- end}} {{- end}} @@ -228,17 +229,17 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes ExpectNonEmptyPlan: {{.class_in_parent}}, Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := .min}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- range $key, $value := .default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} {{- if (isInterfaceSlice $value)}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "{{len $value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "{{len $value}}"), {{- range $index, $subvalue := $value}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$index}}", "{{$subvalue}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$index}}", "{{$subvalue}}"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- end}} @@ -246,14 +247,14 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes {{- range $child_index, $child := $value}} {{- range $child_key, $child_value := $child}} {{- if ne $child_key "deletable_child"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"), {{- end}} {{- end}} {{- end}} {{- if eq (len $value) 1}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "1"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "1"), {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "2"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "2"), {{- end}} {{- end}} ), @@ -264,31 +265,31 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes ExpectNonEmptyPlan: {{.class_in_parent}}, Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := .min}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- range $key, $value := .default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- range $key, $value := $.children}} {{- if eq (len $value) 1}}{{- $child := index $value 0 }} {{- if $child.deletable_child}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "0"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "0"), {{- else}} {{- range $child_key, $child_value := $child}} {{- if ne $child_key "deletable_child"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), {{- end}} {{- end}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "1"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "1"), {{- end}} {{- else}} {{- $child := index $value 1 }} {{- range $child_key, $child_value := $child}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), {{- end}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "1"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "1"), {{- end}} {{- end}} ), @@ -299,27 +300,27 @@ func TestAccResource{{$.resourceClassName}}With{{capitalize .class_name}}(t *tes ExpectNonEmptyPlan: {{.class_in_parent}}, Check: resource.ComposeAggregateTestCheckFunc( {{- range $key, $value := .min}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- range $key, $value := .default}}{{$contains := definedInMap $key $.resource_required}} {{- if not $contains}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}", "{{$value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}", "{{$value}}"), {{- end}} {{- end}} {{- range $key, $value := $.children}} {{- if eq (len $value) 1}}{{- $child := index $value 0 }} {{- if $child.deletable_child}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "0"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "0"), {{- else}} {{- range $child_key, $child_value := $child}} {{- if ne $child_key "deletable_child"}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"), {{- end}} {{- end}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "1"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "1"), {{- end}} {{- else}} - resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.#", "0"), + resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}", "{{$key}}.#", "0"), {{- end}} {{- end}} ), @@ -659,9 +660,9 @@ resource "aci_{{$.targetResourceName}}" "test" { {{- end }} {{- if .parents}} {{- range .parents}} - +{{ $parentClassName := capitalize .class_name }} const testConfig{{$.resourceClassName}}MinDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} @@ -674,7 +675,7 @@ resource "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}AllDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.all}} {{- if not $contains}} @@ -700,7 +701,7 @@ resource "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}ResetDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}}{{$contains := definedInMap $key $.default}} {{- if not $contains}} @@ -727,7 +728,7 @@ resource "aci_{{$.resourceName}}" "test" { {{- if $.children}} const testConfig{{$.resourceClassName}}ChildrenDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} @@ -753,7 +754,7 @@ resource "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}ChildrenRemoveFromConfigDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} @@ -766,7 +767,7 @@ resource "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}ChildrenRemoveOneDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} @@ -795,7 +796,7 @@ resource "aci_{{$.resourceName}}" "test" { ` const testConfig{{$.resourceClassName}}ChildrenRemoveAllDependencyWith{{capitalize .class_name}} = {{- if ne $parentConfig ""}} {{ $parentConfig }} + {{- end }} testConfig{{capitalize .class_name}}Min{{- if ne .parent_dependency ""}}DependencyWith{{capitalize .parent_dependency}}{{if and (ne .parent_dependency_name nil) (ne .parent_dependency_name "")}}{{capitalize .parent_dependency_name }}{{- end }}{{- end}} + ` -resource "aci_{{$.resourceName}}" "test" { +resource "aci_{{$.resourceName}}" "test{{- if eq $.resourceClassName $parentClassName }}1{{- end }}" { parent_dn = {{.parent_dn}} {{- range $key, $value := $.resource_required}} {{- if eq $key "target_dn" }} diff --git a/gen/templates/testvars.yaml.tmpl b/gen/templates/testvars.yaml.tmpl index 0eb150b0d..9c47eb134 100644 --- a/gen/templates/testvars.yaml.tmpl +++ b/gen/templates/testvars.yaml.tmpl @@ -115,8 +115,9 @@ parents: parent_dn: "{{createParentDnValue $key "test" $.Definitions}}" class_in_parent: {{$parentDependency.class_in_parent}} {{- if ne $parentDependency.parent_dependency_name "" }} - parent_dependency_name: "{{$parentDependency.parent_dependency_name}}"{{$index = add $index 1}} + parent_dependency_name: "{{$parentDependency.parent_dependency_name}}" {{- end }} + {{$index = add $index 1}} {{- end}} {{- $index := 0}}{{- $key := .TargetResourceClassName}} diff --git a/gen/testvars/fvCrtrn.yaml b/gen/testvars/fvCrtrn.yaml index 534b7d913..2ae798470 100644 --- a/gen/testvars/fvCrtrn.yaml +++ b/gen/testvars/fvCrtrn.yaml @@ -50,3 +50,4 @@ parents: parent_dependency: "" parent_dn: "aci_application_epg.test.id" class_in_parent: false + diff --git a/gen/testvars/fvDnsAttr.yaml b/gen/testvars/fvDnsAttr.yaml index 4d170f77c..cf3374278 100644 --- a/gen/testvars/fvDnsAttr.yaml +++ b/gen/testvars/fvDnsAttr.yaml @@ -44,6 +44,7 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + diff --git a/gen/testvars/fvEpIpTag.yaml b/gen/testvars/fvEpIpTag.yaml index 07b6c2485..fb2dd735a 100644 --- a/gen/testvars/fvEpIpTag.yaml +++ b/gen/testvars/fvEpIpTag.yaml @@ -46,3 +46,4 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + diff --git a/gen/testvars/fvEpMacTag.yaml b/gen/testvars/fvEpMacTag.yaml index 5c4298d7f..588c71c58 100644 --- a/gen/testvars/fvEpMacTag.yaml +++ b/gen/testvars/fvEpMacTag.yaml @@ -46,3 +46,4 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + diff --git a/gen/testvars/fvFBRGroup.yaml b/gen/testvars/fvFBRGroup.yaml index 8fd06febd..03e6ff19e 100644 --- a/gen/testvars/fvFBRGroup.yaml +++ b/gen/testvars/fvFBRGroup.yaml @@ -54,3 +54,4 @@ parents: parent_dependency: "fvTenant" parent_dn: "aci_vrf.test.id" class_in_parent: false + diff --git a/gen/testvars/fvFBRMember.yaml b/gen/testvars/fvFBRMember.yaml index 218e652f2..eff5c3dcd 100644 --- a/gen/testvars/fvFBRMember.yaml +++ b/gen/testvars/fvFBRMember.yaml @@ -43,3 +43,4 @@ parents: parent_dependency: "fvCtx" parent_dn: "aci_vrf_fallback_route_group.test.id" class_in_parent: false + diff --git a/gen/testvars/fvIdGroupAttr.yaml b/gen/testvars/fvIdGroupAttr.yaml index 443ffb3af..b9fe5ed7e 100644 --- a/gen/testvars/fvIdGroupAttr.yaml +++ b/gen/testvars/fvIdGroupAttr.yaml @@ -44,6 +44,7 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + diff --git a/gen/testvars/fvIpAttr.yaml b/gen/testvars/fvIpAttr.yaml index f775617b0..b727df40a 100644 --- a/gen/testvars/fvIpAttr.yaml +++ b/gen/testvars/fvIpAttr.yaml @@ -47,6 +47,7 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + diff --git a/gen/testvars/fvMacAttr.yaml b/gen/testvars/fvMacAttr.yaml index 643eb6ff8..73895e766 100644 --- a/gen/testvars/fvMacAttr.yaml +++ b/gen/testvars/fvMacAttr.yaml @@ -45,6 +45,7 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + diff --git a/gen/testvars/fvSCrtrn.yaml b/gen/testvars/fvSCrtrn.yaml index a761f7cfa..e6af55439 100644 --- a/gen/testvars/fvSCrtrn.yaml +++ b/gen/testvars/fvSCrtrn.yaml @@ -44,6 +44,12 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + + - class_name: "fvSCrtrn" + parent_dependency: "fvCrtrn" + parent_dn: "aci_epg_useg_sub_block_statement.test.id" + class_in_parent: false + diff --git a/gen/testvars/fvVmAttr.yaml b/gen/testvars/fvVmAttr.yaml index 9cedb3ca1..1dba08311 100644 --- a/gen/testvars/fvVmAttr.yaml +++ b/gen/testvars/fvVmAttr.yaml @@ -53,10 +53,12 @@ children: parents: - class_name: "fvCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_criterion.test.id" + parent_dependency: "fvAEPg" + parent_dn: "aci_epg_useg_block_statement.test.id" class_in_parent: false + - class_name: "fvSCrtrn" - parent_dependency: "" - parent_dn: "aci_epg_useg_sub_criterion.test.id" + parent_dependency: "fvCrtrn" + parent_dn: "aci_epg_useg_sub_block_statement.test.id" class_in_parent: false + diff --git a/gen/testvars/l3extConsLbl.yaml b/gen/testvars/l3extConsLbl.yaml index fabbd89ac..7d54b7b78 100644 --- a/gen/testvars/l3extConsLbl.yaml +++ b/gen/testvars/l3extConsLbl.yaml @@ -49,3 +49,4 @@ parents: parent_dependency: "" parent_dn: "aci_l3_outside.test.id" class_in_parent: false + diff --git a/gen/testvars/l3extProvLbl.yaml b/gen/testvars/l3extProvLbl.yaml index b43254708..c5b2f12c7 100644 --- a/gen/testvars/l3extProvLbl.yaml +++ b/gen/testvars/l3extProvLbl.yaml @@ -48,3 +48,4 @@ parents: parent_dn: "aci_l3_outside.test.id" class_in_parent: false parent_dependency_name: "infra" + diff --git a/gen/testvars/l3extRsOutToFBRGroup.yaml b/gen/testvars/l3extRsOutToFBRGroup.yaml index 12a6716b9..63af7c8f2 100644 --- a/gen/testvars/l3extRsOutToFBRGroup.yaml +++ b/gen/testvars/l3extRsOutToFBRGroup.yaml @@ -37,6 +37,7 @@ parents: parent_dependency: "fvTenant" parent_dn: "aci_l3_outside.test.id" class_in_parent: false + targets: - class_name: "fvFBRGroup" diff --git a/gen/testvars/l3extRsRedistributePol.yaml b/gen/testvars/l3extRsRedistributePol.yaml index fcd38f5b5..6897db333 100644 --- a/gen/testvars/l3extRsRedistributePol.yaml +++ b/gen/testvars/l3extRsRedistributePol.yaml @@ -42,3 +42,4 @@ parents: parent_dependency: "fvTenant" parent_dn: "aci_l3_outside.test.id" class_in_parent: true + diff --git a/gen/testvars/mgmtRsOoBCons.yaml b/gen/testvars/mgmtRsOoBCons.yaml index 301687bba..9353b2ca6 100644 --- a/gen/testvars/mgmtRsOoBCons.yaml +++ b/gen/testvars/mgmtRsOoBCons.yaml @@ -39,3 +39,4 @@ parents: parent_dependency: "" parent_dn: "aci_external_management_network_instance_profile.test.id" class_in_parent: false + diff --git a/gen/testvars/mgmtSubnet.yaml b/gen/testvars/mgmtSubnet.yaml index b7280633a..e510bcdad 100644 --- a/gen/testvars/mgmtSubnet.yaml +++ b/gen/testvars/mgmtSubnet.yaml @@ -43,3 +43,4 @@ parents: parent_dependency: "" parent_dn: "aci_external_management_network_instance_profile.test.id" class_in_parent: false + diff --git a/gen/testvars/mplsNodeSidP.yaml b/gen/testvars/mplsNodeSidP.yaml index 90659625c..2628f9b26 100644 --- a/gen/testvars/mplsNodeSidP.yaml +++ b/gen/testvars/mplsNodeSidP.yaml @@ -45,3 +45,4 @@ parents: parent_dependency: "l3extRsNodeL3OutAtt" parent_dn: "aci_l3out_loopback_interface_profile.test.id" class_in_parent: false + diff --git a/gen/testvars/netflowMonitorPol.yaml b/gen/testvars/netflowMonitorPol.yaml index 1c9b59842..5aa110a37 100644 --- a/gen/testvars/netflowMonitorPol.yaml +++ b/gen/testvars/netflowMonitorPol.yaml @@ -57,3 +57,4 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + diff --git a/gen/testvars/netflowRecordPol.yaml b/gen/testvars/netflowRecordPol.yaml index 6988f20ee..8894d5a71 100644 --- a/gen/testvars/netflowRecordPol.yaml +++ b/gen/testvars/netflowRecordPol.yaml @@ -54,3 +54,4 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + diff --git a/gen/testvars/netflowRsMonitorToExporter.yaml b/gen/testvars/netflowRsMonitorToExporter.yaml index 68ab8e82b..34a517e86 100644 --- a/gen/testvars/netflowRsMonitorToExporter.yaml +++ b/gen/testvars/netflowRsMonitorToExporter.yaml @@ -37,3 +37,4 @@ parents: parent_dependency: "fvTenant" parent_dn: "aci_netflow_monitor_policy.test.id" class_in_parent: false + diff --git a/gen/testvars/pimRouteMapEntry.yaml b/gen/testvars/pimRouteMapEntry.yaml index bfdfb090d..a296b71fe 100644 --- a/gen/testvars/pimRouteMapEntry.yaml +++ b/gen/testvars/pimRouteMapEntry.yaml @@ -51,3 +51,4 @@ parents: parent_dependency: "fvTenant" parent_dn: "aci_pim_route_map_policy.test.id" class_in_parent: false + diff --git a/gen/testvars/pimRouteMapPol.yaml b/gen/testvars/pimRouteMapPol.yaml index cac7fd60c..354c3bfe3 100644 --- a/gen/testvars/pimRouteMapPol.yaml +++ b/gen/testvars/pimRouteMapPol.yaml @@ -45,3 +45,4 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + diff --git a/gen/testvars/tagAnnotation.yaml b/gen/testvars/tagAnnotation.yaml index be258afb5..d615fb897 100644 --- a/gen/testvars/tagAnnotation.yaml +++ b/gen/testvars/tagAnnotation.yaml @@ -23,7 +23,9 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + - class_name: "fvAEPg" parent_dependency: "" parent_dn: "aci_application_epg.test.id" class_in_parent: false + diff --git a/gen/testvars/tagTag.yaml b/gen/testvars/tagTag.yaml index be258afb5..d615fb897 100644 --- a/gen/testvars/tagTag.yaml +++ b/gen/testvars/tagTag.yaml @@ -23,7 +23,9 @@ parents: parent_dependency: "" parent_dn: "aci_tenant.test.id" class_in_parent: false + - class_name: "fvAEPg" parent_dependency: "" parent_dn: "aci_application_epg.test.id" class_in_parent: false + diff --git a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go b/internal/provider/data_source_aci_epg_useg_ad_group_attribute.go similarity index 71% rename from internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go rename to internal/provider/data_source_aci_epg_useg_ad_group_attribute.go index 7394f7b2e..833cc43c2 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute.go +++ b/internal/provider/data_source_aci_epg_useg_ad_group_attribute.go @@ -28,21 +28,21 @@ type FvIdGroupAttrDataSource struct { } func (d *FvIdGroupAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_identity_group_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_identity_group_attribute" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_ad_group_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_ad_group_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_ad_group_attribute") } func (d *FvIdGroupAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_ad_group_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_identity_group_attribute datasource for the 'fvIdGroupAttr' class", + MarkdownDescription: "The epg_useg_ad_group_attribute datasource for the 'fvIdGroupAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg AD Group Attribute object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,19 +50,19 @@ func (d *FvIdGroupAttrDataSource) Schema(ctx context.Context, req datasource.Sch }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg AD Group Attribute object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg AD Group Attribute object.`, }, "name": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg AD Group Attribute object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg AD Group Attribute object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -74,7 +74,7 @@ func (d *FvIdGroupAttrDataSource) Schema(ctx context.Context, req datasource.Sch }, "selector": schema.StringAttribute{ Required: true, - MarkdownDescription: `The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group.`, + MarkdownDescription: `The selector of the EPG uSeg AD Group Attribute object. Represents the DN or expression to select an identity group.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -110,11 +110,11 @@ func (d *FvIdGroupAttrDataSource) Schema(ctx context.Context, req datasource.Sch }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_ad_group_attribute") } func (d *FvIdGroupAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_ad_group_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -132,11 +132,11 @@ func (d *FvIdGroupAttrDataSource) Configure(ctx context.Context, req datasource. } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_ad_group_attribute") } func (d *FvIdGroupAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_ad_group_attribute") var data *FvIdGroupAttrResourceModel // Read Terraform configuration data into the model @@ -151,19 +151,19 @@ func (d *FvIdGroupAttrDataSource) Read(ctx context.Context, req datasource.ReadR // Create a copy of the Id for when not found during getAndSetFvIdGroupAttrAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion_identity_group_attribute data source", - fmt.Sprintf("The aci_epg_useg_criterion_identity_group_attribute data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_ad_group_attribute data source", + fmt.Sprintf("The aci_epg_useg_ad_group_attribute data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go b/internal/provider/data_source_aci_epg_useg_ad_group_attribute_test.go similarity index 51% rename from internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go rename to internal/provider/data_source_aci_epg_useg_ad_group_attribute_test.go index 7d5b5cbdf..9684f1b32 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_identity_group_attribute_test.go +++ b/internal/provider/data_source_aci_epg_useg_ad_group_attribute_test.go @@ -21,34 +21,34 @@ func TestAccDataSourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvIdGroupAttrDataSourceDependencyWithFvCrtrn, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), ), }, { Config: testConfigFvIdGroupAttrNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_identity_group_attribute data source"), + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_ad_group_attribute data source"), }, }, }) } const testConfigFvIdGroupAttrDataSourceDependencyWithFvCrtrn = testConfigFvIdGroupAttrMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id +data "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" - depends_on = [aci_epg_useg_criterion_identity_group_attribute.test] + depends_on = [aci_epg_useg_ad_group_attribute.test] } ` -const testConfigFvIdGroupAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_criterion_identity_group_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id +const testConfigFvIdGroupAttrNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_ad_group_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng_non_existing" } ` diff --git a/internal/provider/data_source_aci_epg_useg_criterion.go b/internal/provider/data_source_aci_epg_useg_block_statement.go similarity index 75% rename from internal/provider/data_source_aci_epg_useg_criterion.go rename to internal/provider/data_source_aci_epg_useg_block_statement.go index fb36a2639..82fefe889 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion.go +++ b/internal/provider/data_source_aci_epg_useg_block_statement.go @@ -28,21 +28,21 @@ type FvCrtrnDataSource struct { } func (d *FvCrtrnDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_block_statement") + resp.TypeName = req.ProviderTypeName + "_epg_useg_block_statement" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_block_statement") } func (d *FvCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_block_statement") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion datasource for the 'fvCrtrn' class", + MarkdownDescription: "The epg_useg_block_statement datasource for the 'fvCrtrn' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Block Statement object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,23 +50,23 @@ func (d *FvCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaReq }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion object.`, + MarkdownDescription: `The annotation of the EPG uSeg Block Statement object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion object.`, + MarkdownDescription: `The description of the EPG uSeg Block Statement object.`, }, "match": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The Matching Rule Type of the EPG uSeg Criterion object.`, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Block Statement object.`, }, "name": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name of the EPG uSeg Criterion object.`, + MarkdownDescription: `The name of the EPG uSeg Block Statement object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion object.`, + MarkdownDescription: `The name alias of the EPG uSeg Block Statement object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -78,11 +78,11 @@ func (d *FvCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaReq }, "precedence": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The precedence of the EPG uSeg Criterion object.`, + MarkdownDescription: `The precedence of the EPG uSeg Block Statement object.`, }, "scope": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The scope of the EPG uSeg Criterion object.`, + MarkdownDescription: `The scope of the EPG uSeg Block Statement object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -118,11 +118,11 @@ func (d *FvCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaReq }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_block_statement") } func (d *FvCrtrnDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_block_statement") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -140,11 +140,11 @@ func (d *FvCrtrnDataSource) Configure(ctx context.Context, req datasource.Config } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_block_statement") } func (d *FvCrtrnDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_block_statement") var data *FvCrtrnResourceModel // Read Terraform configuration data into the model @@ -159,19 +159,19 @@ func (d *FvCrtrnDataSource) Read(ctx context.Context, req datasource.ReadRequest // Create a copy of the Id for when not found during getAndSetFvCrtrnAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion data source", - fmt.Sprintf("The aci_epg_useg_criterion data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_block_statement data source", + fmt.Sprintf("The aci_epg_useg_block_statement data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_criterion_test.go b/internal/provider/data_source_aci_epg_useg_block_statement_test.go similarity index 52% rename from internal/provider/data_source_aci_epg_useg_criterion_test.go rename to internal/provider/data_source_aci_epg_useg_block_statement_test.go index 165f5a50a..f0300d3e0 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_test.go +++ b/internal/provider/data_source_aci_epg_useg_block_statement_test.go @@ -21,34 +21,34 @@ func TestAccDataSourceFvCrtrnWithFvAEPg(t *testing.T) { Config: testConfigFvCrtrnDataSourceDependencyWithFvAEPg, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion.test", "scope", "scope-bd"), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("data.aci_epg_useg_block_statement.test", "scope", "scope-bd"), ), }, { Config: testConfigFvCrtrnNotExistingFvAEPg, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion data source"), + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_block_statement data source"), }, }, }) } const testConfigFvCrtrnDataSourceDependencyWithFvAEPg = testConfigFvCrtrnMinDependencyWithFvAEPg + ` -data "aci_epg_useg_criterion" "test" { +data "aci_epg_useg_block_statement" "test" { parent_dn = aci_application_epg.test.id - depends_on = [aci_epg_useg_criterion.test] + depends_on = [aci_epg_useg_block_statement.test] } ` const testConfigFvCrtrnNotExistingFvAEPg = testConfigFvAEPgMin + ` -data "aci_epg_useg_criterion" "test_non_existing" { +data "aci_epg_useg_block_statement" "test_non_existing" { parent_dn = aci_application_epg.test.id } ` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go deleted file mode 100644 index 68eed806c..000000000 --- a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute_test.go +++ /dev/null @@ -1,55 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "regexp" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccDataSourceFvIpAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - { - Config: testConfigFvIpAttrDataSourceDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - ), - }, - { - Config: testConfigFvIpAttrNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_ip_attribute data source"), - }, - }, - }) -} - -const testConfigFvIpAttrDataSourceDependencyWithFvCrtrn = testConfigFvIpAttrMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "131" - depends_on = [aci_epg_useg_criterion_ip_attribute.test] -} -` - -const testConfigFvIpAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_criterion_ip_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id - name = "131_non_existing" -} -` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go b/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go deleted file mode 100644 index 38d78c40e..000000000 --- a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute_test.go +++ /dev/null @@ -1,102 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "regexp" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccDataSourceFvVmAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - { - Config: testConfigFvVmAttrDataSourceDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - { - Config: testConfigFvVmAttrNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_vm_attribute data source"), - }, - }, - }) -} -func TestAccDataSourceFvVmAttrWithFvSCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - { - Config: testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - { - Config: testConfigFvVmAttrNotExistingFvSCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_vm_attribute data source"), - }, - }, - }) -} - -const testConfigFvVmAttrDataSourceDependencyWithFvCrtrn = testConfigFvVmAttrMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - depends_on = [aci_epg_useg_criterion_vm_attribute.test] -} -` - -const testConfigFvVmAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_criterion_vm_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute_non_existing" -} -` -const testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn = testConfigFvVmAttrMinDependencyWithFvSCrtrn + ` -data "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - depends_on = [aci_epg_useg_criterion_vm_attribute.test] -} -` - -const testConfigFvVmAttrNotExistingFvSCrtrn = testConfigFvSCrtrnMin + ` -data "aci_epg_useg_criterion_vm_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute_non_existing" -} -` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go b/internal/provider/data_source_aci_epg_useg_dns_attribute.go similarity index 74% rename from internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go rename to internal/provider/data_source_aci_epg_useg_dns_attribute.go index 74edbdbcb..c3b988c0b 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute.go +++ b/internal/provider/data_source_aci_epg_useg_dns_attribute.go @@ -28,21 +28,21 @@ type FvDnsAttrDataSource struct { } func (d *FvDnsAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_dns_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_dns_attribute" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_dns_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_dns_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_dns_attribute") } func (d *FvDnsAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_dns_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_dns_attribute datasource for the 'fvDnsAttr' class", + MarkdownDescription: "The epg_useg_dns_attribute datasource for the 'fvDnsAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg DNS Attribute object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,23 +50,23 @@ func (d *FvDnsAttrDataSource) Schema(ctx context.Context, req datasource.SchemaR }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg DNS Attribute object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg DNS Attribute object.`, }, "filter": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The domain name filter of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The domain name filter of the EPG uSeg DNS Attribute object.`, }, "name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The name of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg DNS Attribute object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg DNS Attribute object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -110,11 +110,11 @@ func (d *FvDnsAttrDataSource) Schema(ctx context.Context, req datasource.SchemaR }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_dns_attribute") } func (d *FvDnsAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_dns_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -132,11 +132,11 @@ func (d *FvDnsAttrDataSource) Configure(ctx context.Context, req datasource.Conf } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_dns_attribute") } func (d *FvDnsAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_dns_attribute") var data *FvDnsAttrResourceModel // Read Terraform configuration data into the model @@ -151,19 +151,19 @@ func (d *FvDnsAttrDataSource) Read(ctx context.Context, req datasource.ReadReque // Create a copy of the Id for when not found during getAndSetFvDnsAttrAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion_dns_attribute data source", - fmt.Sprintf("The aci_epg_useg_criterion_dns_attribute data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_dns_attribute data source", + fmt.Sprintf("The aci_epg_useg_dns_attribute data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go b/internal/provider/data_source_aci_epg_useg_dns_attribute_test.go similarity index 52% rename from internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go rename to internal/provider/data_source_aci_epg_useg_dns_attribute_test.go index bae4d8cba..0e44bd12c 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_dns_attribute_test.go +++ b/internal/provider/data_source_aci_epg_useg_dns_attribute_test.go @@ -21,34 +21,34 @@ func TestAccDataSourceFvDnsAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvDnsAttrDataSourceDependencyWithFvCrtrn, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_dns_attribute.test", "owner_tag", ""), ), }, { Config: testConfigFvDnsAttrNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_dns_attribute data source"), + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_dns_attribute data source"), }, }, }) } const testConfigFvDnsAttrDataSourceDependencyWithFvCrtrn = testConfigFvDnsAttrMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id +data "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id name = "dns_attribute" - depends_on = [aci_epg_useg_criterion_dns_attribute.test] + depends_on = [aci_epg_useg_dns_attribute.test] } ` -const testConfigFvDnsAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_criterion_dns_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id +const testConfigFvDnsAttrNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_dns_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id name = "dns_attribute_non_existing" } ` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go b/internal/provider/data_source_aci_epg_useg_ip_attribute.go similarity index 74% rename from internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go rename to internal/provider/data_source_aci_epg_useg_ip_attribute.go index 7394310de..914f8246e 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_ip_attribute.go +++ b/internal/provider/data_source_aci_epg_useg_ip_attribute.go @@ -28,21 +28,21 @@ type FvIpAttrDataSource struct { } func (d *FvIpAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_ip_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_ip_attribute" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_ip_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_ip_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_ip_attribute") } func (d *FvIpAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_ip_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_ip_attribute datasource for the 'fvIpAttr' class", + MarkdownDescription: "The epg_useg_ip_attribute datasource for the 'fvIpAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg IP Attribute object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,23 +50,23 @@ func (d *FvIpAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg IP Attribute object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg IP Attribute object.`, }, "ip": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The device IP address of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The device IP address of the EPG uSeg IP Attribute object.`, }, "name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The name of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg IP Attribute object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg IP Attribute object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -78,7 +78,7 @@ func (d *FvIpAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, "use_fv_subnet": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The usefvSubnet flag of the EPG uSeg IP Attribute object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -114,11 +114,11 @@ func (d *FvIpAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_ip_attribute") } func (d *FvIpAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_ip_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -136,11 +136,11 @@ func (d *FvIpAttrDataSource) Configure(ctx context.Context, req datasource.Confi } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_ip_attribute") } func (d *FvIpAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_ip_attribute") var data *FvIpAttrResourceModel // Read Terraform configuration data into the model @@ -155,19 +155,19 @@ func (d *FvIpAttrDataSource) Read(ctx context.Context, req datasource.ReadReques // Create a copy of the Id for when not found during getAndSetFvIpAttrAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion_ip_attribute data source", - fmt.Sprintf("The aci_epg_useg_criterion_ip_attribute data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_ip_attribute data source", + fmt.Sprintf("The aci_epg_useg_ip_attribute data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_ip_attribute_test.go b/internal/provider/data_source_aci_epg_useg_ip_attribute_test.go new file mode 100644 index 000000000..7379ec179 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_ip_attribute_test.go @@ -0,0 +1,55 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvIpAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvIpAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + { + Config: testConfigFvIpAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_ip_attribute data source"), + }, + }, + }) +} + +const testConfigFvIpAttrDataSourceDependencyWithFvCrtrn = testConfigFvIpAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "131" + depends_on = [aci_epg_useg_ip_attribute.test] +} +` + +const testConfigFvIpAttrNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_ip_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "131_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go b/internal/provider/data_source_aci_epg_useg_mac_attribute.go similarity index 74% rename from internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go rename to internal/provider/data_source_aci_epg_useg_mac_attribute.go index 7f9d60e24..7c1e5b2c1 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute.go +++ b/internal/provider/data_source_aci_epg_useg_mac_attribute.go @@ -28,21 +28,21 @@ type FvMacAttrDataSource struct { } func (d *FvMacAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_mac_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_mac_attribute" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_mac_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_mac_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_mac_attribute") } func (d *FvMacAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_mac_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_mac_attribute datasource for the 'fvMacAttr' class", + MarkdownDescription: "The epg_useg_mac_attribute datasource for the 'fvMacAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg MAC Attribute object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,23 +50,23 @@ func (d *FvMacAttrDataSource) Schema(ctx context.Context, req datasource.SchemaR }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg MAC Attribute object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg MAC Attribute object.`, }, "mac": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The MAC address of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The MAC address of the EPG uSeg MAC Attribute object.`, }, "name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The name of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg MAC Attribute object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg MAC Attribute object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -110,11 +110,11 @@ func (d *FvMacAttrDataSource) Schema(ctx context.Context, req datasource.SchemaR }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_mac_attribute") } func (d *FvMacAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_mac_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -132,11 +132,11 @@ func (d *FvMacAttrDataSource) Configure(ctx context.Context, req datasource.Conf } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_mac_attribute") } func (d *FvMacAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_mac_attribute") var data *FvMacAttrResourceModel // Read Terraform configuration data into the model @@ -151,19 +151,19 @@ func (d *FvMacAttrDataSource) Read(ctx context.Context, req datasource.ReadReque // Create a copy of the Id for when not found during getAndSetFvMacAttrAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion_mac_attribute data source", - fmt.Sprintf("The aci_epg_useg_criterion_mac_attribute data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_mac_attribute data source", + fmt.Sprintf("The aci_epg_useg_mac_attribute data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go b/internal/provider/data_source_aci_epg_useg_mac_attribute_test.go similarity index 52% rename from internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go rename to internal/provider/data_source_aci_epg_useg_mac_attribute_test.go index ef975cc93..a93801104 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_mac_attribute_test.go +++ b/internal/provider/data_source_aci_epg_useg_mac_attribute_test.go @@ -21,34 +21,34 @@ func TestAccDataSourceFvMacAttrWithFvCrtrn(t *testing.T) { Config: testConfigFvMacAttrDataSourceDependencyWithFvCrtrn, ExpectNonEmptyPlan: false, Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_mac_attribute.test", "owner_tag", ""), ), }, { Config: testConfigFvMacAttrNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_criterion_mac_attribute data source"), + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_mac_attribute data source"), }, }, }) } const testConfigFvMacAttrDataSourceDependencyWithFvCrtrn = testConfigFvMacAttrMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id +data "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id name = "mac_attr" - depends_on = [aci_epg_useg_criterion_mac_attribute.test] + depends_on = [aci_epg_useg_mac_attribute.test] } ` -const testConfigFvMacAttrNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_criterion_mac_attribute" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id +const testConfigFvMacAttrNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_mac_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id name = "mac_attr_non_existing" } ` diff --git a/internal/provider/data_source_aci_epg_useg_sub_criterion.go b/internal/provider/data_source_aci_epg_useg_sub_block_statement.go similarity index 81% rename from internal/provider/data_source_aci_epg_useg_sub_criterion.go rename to internal/provider/data_source_aci_epg_useg_sub_block_statement.go index f3e831d57..3c80cdf14 100644 --- a/internal/provider/data_source_aci_epg_useg_sub_criterion.go +++ b/internal/provider/data_source_aci_epg_useg_sub_block_statement.go @@ -28,21 +28,21 @@ type FvSCrtrnDataSource struct { } func (d *FvSCrtrnDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_sub_criterion") - resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_criterion" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_sub_block_statement") + resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_block_statement" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_sub_block_statement") } func (d *FvSCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_sub_block_statement") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_sub_criterion datasource for the 'fvSCrtrn' class", + MarkdownDescription: "The epg_useg_sub_block_statement datasource for the 'fvSCrtrn' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Criterion object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Block Statement object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,23 +50,23 @@ func (d *FvSCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The annotation of the EPG uSeg Sub Block Statement object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The description of the EPG uSeg Sub Block Statement object.`, }, "match": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Block Statement object.`, }, "name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The name of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The name of the EPG uSeg Sub Block Statement object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The name alias of the EPG uSeg Sub Block Statement object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -110,11 +110,11 @@ func (d *FvSCrtrnDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_sub_block_statement") } func (d *FvSCrtrnDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_sub_block_statement") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -132,11 +132,11 @@ func (d *FvSCrtrnDataSource) Configure(ctx context.Context, req datasource.Confi } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_sub_block_statement") } func (d *FvSCrtrnDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_sub_block_statement") var data *FvSCrtrnResourceModel // Read Terraform configuration data into the model @@ -151,19 +151,19 @@ func (d *FvSCrtrnDataSource) Read(ctx context.Context, req datasource.ReadReques // Create a copy of the Id for when not found during getAndSetFvSCrtrnAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_sub_criterion data source", - fmt.Sprintf("The aci_epg_useg_sub_criterion data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_sub_block_statement data source", + fmt.Sprintf("The aci_epg_useg_sub_block_statement data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_sub_block_statement_test.go b/internal/provider/data_source_aci_epg_useg_sub_block_statement_test.go new file mode 100644 index 000000000..0e820ac30 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_sub_block_statement_test.go @@ -0,0 +1,94 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvSCrtrnWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "name", "sub_criterion"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + ), + }, + { + Config: testConfigFvSCrtrnNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_sub_block_statement data source"), + }, + }, + }) +} +func TestAccDataSourceFvSCrtrnWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvSCrtrnDataSourceDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + ), + }, + { + Config: testConfigFvSCrtrnNotExistingFvSCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_sub_block_statement data source"), + }, + }, + }) +} + +const testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + depends_on = [aci_epg_useg_sub_block_statement.test] +} +` + +const testConfigFvSCrtrnNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_sub_block_statement" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion_non_existing" +} +` +const testConfigFvSCrtrnDataSourceDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvSCrtrn + ` +data "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + depends_on = [aci_epg_useg_sub_block_statement.test1] +} +` + +const testConfigFvSCrtrnNotExistingFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_sub_block_statement" "test_non_existing" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion_non_existing" +} +` diff --git a/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go b/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go deleted file mode 100644 index e74440e61..000000000 --- a/internal/provider/data_source_aci_epg_useg_sub_criterion_test.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "regexp" - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccDataSourceFvSCrtrnWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - { - Config: testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("data.aci_epg_useg_sub_criterion.test", "owner_tag", ""), - ), - }, - { - Config: testConfigFvSCrtrnNotExistingFvCrtrn, - ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_sub_criterion data source"), - }, - }, - }) -} - -const testConfigFvSCrtrnDataSourceDependencyWithFvCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` -data "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - depends_on = [aci_epg_useg_sub_criterion.test] -} -` - -const testConfigFvSCrtrnNotExistingFvCrtrn = testConfigFvCrtrnMin + ` -data "aci_epg_useg_sub_criterion" "test_non_existing" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion_non_existing" -} -` diff --git a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go b/internal/provider/data_source_aci_epg_useg_vm_attribute.go similarity index 71% rename from internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go rename to internal/provider/data_source_aci_epg_useg_vm_attribute.go index 4f60662f5..dea35be8e 100644 --- a/internal/provider/data_source_aci_epg_useg_criterion_vm_attribute.go +++ b/internal/provider/data_source_aci_epg_useg_vm_attribute.go @@ -28,21 +28,21 @@ type FvVmAttrDataSource struct { } func (d *FvVmAttrDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_criterion_vm_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_vm_attribute" - tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start metadata of datasource: aci_epg_useg_vm_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_vm_attribute" + tflog.Debug(ctx, "End metadata of datasource: aci_epg_useg_vm_attribute") } func (d *FvVmAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start schema of datasource: aci_epg_useg_vm_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_vm_attribute datasource for the 'fvVmAttr' class", + MarkdownDescription: "The epg_useg_vm_attribute datasource for the 'fvVmAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg VM Attribute object.", }, "parent_dn": schema.StringAttribute{ Required: true, @@ -50,31 +50,31 @@ func (d *FvVmAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, "annotation": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The annotation of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg VM Attribute object.`, }, "category": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The category of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The category of the EPG uSeg VM Attribute object.`, }, "description": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The description of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg VM Attribute object.`, }, "label_name": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The label name of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The label name of the EPG uSeg VM Attribute object.`, }, "name": schema.StringAttribute{ Required: true, - MarkdownDescription: `The name of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg VM Attribute object.`, }, "name_alias": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The name alias of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg VM Attribute object.`, }, "operator": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The operator of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The operator of the EPG uSeg VM Attribute object.`, }, "owner_key": schema.StringAttribute{ Computed: true, @@ -86,11 +86,11 @@ func (d *FvVmAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, "type": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The type of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The type of the EPG uSeg VM Attribute object.`, }, "value": schema.StringAttribute{ Computed: true, - MarkdownDescription: `The value of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The value of the EPG uSeg VM Attribute object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -126,11 +126,11 @@ func (d *FvVmAttrDataSource) Schema(ctx context.Context, req datasource.SchemaRe }, }, } - tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "End schema of datasource: aci_epg_useg_vm_attribute") } func (d *FvVmAttrDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start configure of datasource: aci_epg_useg_vm_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -148,11 +148,11 @@ func (d *FvVmAttrDataSource) Configure(ctx context.Context, req datasource.Confi } d.client = client - tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "End configure of datasource: aci_epg_useg_vm_attribute") } func (d *FvVmAttrDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { - tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start read of datasource: aci_epg_useg_vm_attribute") var data *FvVmAttrResourceModel // Read Terraform configuration data into the model @@ -167,19 +167,19 @@ func (d *FvVmAttrDataSource) Read(ctx context.Context, req datasource.ReadReques // Create a copy of the Id for when not found during getAndSetFvVmAttrAttributes cachedId := data.Id.ValueString() - tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, d.client, data) if data.Id.IsNull() { resp.Diagnostics.AddError( - "Failed to read aci_epg_useg_criterion_vm_attribute data source", - fmt.Sprintf("The aci_epg_useg_criterion_vm_attribute data source with id '%s' has not been found", cachedId), + "Failed to read aci_epg_useg_vm_attribute data source", + fmt.Sprintf("The aci_epg_useg_vm_attribute data source with id '%s' has not been found", cachedId), ) return } // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of datasource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) } diff --git a/internal/provider/data_source_aci_epg_useg_vm_attribute_test.go b/internal/provider/data_source_aci_epg_useg_vm_attribute_test.go new file mode 100644 index 000000000..5713d5023 --- /dev/null +++ b/internal/provider/data_source_aci_epg_useg_vm_attribute_test.go @@ -0,0 +1,102 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "regexp" + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccDataSourceFvVmAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvVmAttrDataSourceDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + { + Config: testConfigFvVmAttrNotExistingFvCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_vm_attribute data source"), + }, + }, + }) +} +func TestAccDataSourceFvVmAttrWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("data.aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + { + Config: testConfigFvVmAttrNotExistingFvSCrtrn, + ExpectError: regexp.MustCompile("Failed to read aci_epg_useg_vm_attribute data source"), + }, + }, + }) +} + +const testConfigFvVmAttrDataSourceDependencyWithFvCrtrn = testConfigFvVmAttrMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + depends_on = [aci_epg_useg_vm_attribute.test] +} +` + +const testConfigFvVmAttrNotExistingFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +data "aci_epg_useg_vm_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute_non_existing" +} +` +const testConfigFvVmAttrDataSourceDependencyWithFvSCrtrn = testConfigFvVmAttrMinDependencyWithFvSCrtrn + ` +data "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + depends_on = [aci_epg_useg_vm_attribute.test] +} +` + +const testConfigFvVmAttrNotExistingFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +data "aci_epg_useg_vm_attribute" "test_non_existing" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute_non_existing" +} +` diff --git a/internal/provider/data_source_aci_external_management_network_instance_profile_test.go b/internal/provider/data_source_aci_external_management_network_instance_profile_test.go index 61624449f..b541fa23b 100644 --- a/internal/provider/data_source_aci_external_management_network_instance_profile_test.go +++ b/internal/provider/data_source_aci_external_management_network_instance_profile_test.go @@ -42,7 +42,7 @@ data "aci_external_management_network_instance_profile" "test" { ` const testConfigMgmtInstPNotExisting = testConfigMgmtInstPAll + ` -data "aci_external_management_network_instance_profile" "test" { +data "aci_external_management_network_instance_profile" "test_non_existing" { name = "non_existing_name" depends_on = [aci_external_management_network_instance_profile.test] } diff --git a/internal/provider/data_source_aci_netflow_record_policy_test.go b/internal/provider/data_source_aci_netflow_record_policy_test.go index 3744ffb83..ecfaf204f 100644 --- a/internal/provider/data_source_aci_netflow_record_policy_test.go +++ b/internal/provider/data_source_aci_netflow_record_policy_test.go @@ -48,10 +48,9 @@ data "aci_netflow_record_policy" "test" { } ` -const testConfigNetflowRecordPolNotExistingFvTenant = testConfigNetflowRecordPolMinDependencyWithFvTenant + ` +const testConfigNetflowRecordPolNotExistingFvTenant = testConfigFvTenantMin + ` data "aci_netflow_record_policy" "test_non_existing" { parent_dn = aci_tenant.test.id name = "netfow_record_non_existing" - depends_on = [aci_netflow_record_policy.test] } ` diff --git a/internal/provider/data_source_aci_out_of_band_contract_test.go b/internal/provider/data_source_aci_out_of_band_contract_test.go index 3c8a3d2a1..ae03e399e 100644 --- a/internal/provider/data_source_aci_out_of_band_contract_test.go +++ b/internal/provider/data_source_aci_out_of_band_contract_test.go @@ -47,7 +47,7 @@ data "aci_out_of_band_contract" "test" { ` const testConfigVzOOBBrCPNotExisting = testConfigVzOOBBrCPAll + ` -data "aci_out_of_band_contract" "test" { +data "aci_out_of_band_contract" "test_non_existing" { name = "non_existing_name" depends_on = [aci_out_of_band_contract.test] } diff --git a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go b/internal/provider/resource_aci_epg_useg_ad_group_attribute.go similarity index 89% rename from internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go rename to internal/provider/resource_aci_epg_useg_ad_group_attribute.go index 0bcfee622..dc5c6450b 100644 --- a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute.go +++ b/internal/provider/resource_aci_epg_useg_ad_group_attribute.go @@ -71,21 +71,21 @@ type FvIdGroupAttrIdentifier struct { } func (r *FvIdGroupAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_identity_group_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_identity_group_attribute" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_ad_group_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_ad_group_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_ad_group_attribute") } func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_ad_group_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_identity_group_attribute resource for the 'fvIdGroupAttr' class", + MarkdownDescription: "The epg_useg_ad_group_attribute resource for the 'fvIdGroupAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion Identity Group Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg AD Group Attribute object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -105,7 +105,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg AD Group Attribute object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -113,7 +113,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg AD Group Attribute object.`, }, "name": schema.StringAttribute{ Optional: true, @@ -121,7 +121,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg AD Group Attribute object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -129,7 +129,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion Identity Group Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg AD Group Attribute object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -153,7 +153,7 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The selector of the EPG uSeg Criterion Identity Group Attribute object. Represents the DN or expression to select an identity group.`, + MarkdownDescription: `The selector of the EPG uSeg AD Group Attribute object. Represents the DN or expression to select an identity group.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -209,11 +209,11 @@ func (r *FvIdGroupAttrResource) Schema(ctx context.Context, req resource.SchemaR }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_ad_group_attribute") } func (r *FvIdGroupAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_ad_group_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -231,11 +231,11 @@ func (r *FvIdGroupAttrResource) Configure(ctx context.Context, req resource.Conf } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_ad_group_attribute") } func (r *FvIdGroupAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_ad_group_attribute") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvIdGroupAttrResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -253,7 +253,7 @@ func (r *FvIdGroupAttrResource) Create(ctx context.Context, req resource.CreateR setFvIdGroupAttrId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -276,11 +276,11 @@ func (r *FvIdGroupAttrResource) Create(ctx context.Context, req resource.CreateR // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIdGroupAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_ad_group_attribute") var data *FvIdGroupAttrResourceModel // Read Terraform prior state data into the model @@ -290,7 +290,7 @@ func (r *FvIdGroupAttrResource) Read(ctx context.Context, req resource.ReadReque return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) getAndSetFvIdGroupAttrAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -302,11 +302,11 @@ func (r *FvIdGroupAttrResource) Read(ctx context.Context, req resource.ReadReque resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIdGroupAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_ad_group_attribute") var data *FvIdGroupAttrResourceModel var stateData *FvIdGroupAttrResourceModel @@ -318,7 +318,7 @@ func (r *FvIdGroupAttrResource) Update(ctx context.Context, req resource.UpdateR return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIdGroupAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -342,11 +342,11 @@ func (r *FvIdGroupAttrResource) Update(ctx context.Context, req resource.UpdateR // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIdGroupAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_ad_group_attribute") var data *FvIdGroupAttrResourceModel // Read Terraform prior state data into the model @@ -356,7 +356,7 @@ func (r *FvIdGroupAttrResource) Delete(ctx context.Context, req resource.DeleteR return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvIdGroupAttr", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -365,18 +365,18 @@ func (r *FvIdGroupAttrResource) Delete(ctx context.Context, req resource.DeleteR if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_ad_group_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIdGroupAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_ad_group_attribute") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvIdGroupAttrResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_identity_group_attribute with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_ad_group_attribute with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_identity_group_attribute") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_ad_group_attribute") } func getAndSetFvIdGroupAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIdGroupAttrResourceModel) { 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 new file mode 100644 index 000000000..363c1d44f --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_ad_group_attribute_test.go @@ -0,0 +1,264 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvIdGroupAttrAllDependencyWithFvCrtrn, + 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", "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"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, + 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"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvIdGroupAttrResetDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_ad_group_attribute.test", + ImportState: true, + ImportStateVerify: true, + 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", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_ad_group_attribute.test", + ImportState: true, + ImportStateVerify: true, + 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", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_ad_group_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvIdGroupAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" +} +` + +const testConfigFvIdGroupAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" +} +` + +const testConfigFvIdGroupAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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 = "orchestrator:terraform" + description = "" + name = "" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" +} +` + +const testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion.go b/internal/provider/resource_aci_epg_useg_block_statement.go similarity index 90% rename from internal/provider/resource_aci_epg_useg_criterion.go rename to internal/provider/resource_aci_epg_useg_block_statement.go index faab92827..3d380baa9 100644 --- a/internal/provider/resource_aci_epg_useg_criterion.go +++ b/internal/provider/resource_aci_epg_useg_block_statement.go @@ -69,21 +69,21 @@ type TagTagFvCrtrnResourceModel struct { } func (r *FvCrtrnResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_block_statement") + resp.TypeName = req.ProviderTypeName + "_epg_useg_block_statement" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_block_statement") } func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_block_statement") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion resource for the 'fvCrtrn' class", + MarkdownDescription: "The epg_useg_block_statement resource for the 'fvCrtrn' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Block Statement object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -103,7 +103,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion object.`, + MarkdownDescription: `The annotation of the EPG uSeg Block Statement object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -111,7 +111,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion object.`, + MarkdownDescription: `The description of the EPG uSeg Block Statement object.`, }, "match": schema.StringAttribute{ Optional: true, @@ -122,7 +122,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Validators: []validator.String{ stringvalidator.OneOf("all", "any"), }, - MarkdownDescription: `The Matching Rule Type of the EPG uSeg Criterion object.`, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Block Statement object.`, }, "name": schema.StringAttribute{ Optional: true, @@ -130,7 +130,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion object.`, + MarkdownDescription: `The name of the EPG uSeg Block Statement object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -138,7 +138,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion object.`, + MarkdownDescription: `The name alias of the EPG uSeg Block Statement object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -162,7 +162,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The precedence of the EPG uSeg Criterion object.`, + MarkdownDescription: `The precedence of the EPG uSeg Block Statement object.`, }, "scope": schema.StringAttribute{ Optional: true, @@ -173,7 +173,7 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest Validators: []validator.String{ stringvalidator.OneOf("scope-bd", "scope-vrf"), }, - MarkdownDescription: `The scope of the EPG uSeg Criterion object.`, + MarkdownDescription: `The scope of the EPG uSeg Block Statement object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -229,11 +229,11 @@ func (r *FvCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_block_statement") } func (r *FvCrtrnResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_block_statement") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -251,11 +251,11 @@ func (r *FvCrtrnResource) Configure(ctx context.Context, req resource.ConfigureR } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_block_statement") } func (r *FvCrtrnResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_block_statement") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvCrtrnResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -273,7 +273,7 @@ func (r *FvCrtrnResource) Create(ctx context.Context, req resource.CreateRequest setFvCrtrnId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -296,11 +296,11 @@ func (r *FvCrtrnResource) Create(ctx context.Context, req resource.CreateRequest // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_block_statement") var data *FvCrtrnResourceModel // Read Terraform prior state data into the model @@ -310,7 +310,7 @@ func (r *FvCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, re return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) getAndSetFvCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -322,11 +322,11 @@ func (r *FvCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, re resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_block_statement") var data *FvCrtrnResourceModel var stateData *FvCrtrnResourceModel @@ -338,7 +338,7 @@ func (r *FvCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvCrtrnResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -362,11 +362,11 @@ func (r *FvCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_block_statement") var data *FvCrtrnResourceModel // Read Terraform prior state data into the model @@ -376,7 +376,7 @@ func (r *FvCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvCrtrn", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -385,18 +385,18 @@ func (r *FvCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvCrtrnResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_block_statement") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvCrtrnResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_block_statement with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_block_statement") } func getAndSetFvCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvCrtrnResourceModel) { diff --git a/internal/provider/resource_aci_epg_useg_block_statement_test.go b/internal/provider/resource_aci_epg_useg_block_statement_test.go new file mode 100644 index 000000000..25fb39f2c --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_block_statement_test.go @@ -0,0 +1,273 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvCrtrnMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvCrtrnAllDependencyWithFvAEPg, + 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", "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", "precedence", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvCrtrnMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc(), + }, + // Update with empty strings config or default value + { + Config: testConfigFvCrtrnResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_block_statement.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + ), + }, + // Update with children + { + Config: testConfigFvCrtrnChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_block_statement.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "precedence", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "scope", "scope-bd"), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_block_statement.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvCrtrnMinDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id +} +` + +const testConfigFvCrtrnAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id + annotation = "annotation" + description = "description" + match = "all" + name = "criterion" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + precedence = "1" + scope = "scope-bd" +} +` + +const testConfigFvCrtrnResetDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id + annotation = "orchestrator:terraform" + description = "" + match = "any" + name = "" + name_alias = "" + owner_key = "" + owner_tag = "" + precedence = "0" + scope = "scope-bd" +} +` +const testConfigFvCrtrnChildrenDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id +} +` + +const testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` +resource "aci_epg_useg_block_statement" "test" { + parent_dn = aci_application_epg.test.id + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go deleted file mode 100644 index 63c1d5ce6..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute_test.go +++ /dev/null @@ -1,264 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvDnsAttrAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", "filter"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", "owner_tag"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvDnsAttrResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_dns_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), - ), - }, - // Update with children - { - Config: testConfigFvDnsAttrChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_dns_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name", "dns_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "filter", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_dns_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvDnsAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" -} -` - -const testConfigFvDnsAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" - annotation = "annotation" - description = "description" - filter = "filter" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" -} -` - -const testConfigFvDnsAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" - annotation = "orchestrator:terraform" - description = "" - filter = "" - name_alias = "" - owner_key = "" - owner_tag = "" -} -` -const testConfigFvDnsAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" -} -` - -const testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_dns_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "dns_attribute" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go deleted file mode 100644 index a0b5f37a5..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_identity_group_attribute_test.go +++ /dev/null @@ -1,264 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvIdGroupAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvIdGroupAttrAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", "name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", "owner_tag"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvIdGroupAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvIdGroupAttrResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_identity_group_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), - ), - }, - // Update with children - { - Config: testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_identity_group_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "selector", "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_identity_group_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvIdGroupAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" -} -` - -const testConfigFvIdGroupAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.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" -} -` - -const testConfigFvIdGroupAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" - annotation = "orchestrator:terraform" - description = "" - name = "" - name_alias = "" - owner_key = "" - owner_tag = "" -} -` -const testConfigFvIdGroupAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvIdGroupAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" -} -` - -const testConfigFvIdGroupAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvIdGroupAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_identity_group_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - selector = "adepg/authsvr-common-sg1-ISE_1/grpcont/dom-cisco.com/grp-Eng" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go deleted file mode 100644 index 7767ebba7..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute_test.go +++ /dev/null @@ -1,278 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvIpAttrAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "0.0.0.0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", "owner_tag"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "yes"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvIpAttrResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_ip_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - ), - }, - // Update with children - { - Config: testConfigFvIpAttrChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_ip_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "ip", "131.107.1.200"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name", "131"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "use_fv_subnet", "no"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_ip_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvIpAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - ip = "131.107.1.200" - name = "131" -} -` - -const testConfigFvIpAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "131" - annotation = "annotation" - description = "description" - ip = "0.0.0.0" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" - use_fv_subnet = "yes" -} -` - -const testConfigFvIpAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "131" - annotation = "orchestrator:terraform" - description = "" - ip = "131.107.1.200" - name_alias = "" - owner_key = "" - owner_tag = "" - use_fv_subnet = "no" -} -` -const testConfigFvIpAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - ip = "131.107.1.200" - name = "131" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - ip = "131.107.1.200" - name = "131" -} -` - -const testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - ip = "131.107.1.200" - name = "131" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_ip_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - ip = "131.107.1.200" - name = "131" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go deleted file mode 100644 index b4be658ed..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute_test.go +++ /dev/null @@ -1,270 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvMacAttrAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:BB:BB:EE"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", "owner_tag"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvMacAttrResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_mac_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), - ), - }, - // Update with children - { - Config: testConfigFvMacAttrChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_mac_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name", "mac_attr"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_mac_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvMacAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" -} -` - -const testConfigFvMacAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "mac_attr" - annotation = "annotation" - description = "description" - mac = "AA:BB:CC:BB:BB:EE" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" -} -` - -const testConfigFvMacAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "mac_attr" - annotation = "orchestrator:terraform" - description = "" - mac = "AA:BB:CC:DD:EE:FF" - name_alias = "" - owner_key = "" - owner_tag = "" -} -` -const testConfigFvMacAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" -} -` - -const testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_mac_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - mac = "AA:BB:CC:DD:EE:FF" - name = "mac_attr" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_test.go b/internal/provider/resource_aci_epg_useg_criterion_test.go deleted file mode 100644 index 75d7db374..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_test.go +++ /dev/null @@ -1,273 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvCrtrnWithFvAEPg(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvCrtrnMinDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvCrtrnAllDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "all"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", "criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", "owner_tag"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvCrtrnMinDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc(), - }, - // Update with empty strings config or default value - { - Config: testConfigFvCrtrnResetDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - ), - }, - // Update with children - { - Config: testConfigFvCrtrnChildrenDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "precedence", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "scope", "scope-bd"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvCrtrnMinDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id -} -` - -const testConfigFvCrtrnAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id - annotation = "annotation" - description = "description" - match = "all" - name = "criterion" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" - precedence = "1" - scope = "scope-bd" -} -` - -const testConfigFvCrtrnResetDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id - annotation = "orchestrator:terraform" - description = "" - match = "any" - name = "" - name_alias = "" - owner_key = "" - owner_tag = "" - precedence = "0" - scope = "scope-bd" -} -` -const testConfigFvCrtrnChildrenDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvCrtrnChildrenRemoveFromConfigDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id -} -` - -const testConfigFvCrtrnChildrenRemoveOneDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvCrtrnChildrenRemoveAllDependencyWithFvAEPg = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go b/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go deleted file mode 100644 index 78c36f63c..000000000 --- a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute_test.go +++ /dev/null @@ -1,592 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvVmAttrAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", "all_category"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", "label_name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "contains"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", "owner_tag"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "domain"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "all_value"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvVmAttrResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_vm_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - ), - }, - // Update with children - { - Config: testConfigFvVmAttrChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_vm_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} -func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvVmAttrAllDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", "all_category"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", "label_name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "contains"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", "owner_tag"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "domain"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "all_value"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvVmAttrResetDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_criterion_vm_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - ), - }, - // Update with children - { - Config: testConfigFvVmAttrChildrenDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_criterion_vm_attribute.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name", "vm_attribute"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "value", "default_value"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "category", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "label_name", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "operator", "equals"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "type", "vm-name"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_criterion_vm_attribute.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvVmAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - value = "default_value" -} -` - -const testConfigFvVmAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - annotation = "annotation" - category = "all_category" - description = "description" - label_name = "label_name" - name_alias = "name_alias" - operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" - type = "domain" - value = "all_value" -} -` - -const testConfigFvVmAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - annotation = "orchestrator:terraform" - category = "" - description = "" - label_name = "" - name_alias = "" - operator = "equals" - owner_key = "" - owner_tag = "" - type = "vm-name" - value = "default_value" -} -` -const testConfigFvVmAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - value = "default_value" -} -` - -const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [] - tags = [] -} -` - -const testConfigFvVmAttrMinDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - value = "default_value" -} -` - -const testConfigFvVmAttrAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - annotation = "annotation" - category = "all_category" - description = "description" - label_name = "label_name" - name_alias = "name_alias" - operator = "contains" - owner_key = "owner_key" - owner_tag = "owner_tag" - type = "domain" - value = "all_value" -} -` - -const testConfigFvVmAttrResetDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - annotation = "orchestrator:terraform" - category = "" - description = "" - label_name = "" - name_alias = "" - operator = "equals" - owner_key = "" - owner_tag = "" - type = "vm-name" - value = "default_value" -} -` -const testConfigFvVmAttrChildrenDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - value = "default_value" -} -` - -const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMin + ` -resource "aci_epg_useg_criterion_vm_attribute" "test" { - parent_dn = aci_epg_useg_sub_criterion.test.id - name = "vm_attribute" - value = "default_value" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go b/internal/provider/resource_aci_epg_useg_dns_attribute.go similarity index 90% rename from internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go rename to internal/provider/resource_aci_epg_useg_dns_attribute.go index 0e6ec59e6..8e648dc31 100644 --- a/internal/provider/resource_aci_epg_useg_criterion_dns_attribute.go +++ b/internal/provider/resource_aci_epg_useg_dns_attribute.go @@ -71,21 +71,21 @@ type FvDnsAttrIdentifier struct { } func (r *FvDnsAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_dns_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_dns_attribute" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_dns_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_dns_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_dns_attribute") } func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_dns_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_dns_attribute resource for the 'fvDnsAttr' class", + MarkdownDescription: "The epg_useg_dns_attribute resource for the 'fvDnsAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion DNS Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg DNS Attribute object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -105,7 +105,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg DNS Attribute object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -113,7 +113,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg DNS Attribute object.`, }, "filter": schema.StringAttribute{ Optional: true, @@ -121,7 +121,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The domain name filter of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The domain name filter of the EPG uSeg DNS Attribute object.`, }, "name": schema.StringAttribute{ Required: true, @@ -129,7 +129,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg DNS Attribute object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -137,7 +137,7 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion DNS Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg DNS Attribute object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -209,11 +209,11 @@ func (r *FvDnsAttrResource) Schema(ctx context.Context, req resource.SchemaReque }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_dns_attribute") } func (r *FvDnsAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_dns_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -231,11 +231,11 @@ func (r *FvDnsAttrResource) Configure(ctx context.Context, req resource.Configur } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_dns_attribute") } func (r *FvDnsAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_dns_attribute") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvDnsAttrResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -253,7 +253,7 @@ func (r *FvDnsAttrResource) Create(ctx context.Context, req resource.CreateReque setFvDnsAttrId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -276,11 +276,11 @@ func (r *FvDnsAttrResource) Create(ctx context.Context, req resource.CreateReque // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) } func (r *FvDnsAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_dns_attribute") var data *FvDnsAttrResourceModel // Read Terraform prior state data into the model @@ -290,7 +290,7 @@ func (r *FvDnsAttrResource) Read(ctx context.Context, req resource.ReadRequest, return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) getAndSetFvDnsAttrAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -302,11 +302,11 @@ func (r *FvDnsAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) } func (r *FvDnsAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_dns_attribute") var data *FvDnsAttrResourceModel var stateData *FvDnsAttrResourceModel @@ -318,7 +318,7 @@ func (r *FvDnsAttrResource) Update(ctx context.Context, req resource.UpdateReque return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvDnsAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -342,11 +342,11 @@ func (r *FvDnsAttrResource) Update(ctx context.Context, req resource.UpdateReque // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) } func (r *FvDnsAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_dns_attribute") var data *FvDnsAttrResourceModel // Read Terraform prior state data into the model @@ -356,7 +356,7 @@ func (r *FvDnsAttrResource) Delete(ctx context.Context, req resource.DeleteReque return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvDnsAttr", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -365,18 +365,18 @@ func (r *FvDnsAttrResource) Delete(ctx context.Context, req resource.DeleteReque if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_dns_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_dns_attribute with id '%s'", data.Id.ValueString())) } func (r *FvDnsAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_dns_attribute") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvDnsAttrResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_dns_attribute with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_dns_attribute with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_dns_attribute") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_dns_attribute") } func getAndSetFvDnsAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvDnsAttrResourceModel) { diff --git a/internal/provider/resource_aci_epg_useg_dns_attribute_test.go b/internal/provider/resource_aci_epg_useg_dns_attribute_test.go new file mode 100644 index 000000000..b432e040a --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_dns_attribute_test.go @@ -0,0 +1,264 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvDnsAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvDnsAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + 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"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvDnsAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvDnsAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_dns_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvDnsAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_dns_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name", "dns_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "filter", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_dns_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvDnsAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" +} +` + +const testConfigFvDnsAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +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" +} +` + +const testConfigFvDnsAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" + annotation = "orchestrator:terraform" + description = "" + filter = "" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvDnsAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvDnsAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" +} +` + +const testConfigFvDnsAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvDnsAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_dns_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "dns_attribute" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go b/internal/provider/resource_aci_epg_useg_ip_attribute.go similarity index 90% rename from internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go rename to internal/provider/resource_aci_epg_useg_ip_attribute.go index 48012f3e2..ad70c7bc7 100644 --- a/internal/provider/resource_aci_epg_useg_criterion_ip_attribute.go +++ b/internal/provider/resource_aci_epg_useg_ip_attribute.go @@ -74,21 +74,21 @@ type FvIpAttrIdentifier struct { } func (r *FvIpAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_ip_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_ip_attribute" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_ip_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_ip_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_ip_attribute") } func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_ip_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_ip_attribute resource for the 'fvIpAttr' class", + MarkdownDescription: "The epg_useg_ip_attribute resource for the 'fvIpAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion IP Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg IP Attribute object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -108,7 +108,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg IP Attribute object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -116,14 +116,14 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg IP Attribute object.`, }, "ip": schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The device IP address of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The device IP address of the EPG uSeg IP Attribute object.`, }, "name": schema.StringAttribute{ Required: true, @@ -131,7 +131,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg IP Attribute object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -139,7 +139,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg IP Attribute object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -166,7 +166,7 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.OneOf("no", "yes"), }, - MarkdownDescription: `The usefvSubnet flag of the EPG uSeg Criterion IP Attribute object.`, + MarkdownDescription: `The usefvSubnet flag of the EPG uSeg IP Attribute object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -222,11 +222,11 @@ func (r *FvIpAttrResource) Schema(ctx context.Context, req resource.SchemaReques }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_ip_attribute") } func (r *FvIpAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_ip_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -244,11 +244,11 @@ func (r *FvIpAttrResource) Configure(ctx context.Context, req resource.Configure } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_ip_attribute") } func (r *FvIpAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_ip_attribute") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvIpAttrResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -266,7 +266,7 @@ func (r *FvIpAttrResource) Create(ctx context.Context, req resource.CreateReques setFvIpAttrId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -289,11 +289,11 @@ func (r *FvIpAttrResource) Create(ctx context.Context, req resource.CreateReques // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIpAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_ip_attribute") var data *FvIpAttrResourceModel // Read Terraform prior state data into the model @@ -303,7 +303,7 @@ func (r *FvIpAttrResource) Read(ctx context.Context, req resource.ReadRequest, r return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) getAndSetFvIpAttrAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -315,11 +315,11 @@ func (r *FvIpAttrResource) Read(ctx context.Context, req resource.ReadRequest, r resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIpAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_ip_attribute") var data *FvIpAttrResourceModel var stateData *FvIpAttrResourceModel @@ -331,7 +331,7 @@ func (r *FvIpAttrResource) Update(ctx context.Context, req resource.UpdateReques return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvIpAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -355,11 +355,11 @@ func (r *FvIpAttrResource) Update(ctx context.Context, req resource.UpdateReques // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIpAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_ip_attribute") var data *FvIpAttrResourceModel // Read Terraform prior state data into the model @@ -369,7 +369,7 @@ func (r *FvIpAttrResource) Delete(ctx context.Context, req resource.DeleteReques return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvIpAttr", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -378,18 +378,18 @@ func (r *FvIpAttrResource) Delete(ctx context.Context, req resource.DeleteReques if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_ip_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_ip_attribute with id '%s'", data.Id.ValueString())) } func (r *FvIpAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_ip_attribute") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvIpAttrResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_ip_attribute with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_ip_attribute with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_ip_attribute") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_ip_attribute") } func getAndSetFvIpAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvIpAttrResourceModel) { diff --git a/internal/provider/resource_aci_epg_useg_ip_attribute_test.go b/internal/provider/resource_aci_epg_useg_ip_attribute_test.go new file mode 100644 index 000000000..8121fd3b0 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_ip_attribute_test.go @@ -0,0 +1,278 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvIpAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvIpAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + 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", "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", "use_fv_subnet", "yes"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvIpAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvIpAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_ip_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + ), + }, + // Update with children + { + Config: testConfigFvIpAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_ip_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "ip", "131.107.1.200"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name", "131"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "use_fv_subnet", "no"), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_ip_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvIpAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + ip = "131.107.1.200" + name = "131" +} +` + +const testConfigFvIpAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "131" + annotation = "annotation" + description = "description" + ip = "0.0.0.0" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + use_fv_subnet = "yes" +} +` + +const testConfigFvIpAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "131" + annotation = "orchestrator:terraform" + description = "" + ip = "131.107.1.200" + name_alias = "" + owner_key = "" + owner_tag = "" + use_fv_subnet = "no" +} +` +const testConfigFvIpAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + ip = "131.107.1.200" + name = "131" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIpAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + ip = "131.107.1.200" + name = "131" +} +` + +const testConfigFvIpAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + ip = "131.107.1.200" + name = "131" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvIpAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_ip_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + ip = "131.107.1.200" + name = "131" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go b/internal/provider/resource_aci_epg_useg_mac_attribute.go similarity index 90% rename from internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go rename to internal/provider/resource_aci_epg_useg_mac_attribute.go index c0568797b..b3953047f 100644 --- a/internal/provider/resource_aci_epg_useg_criterion_mac_attribute.go +++ b/internal/provider/resource_aci_epg_useg_mac_attribute.go @@ -71,21 +71,21 @@ type FvMacAttrIdentifier struct { } func (r *FvMacAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_mac_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_mac_attribute" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_mac_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_mac_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_mac_attribute") } func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_mac_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_mac_attribute resource for the 'fvMacAttr' class", + MarkdownDescription: "The epg_useg_mac_attribute resource for the 'fvMacAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion MAC Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg MAC Attribute object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -105,7 +105,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg MAC Attribute object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -113,14 +113,14 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg MAC Attribute object.`, }, "mac": schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The MAC address of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The MAC address of the EPG uSeg MAC Attribute object.`, }, "name": schema.StringAttribute{ Required: true, @@ -128,7 +128,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg MAC Attribute object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -136,7 +136,7 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion MAC Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg MAC Attribute object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -208,11 +208,11 @@ func (r *FvMacAttrResource) Schema(ctx context.Context, req resource.SchemaReque }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_mac_attribute") } func (r *FvMacAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_mac_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -230,11 +230,11 @@ func (r *FvMacAttrResource) Configure(ctx context.Context, req resource.Configur } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_mac_attribute") } func (r *FvMacAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_mac_attribute") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvMacAttrResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -252,7 +252,7 @@ func (r *FvMacAttrResource) Create(ctx context.Context, req resource.CreateReque setFvMacAttrId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -275,11 +275,11 @@ func (r *FvMacAttrResource) Create(ctx context.Context, req resource.CreateReque // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) } func (r *FvMacAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_mac_attribute") var data *FvMacAttrResourceModel // Read Terraform prior state data into the model @@ -289,7 +289,7 @@ func (r *FvMacAttrResource) Read(ctx context.Context, req resource.ReadRequest, return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) getAndSetFvMacAttrAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -301,11 +301,11 @@ func (r *FvMacAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) } func (r *FvMacAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_mac_attribute") var data *FvMacAttrResourceModel var stateData *FvMacAttrResourceModel @@ -317,7 +317,7 @@ func (r *FvMacAttrResource) Update(ctx context.Context, req resource.UpdateReque return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvMacAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -341,11 +341,11 @@ func (r *FvMacAttrResource) Update(ctx context.Context, req resource.UpdateReque // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) } func (r *FvMacAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_mac_attribute") var data *FvMacAttrResourceModel // Read Terraform prior state data into the model @@ -355,7 +355,7 @@ func (r *FvMacAttrResource) Delete(ctx context.Context, req resource.DeleteReque return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvMacAttr", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -364,18 +364,18 @@ func (r *FvMacAttrResource) Delete(ctx context.Context, req resource.DeleteReque if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_mac_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_mac_attribute with id '%s'", data.Id.ValueString())) } func (r *FvMacAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_mac_attribute") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvMacAttrResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_mac_attribute with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_mac_attribute with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_mac_attribute") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_mac_attribute") } func getAndSetFvMacAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvMacAttrResourceModel) { diff --git a/internal/provider/resource_aci_epg_useg_mac_attribute_test.go b/internal/provider/resource_aci_epg_useg_mac_attribute_test.go new file mode 100644 index 000000000..d6c02ace3 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_mac_attribute_test.go @@ -0,0 +1,270 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvMacAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "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", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvMacAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + 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", "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"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvMacAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvMacAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_mac_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvMacAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_mac_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "mac", "AA:BB:CC:DD:EE:FF"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name", "mac_attr"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_mac_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvMacAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} +` + +const testConfigFvMacAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "mac_attr" + annotation = "annotation" + description = "description" + mac = "AA:BB:CC:BB:BB:EE" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvMacAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "mac_attr" + annotation = "orchestrator:terraform" + description = "" + mac = "AA:BB:CC:DD:EE:FF" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvMacAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvMacAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" +} +` + +const testConfigFvMacAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvMacAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_mac_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + mac = "AA:BB:CC:DD:EE:FF" + name = "mac_attr" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_sub_criterion.go b/internal/provider/resource_aci_epg_useg_sub_block_statement.go similarity index 92% rename from internal/provider/resource_aci_epg_useg_sub_criterion.go rename to internal/provider/resource_aci_epg_useg_sub_block_statement.go index 57d228137..c18cc59d5 100644 --- a/internal/provider/resource_aci_epg_useg_sub_criterion.go +++ b/internal/provider/resource_aci_epg_useg_sub_block_statement.go @@ -73,21 +73,21 @@ type FvSCrtrnIdentifier struct { } func (r *FvSCrtrnResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_sub_criterion") - resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_criterion" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_sub_block_statement") + resp.TypeName = req.ProviderTypeName + "_epg_useg_sub_block_statement" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_sub_block_statement") } func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_sub_block_statement") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_sub_criterion resource for the 'fvSCrtrn' class", + MarkdownDescription: "The epg_useg_sub_block_statement resource for the 'fvSCrtrn' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Criterion object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Sub Block Statement object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -107,7 +107,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The annotation of the EPG uSeg Sub Block Statement object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -115,7 +115,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The description of the EPG uSeg Sub Block Statement object.`, }, "match": schema.StringAttribute{ Optional: true, @@ -126,7 +126,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.OneOf("all", "any"), }, - MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The Matching Rule Type of the EPG uSeg Sub Block Statement object.`, }, "name": schema.StringAttribute{ Required: true, @@ -134,7 +134,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The name of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The name of the EPG uSeg Sub Block Statement object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -142,7 +142,7 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Sub Criterion object.`, + MarkdownDescription: `The name alias of the EPG uSeg Sub Block Statement object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -214,11 +214,11 @@ func (r *FvSCrtrnResource) Schema(ctx context.Context, req resource.SchemaReques }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_sub_block_statement") } func (r *FvSCrtrnResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_sub_block_statement") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -236,11 +236,11 @@ func (r *FvSCrtrnResource) Configure(ctx context.Context, req resource.Configure } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_sub_block_statement") } func (r *FvSCrtrnResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_sub_block_statement") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvSCrtrnResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -258,7 +258,7 @@ func (r *FvSCrtrnResource) Create(ctx context.Context, req resource.CreateReques setFvSCrtrnId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -281,11 +281,11 @@ func (r *FvSCrtrnResource) Create(ctx context.Context, req resource.CreateReques // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvSCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_sub_block_statement") var data *FvSCrtrnResourceModel // Read Terraform prior state data into the model @@ -295,7 +295,7 @@ func (r *FvSCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, r return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) getAndSetFvSCrtrnAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -307,11 +307,11 @@ func (r *FvSCrtrnResource) Read(ctx context.Context, req resource.ReadRequest, r resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvSCrtrnResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_sub_block_statement") var data *FvSCrtrnResourceModel var stateData *FvSCrtrnResourceModel @@ -323,7 +323,7 @@ func (r *FvSCrtrnResource) Update(ctx context.Context, req resource.UpdateReques return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvSCrtrnResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -347,11 +347,11 @@ func (r *FvSCrtrnResource) Update(ctx context.Context, req resource.UpdateReques // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvSCrtrnResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_sub_block_statement") var data *FvSCrtrnResourceModel // Read Terraform prior state data into the model @@ -361,7 +361,7 @@ func (r *FvSCrtrnResource) Delete(ctx context.Context, req resource.DeleteReques return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvSCrtrn", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -370,18 +370,18 @@ func (r *FvSCrtrnResource) Delete(ctx context.Context, req resource.DeleteReques if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_sub_criterion with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_sub_block_statement with id '%s'", data.Id.ValueString())) } func (r *FvSCrtrnResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_sub_block_statement") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvSCrtrnResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_sub_criterion with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_sub_block_statement with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_sub_criterion") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_sub_block_statement") } func getAndSetFvSCrtrnAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvSCrtrnResourceModel) { 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 new file mode 100644 index 000000000..590a074ff --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_sub_block_statement_test.go @@ -0,0 +1,516 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvSCrtrnAllDependencyWithFvCrtrn, + 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", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", "description"), + 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"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name", "sub_criterion"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvSCrtrnResetDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_sub_block_statement.test", + ImportState: true, + ImportStateVerify: true, + 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", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvSCrtrnChildrenDependencyWithFvCrtrn, + 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", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_sub_block_statement.test", + ImportState: true, + ImportStateVerify: true, + 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", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "owner_tag", ""), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test", "tags.#", "0"), + ), + }, + }, + }) +} +func TestAccResourceFvSCrtrnWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvSCrtrnMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvSCrtrnAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", "description"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "all"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvSCrtrnMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvSCrtrnResetDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_sub_block_statement.test1", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigFvSCrtrnChildrenDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_sub_block_statement.test1", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name", "sub_criterion"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "match", "any"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_sub_block_statement.test1", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvSCrtrnMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + annotation = "annotation" + description = "description" + match = "all" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvSCrtrnResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + annotation = "orchestrator:terraform" + description = "" + match = "any" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvSCrtrnChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_sub_block_statement" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "sub_criterion" + annotations = [] + tags = [] +} +` + +const testConfigFvSCrtrnMinDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + annotation = "annotation" + description = "description" + match = "all" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigFvSCrtrnResetDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + annotation = "orchestrator:terraform" + description = "" + match = "any" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigFvSCrtrnChildrenDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" +} +` + +const testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_sub_block_statement" "test1" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "sub_criterion" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_epg_useg_sub_criterion_test.go b/internal/provider/resource_aci_epg_useg_sub_criterion_test.go deleted file mode 100644 index 4517a8825..000000000 --- a/internal/provider/resource_aci_epg_useg_sub_criterion_test.go +++ /dev/null @@ -1,264 +0,0 @@ -// Code generated by "gen/generator.go"; DO NOT EDIT. -// In order to regenerate this file execute `go generate` from the repository root. -// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). - -package provider - -import ( - "testing" - - "github.com/hashicorp/terraform-plugin-testing/helper/resource" -) - -func TestAccResourceFvSCrtrnWithFvCrtrn(t *testing.T) { - - resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, - Steps: []resource.TestStep{ - // Create with minimum config and verify default APIC values - { - Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), - ), - }, - // Update with all config and verify default APIC values - { - Config: testConfigFvSCrtrnAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "annotation"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", "description"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "all"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", "name_alias"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", "owner_key"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", "owner_tag"), - ), - }, - // Update with minimum config and verify config is unchanged - { - Config: testConfigFvSCrtrnMinDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - ), - }, - // Update with empty strings config or default value - { - Config: testConfigFvSCrtrnResetDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), - ), - }, - // Import testing - { - ResourceName: "aci_epg_useg_sub_criterion.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), - ), - }, - // Update with children - { - Config: testConfigFvSCrtrnChildrenDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), - ), - }, - // Import testing with children - { - ResourceName: "aci_epg_useg_sub_criterion.test", - ImportState: true, - ImportStateVerify: true, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name", "sub_criterion"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotation", "orchestrator:terraform"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "description", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "match", "any"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "name_alias", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_key", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "owner_tag", ""), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), - ), - }, - // Update with children removed from config - { - Config: testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.1.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "2"), - ), - }, - // Update with children first child removed - { - Config: testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.key", "key_1"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.0.value", "value_2"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "1"), - ), - }, - // Update with all children removed - { - Config: testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn, - ExpectNonEmptyPlan: false, - Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "annotations.#", "0"), - resource.TestCheckResourceAttr("aci_epg_useg_sub_criterion.test", "tags.#", "0"), - ), - }, - }, - }) -} - -const testConfigFvSCrtrnMinDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" -} -` - -const testConfigFvSCrtrnAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - annotation = "annotation" - description = "description" - match = "all" - name_alias = "name_alias" - owner_key = "owner_key" - owner_tag = "owner_tag" -} -` - -const testConfigFvSCrtrnResetDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - annotation = "orchestrator:terraform" - description = "" - match = "any" - name_alias = "" - owner_key = "" - owner_tag = "" -} -` -const testConfigFvSCrtrnChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - annotations = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_0" - value = "value_1" - }, - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvSCrtrnChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" -} -` - -const testConfigFvSCrtrnChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - annotations = [ - { - key = "key_1" - value = "value_2" - }, - ] - tags = [ - { - key = "key_1" - value = "value_2" - }, - ] -} -` - -const testConfigFvSCrtrnChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "sub_criterion" - annotations = [] - tags = [] -} -` diff --git a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go b/internal/provider/resource_aci_epg_useg_vm_attribute.go similarity index 90% rename from internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go rename to internal/provider/resource_aci_epg_useg_vm_attribute.go index c2ad1951b..1c5dfbc29 100644 --- a/internal/provider/resource_aci_epg_useg_criterion_vm_attribute.go +++ b/internal/provider/resource_aci_epg_useg_vm_attribute.go @@ -77,21 +77,21 @@ type FvVmAttrIdentifier struct { } func (r *FvVmAttrResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { - tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_criterion_vm_attribute") - resp.TypeName = req.ProviderTypeName + "_epg_useg_criterion_vm_attribute" - tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start metadata of resource: aci_epg_useg_vm_attribute") + resp.TypeName = req.ProviderTypeName + "_epg_useg_vm_attribute" + tflog.Debug(ctx, "End metadata of resource: aci_epg_useg_vm_attribute") } func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { - tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start schema of resource: aci_epg_useg_vm_attribute") resp.Schema = schema.Schema{ // This description is used by the documentation generator and the language server. - MarkdownDescription: "The epg_useg_criterion_vm_attribute resource for the 'fvVmAttr' class", + MarkdownDescription: "The epg_useg_vm_attribute resource for the 'fvVmAttr' class", Attributes: map[string]schema.Attribute{ "id": schema.StringAttribute{ Computed: true, - MarkdownDescription: "The distinguished name (DN) of the EPG uSeg Criterion VM Attribute object.", + MarkdownDescription: "The distinguished name (DN) of the EPG uSeg VM Attribute object.", PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, @@ -111,7 +111,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), }, Default: stringdefault.StaticString(globalAnnotation), - MarkdownDescription: `The annotation of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The annotation of the EPG uSeg VM Attribute object.`, }, "category": schema.StringAttribute{ Optional: true, @@ -119,7 +119,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The category of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The category of the EPG uSeg VM Attribute object.`, }, "description": schema.StringAttribute{ Optional: true, @@ -127,7 +127,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The description of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The description of the EPG uSeg VM Attribute object.`, }, "label_name": schema.StringAttribute{ Optional: true, @@ -135,7 +135,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The label name of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The label name of the EPG uSeg VM Attribute object.`, }, "name": schema.StringAttribute{ Required: true, @@ -143,7 +143,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques stringplanmodifier.UseStateForUnknown(), stringplanmodifier.RequiresReplace(), }, - MarkdownDescription: `The name of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The name of the EPG uSeg VM Attribute object.`, }, "name_alias": schema.StringAttribute{ Optional: true, @@ -151,7 +151,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The name alias of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The name alias of the EPG uSeg VM Attribute object.`, }, "operator": schema.StringAttribute{ Optional: true, @@ -162,7 +162,7 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.OneOf("contains", "endsWith", "equals", "notEquals", "startsWith"), }, - MarkdownDescription: `The operator of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The operator of the EPG uSeg VM Attribute object.`, }, "owner_key": schema.StringAttribute{ Optional: true, @@ -189,14 +189,14 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques Validators: []validator.String{ stringvalidator.OneOf("custom-label", "domain", "guest-os", "hv", "rootContName", "tag", "vm", "vm-folder", "vm-name", "vmfolder-path", "vnic"), }, - MarkdownDescription: `The type of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The type of the EPG uSeg VM Attribute object.`, }, "value": schema.StringAttribute{ Required: true, PlanModifiers: []planmodifier.String{ stringplanmodifier.UseStateForUnknown(), }, - MarkdownDescription: `The value of the EPG uSeg Criterion VM Attribute object.`, + MarkdownDescription: `The value of the EPG uSeg VM Attribute object.`, }, "annotations": schema.SetNestedAttribute{ MarkdownDescription: ``, @@ -252,11 +252,11 @@ func (r *FvVmAttrResource) Schema(ctx context.Context, req resource.SchemaReques }, }, } - tflog.Debug(ctx, "End schema of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "End schema of resource: aci_epg_useg_vm_attribute") } func (r *FvVmAttrResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { - tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start configure of resource: aci_epg_useg_vm_attribute") // Prevent panic if the provider has not been configured. if req.ProviderData == nil { return @@ -274,11 +274,11 @@ func (r *FvVmAttrResource) Configure(ctx context.Context, req resource.Configure } r.client = client - tflog.Debug(ctx, "End configure of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "End configure of resource: aci_epg_useg_vm_attribute") } func (r *FvVmAttrResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { - tflog.Debug(ctx, "Start create of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start create of resource: aci_epg_useg_vm_attribute") // On create retrieve information on current state prior to making any changes in order to determine child delete operations var stateData *FvVmAttrResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) @@ -296,7 +296,7 @@ func (r *FvVmAttrResource) Create(ctx context.Context, req resource.CreateReques setFvVmAttrId(ctx, data) - tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -319,11 +319,11 @@ func (r *FvVmAttrResource) Create(ctx context.Context, req resource.CreateReques // Save data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) } func (r *FvVmAttrResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { - tflog.Debug(ctx, "Start read of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start read of resource: aci_epg_useg_vm_attribute") var data *FvVmAttrResourceModel // Read Terraform prior state data into the model @@ -333,7 +333,7 @@ func (r *FvVmAttrResource) Read(ctx context.Context, req resource.ReadRequest, r return } - tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) getAndSetFvVmAttrAttributes(ctx, &resp.Diagnostics, r.client, data) @@ -345,11 +345,11 @@ func (r *FvVmAttrResource) Read(ctx context.Context, req resource.ReadRequest, r resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) } - tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) } func (r *FvVmAttrResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - tflog.Debug(ctx, "Start update of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start update of resource: aci_epg_useg_vm_attribute") var data *FvVmAttrResourceModel var stateData *FvVmAttrResourceModel @@ -361,7 +361,7 @@ func (r *FvVmAttrResource) Update(ctx context.Context, req resource.UpdateReques return } - tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvVmAttrResourceModel data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) @@ -385,11 +385,11 @@ func (r *FvVmAttrResource) Update(ctx context.Context, req resource.UpdateReques // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) - tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) } func (r *FvVmAttrResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { - tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start delete of resource: aci_epg_useg_vm_attribute") var data *FvVmAttrResourceModel // Read Terraform prior state data into the model @@ -399,7 +399,7 @@ func (r *FvVmAttrResource) Delete(ctx context.Context, req resource.DeleteReques return } - tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvVmAttr", data.Id.ValueString()) if resp.Diagnostics.HasError() { return @@ -408,18 +408,18 @@ func (r *FvVmAttrResource) Delete(ctx context.Context, req resource.DeleteReques if resp.Diagnostics.HasError() { return } - tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_criterion_vm_attribute with id '%s'", data.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_epg_useg_vm_attribute with id '%s'", data.Id.ValueString())) } func (r *FvVmAttrResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { - tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "Start import state of resource: aci_epg_useg_vm_attribute") resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) var stateData *FvVmAttrResourceModel resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) - tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_criterion_vm_attribute with id '%s'", stateData.Id.ValueString())) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_epg_useg_vm_attribute with id '%s'", stateData.Id.ValueString())) - tflog.Debug(ctx, "End import of state resource: aci_epg_useg_criterion_vm_attribute") + tflog.Debug(ctx, "End import of state resource: aci_epg_useg_vm_attribute") } func getAndSetFvVmAttrAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvVmAttrResourceModel) { diff --git a/internal/provider/resource_aci_epg_useg_vm_attribute_test.go b/internal/provider/resource_aci_epg_useg_vm_attribute_test.go new file mode 100644 index 000000000..81c8c2ec5 --- /dev/null +++ b/internal/provider/resource_aci_epg_useg_vm_attribute_test.go @@ -0,0 +1,592 @@ +// Code generated by "gen/generator.go"; DO NOT EDIT. +// In order to regenerate this file execute `go generate` from the repository root. +// More details can be found in the [README](https://github.com/CiscoDevNet/terraform-provider-aci/blob/master/README.md). + +package provider + +import ( + "testing" + + "github.com/hashicorp/terraform-plugin-testing/helper/resource" +) + +func TestAccResourceFvVmAttrWithFvCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvVmAttrAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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", "label_name", "label_name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias"), + 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", "type", "domain"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "all_value"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvVmAttrMinDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvVmAttrResetDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + ), + }, + // Update with children + { + Config: testConfigFvVmAttrChildrenDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} +func TestAccResourceFvVmAttrWithFvSCrtrn(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + // Create with minimum config and verify default APIC values + { + Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvVmAttrAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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", "label_name", "label_name"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", "name_alias"), + 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", "type", "domain"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "all_value"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvVmAttrMinDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvVmAttrResetDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + ), + }, + // Import testing + { + ResourceName: "aci_epg_useg_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + ), + }, + // Update with children + { + Config: testConfigFvVmAttrChildrenDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + 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", "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"), + ), + }, + // Import testing with children + { + ResourceName: "aci_epg_useg_vm_attribute.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name", "vm_attribute"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "value", "default_value"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "category", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "description", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "label_name", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "operator", "equals"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "type", "vm-name"), + 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", "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"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + 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.#", "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.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn, + 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.#", "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.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_epg_useg_vm_attribute.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFvVmAttrMinDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "all_value" +} +` + +const testConfigFvVmAttrResetDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + annotation = "orchestrator:terraform" + category = "" + description = "" + label_name = "" + name_alias = "" + operator = "equals" + owner_key = "" + owner_tag = "" + type = "vm-name" + value = "default_value" +} +` +const testConfigFvVmAttrChildrenDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvCrtrn = testConfigFvCrtrnMinDependencyWithFvAEPg + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [] + tags = [] +} +` + +const testConfigFvVmAttrMinDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + annotation = "annotation" + category = "all_category" + description = "description" + label_name = "label_name" + name_alias = "name_alias" + operator = "contains" + owner_key = "owner_key" + owner_tag = "owner_tag" + type = "domain" + value = "all_value" +} +` + +const testConfigFvVmAttrResetDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + annotation = "orchestrator:terraform" + category = "" + description = "" + label_name = "" + name_alias = "" + operator = "equals" + owner_key = "" + owner_tag = "" + type = "vm-name" + value = "default_value" +} +` +const testConfigFvVmAttrChildrenDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveFromConfigDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + value = "default_value" +} +` + +const testConfigFvVmAttrChildrenRemoveOneDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvVmAttrChildrenRemoveAllDependencyWithFvSCrtrn = testConfigFvSCrtrnMinDependencyWithFvCrtrn + ` +resource "aci_epg_useg_vm_attribute" "test" { + parent_dn = aci_epg_useg_sub_block_statement.test.id + name = "vm_attribute" + value = "default_value" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/test_constants.go b/internal/provider/test_constants.go index 353c7b182..e44ac5da0 100644 --- a/internal/provider/test_constants.go +++ b/internal/provider/test_constants.go @@ -88,16 +88,3 @@ resource "aci_l3out_loopback_interface_profile" "test" { addr = "1.2.3.5" } ` - -const testConfigFvCrtrnMin = testConfigFvAEPgMin + ` -resource "aci_epg_useg_criterion" "test" { - parent_dn = aci_application_epg.test.id -} -` - -const testConfigFvSCrtrnMin = testConfigFvCrtrnMin + ` -resource "aci_epg_useg_sub_criterion" "test" { - parent_dn = aci_epg_useg_criterion.test.id - name = "test_name" -} -`