diff --git a/docs/data-sources/annotation.md b/docs/data-sources/annotation.md index 759007e0e..4d22cf947 100644 --- a/docs/data-sources/annotation.md +++ b/docs/data-sources/annotation.md @@ -57,8 +57,10 @@ data "aci_annotation" "example_application_epg" { - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/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_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/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)) @@ -66,14 +68,12 @@ data "aci_annotation" "example_application_epg" { - [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_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) + - [aci_relation_to_application_epg_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_application_epg_monitoring_policy) ([fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) + - [aci_relation_to_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_bridge_domain) ([fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_relation_to_custom_qos_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_custom_qos_policy) ([fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) + - [aci_relation_to_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_domain) ([fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/application_epg.md b/docs/data-sources/application_epg.md new file mode 100644 index 000000000..79e5b6396 --- /dev/null +++ b/docs/data-sources/application_epg.md @@ -0,0 +1,171 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_application_epg" +sidebar_current: "docs-aci-data-source-aci_application_epg" +description: |- + Data source for Application Epg +--- + +# aci_application_epg # + +Data source for Application Epg + +## API Information ## + +* Class: [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs` + +## Example Usage ## + +```hcl + +data "aci_application_epg" "example_application_profile" { + parent_dn = aci_application_profile.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) +* `name` (name) - (string) The name of the Application Epg object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Application Epg object. +* `annotation` (annotation) - (string) The annotation of the Application Epg object. +* `description` (descr) - (string) The description of the Application Epg object. +* `exception_tag` (exceptionTag) - (string) Contract Exception Tag. +* `flood_on_encap` (floodOnEncap) - (string) Control at EPG level if the traffic L2 Multicast/Broadcast and Link Local Layer should be flooded only on ENCAP or based on bridg-domain settings. +* `forwarding_control` (fwdCtrl) - (string) Forwarding Control. +* `has_multicast_source` (hasMcastSource) - (string) EPg with Multisite Mcast Source. +* `useg_epg` (isAttrBasedEPg) - (string) Attribute Based EPG. +* `match_criteria` (matchT) - (string) The provider label match criteria. +* `name_alias` (nameAlias) - (string) The name alias of the Application Epg object. +* `intra_epg_isolation` (pcEnfPref) - (string) Represents parameter used by the node (i.e. Leaf) to enforce filter rules in this EPG. +* `preferred_group_member` (prefGrMemb) - (string) Represents parameter used to determine if EPg is part of a group that does not a contract for communication. +* `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. +* `admin_state` (shutdown) - (string) Withdraw AEPg Configuration from all Nodes in the Fabric. + +* `relation_to_application_epg_monitoring_policy` - (list) A list of Relation To Application Epg Monitoring Policy (ACI object [fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) pointing to Monitoring Policy (ACI Object [monEPGPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/monEPGPol/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Application Epg Monitoring Policy object. + * `monitoring_policy_name` (tnMonEPGPolName) - (string) The name of the monitoring policy. + +* `relation_to_bridge_domain` - (list) A list of Relation To Bridge Domain (ACI object [fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) pointing to Bridge Domain (ACI Object [fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Bridge Domain object. + * `bridge_domain_name` (tnFvBDName) - (string) The name of the bridge domain associated with this EPG. + +* `relation_to_consumed_contracts` - (list) A list of Relation To Consumed Contracts (ACI object [fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Consumed Contract object. + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + * `contract_name` (tnVzBrCPName) - (string) The consumer contract name. + +* `relation_to_imported_contracts` - (list) A list of Relation To Imported Contracts (ACI object [fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) pointing to Imported Contract (ACI Object [vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Imported Contract object. + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + * `imported_contract_name` (tnVzCPIfName) - (string) The contract interface name. + +* `relation_to_custom_qos_policy` - (list) A list of Relation To Custom Qos Policy (ACI object [fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) pointing to Custom Qos Policy (ACI Object [qosCustomPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosCustomPol/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Custom Qos Policy object. + * `custom_qos_policy_name` (tnQosCustomPolName) - (string) The Custom QoS traffic policy name. + +* `relation_to_domains` - (list) A list of Relation To Domains (ACI object [fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) pointing to (ACI Object [infraDomP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraDomP/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Domain object. + * `binding_type` (bindingType) - (string) Binding type for ports. + * `class_preference` (classPref) - (string) classPref. + * `custom_epg_name` (customEpgName) - (string) User-configured port-group display name. + * `delimiter` (delimiter) - (string) delimiter. + * `encapsulation` (encap) - (string) The port encapsulation. + * `encapsulation_mode` (encapMode) - (string) encapMode. + * `epg_cos` (epgCos) - (string) Represents Epg Cos for AVS. + * `epg_cos_pref` (epgCosPref) - (string) Represents parameter used to enable/disable Epg Cos Policy. + * `deployment_immediacy` (instrImedcy) - (string) Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM. + * `ipam_dhcp_override` (ipamDhcpOverride) - (string) ipamDhcpOverride. + * `ipam_enabled` (ipamEnabled) - (string) ipamEnabled. + * `ipam_gateway` (ipamGateway) - (string) ipamGateway. + * `lag_policy_name` (lagPolicyName) - (string) LAG Policy Name. + * `netflow_direction` (netflowDir) - (string) Represents NetFlow monitoring direction. + * `enable_netflow` (netflowPref) - (string) Represents parameter used to enable/disable Netflow Policy. + * `number_of_ports` (numPorts) - (string) Number of ports for binding type. + * `port_allocation` (portAllocation) - (string) Port allocation for ports. + * `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + * `primary_encapsulation_inner` (primaryEncapInner) - (string) primaryEncapInner. + * `resolve_immediacy` (resImedcy) - (string) Specifies if policies are to be resolved immmediately or when needed. + * `secondary_encapsulation_inner` (secondaryEncapInner) - (string) secondaryEncapInner. + * `switching_mode` (switchingMode) - (string) switchingMode. + * `target_dn` (tDn) - (string) The name of the Physical Domain Profile. + * `untagged` (untagged) - (string) untagged. + * `vnet_only` (vnetOnly) - (string) vnetOnly. + +* `relation_to_data_plane_policing_policy` - (list) A list of Relation To Data Plane Policing Policy (ACI object [fvRsDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDppPol/overview)) pointing to Data Plane Policing Policy (ACI Object [qosDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosDppPol/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To Data Plane Policing Policy object. + * `data_plane_policing_policy_name` (tnQosDppPolName) - (string) Name. + +* `relation_to_fibre_channel_paths` - (list) A list of Relation To Fibre Channel Paths (ACI object [fvRsFcPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsFcPathAtt/overview)) pointing to (ACI Object [fabricPathEp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricPathEp/overview)). This attribute is supported in ACI versions: 2.0(1m) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To Fibre Channel Path object. + * `description` (descr) - (string) The description of the Relation To Fibre Channel Path object. + * `target_dn` (tDn) - (string) The distinguished name of the target. + * `vsan` (vsan) - (string) port vsan. + * `vsan_mode` (vsanMode) - (string) vsanMode. + +* `relation_to_intra_epg_contracts` - (list) A list of Relation To Intra Epg Contracts (ACI object [fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To Intra Epg Contract object. + * `contract_name` (tnVzBrCPName) - (string) The contract name. + +* `relation_to_static_leafs` - (list) A list of Relation To Static Leafs (ACI object [fvRsNodeAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsNodeAtt/overview)) pointing to (ACI Object [fabricNode](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricNode/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Static Leaf object. + * `description` (descr) - (string) The description of the Relation To Static Leaf object. + * `encapsulation` (encap) - (string) The encapsulation method (VLAN) for the static binding. + * `deployment_immediacy` (instrImedcy) - (string) null. + * `mode` (mode) - (string) The mode of the static association with the path. + * `target_dn` (tDn) - (string) The distinguished name of the target of this static binding. + +* `relation_to_static_paths` - (list) A list of Relation To Static Paths (ACI object [fvRsPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsPathAtt/overview)) pointing to (ACI Object [fabricPathEp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricPathEp/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Static Path object. + * `description` (descr) - (string) The description of the Relation To Static Path object. + * `encapsulation` (encap) - (string) The encapsulation method (VLAN) of the path. + * `deployment_immediacy` (instrImedcy) - (string) The deployment immediacy preference of this path association. + * `mode` (mode) - (string) The mode of the static association with the path. + * `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + * `target_dn` (tDn) - (string) null. + +* `relation_to_taboo_contracts` - (list) A list of Relation To Taboo Contracts (ACI object [fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) pointing to Taboo Contract (ACI Object [vzTaboo](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzTaboo/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Taboo Contract object. + * `taboo_contract_name` (tnVzTabooName) - (string) A contract for denying specific classes of traffic. Taboo rules are applied in the hardware before applying the rules of regular contracts. Without a contract, the default forwarding policy is to not allow any communication between EPGs. + +* `relation_to_provided_contracts` - (list) A list of Relation To Provided Contracts (ACI object [fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)). + * `annotation` (annotation) - (string) The annotation of the Relation To Provided Contract object. + * `match_criteria` (matchT) - (string) The provider label match criteria. + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + * `contract_name` (tnVzBrCPName) - (string) The provider contract name. + +* `relation_to_contract_masters` - (list) A list of Relation To Contract Masters (ACI object [fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) pointing to Application Epg (ACI Object [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)). This attribute is supported in ACI versions: 2.3(1e) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To Contract Master object. + * `target_dn` (tDn) - (string) The distinguished name of the target. + +* `relation_to_trust_control_policy` - (list) A list of Relation To Trust Control Policy (ACI object [fvRsTrustCtrl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsTrustCtrl/overview)) pointing to Trust Control Policy (ACI Object [fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)). This attribute is supported in ACI versions: 3.0(1k) and later. + * `annotation` (annotation) - (string) The annotation of the Relation To Trust Control Policy object. + * `trust_control_policy_name` (tnFhsTrustCtrlPolName) - (string) Name. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/custom_qos_policy.md b/docs/data-sources/custom_qos_policy.md new file mode 100644 index 000000000..74af2df0f --- /dev/null +++ b/docs/data-sources/custom_qos_policy.md @@ -0,0 +1,63 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_custom_qos_policy" +sidebar_current: "docs-aci-data-source-aci_custom_qos_policy" +description: |- + Data source for Custom Qos Policy +--- + +# aci_custom_qos_policy # + +Data source for Custom Qos Policy + +## API Information ## + +* Class: [qosCustomPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosCustomPol/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/qoscustom-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> Custom QoS` + +## Example Usage ## + +```hcl + +data "aci_custom_qos_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `name` (name) - (string) The name of the Custom Qos Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Custom Qos Policy object. +* `annotation` (annotation) - (string) The annotation of the Custom Qos Policy object. +* `description` (descr) - (string) The description of the Custom Qos Policy object. +* `name_alias` (nameAlias) - (string) The name alias of the Custom Qos Policy 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. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/data_plane_policing_policy.md b/docs/data-sources/data_plane_policing_policy.md new file mode 100644 index 000000000..bfc973633 --- /dev/null +++ b/docs/data-sources/data_plane_policing_policy.md @@ -0,0 +1,89 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_data_plane_policing_policy" +sidebar_current: "docs-aci-data-source-aci_data_plane_policing_policy" +description: |- + Data source for Data Plane Policing Policy +--- + +# aci_data_plane_policing_policy # + +Data source for Data Plane Policing Policy + +## API Information ## + +* Class: [qosDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosDppPol/overview) + +* Supported in ACI versions: 1.2(2g) and later. + +* Distinguished Name Formats: + - `uni/infra/qosdpppol-{name}` + - `uni/tn-{name}/qosdpppol-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> Data Plane Policing` + +## Example Usage ## + +```hcl + +data "aci_data_plane_policing_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [infraInfra](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraInfra/overview) + +* `name` (name) - (string) The name of the Data Plane Policing Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Data Plane Policing Policy object. +* `admin_st` (adminSt) - (string) The Administrative state of the policy. +* `annotation` (annotation) - (string) The annotation of the Data Plane Policing Policy object. +* `be` (be) - (string) Excessive burst size (2R3C policer only). +* `be_unit` (beUnit) - (string) Excessive Burst unit - none, Kilo, Mega, Giga, ms, us. +* `burst` (burst) - (string) Committed burst size, number of packets to absorb during a burst. +* `burst_unit` (burstUnit) - (string) Burst unit - byte, kbyte, mbyte etc. +* `conform_action` (conformAction) - (string) Confirm action. +* `conform_mark_cos` (conformMarkCos) - (string) Conform Mark cos. +* `conform_mark_dscp` (conformMarkDscp) - (string) Conform Mark Dscp. +* `description` (descr) - (string) The description of the Data Plane Policing Policy object. +* `exceed_action` (exceedAction) - (string) Exceed action. +* `exceed_mark_cos` (exceedMarkCos) - (string) Exceed Mark cos. +* `exceed_mark_dscp` (exceedMarkDscp) - (string) Exceed Mark Dscp. +* `mode` (mode) - (string) Policer mode - bytes or packet policer. +* `name_alias` (nameAlias) - (string) The name alias of the Data Plane Policing Policy 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. +* `pir` (pir) - (string) Peak rate (pir) (2R3C policer only). +* `pir_unit` (pirUnit) - (string) Peak Rate unit - none, Kilo, Mega, Giga. +* `rate` (rate) - (string) Allowed rate, committed rate at which the packets are allowed into the system. +* `rate_unit` (rateUnit) - (string) Rate unit - bps, kbps, mbps, packets etc. +* `sharing_mode` (sharingMode) - (string) Policer sharing mode. +* `type` (type) - (string) Policer type. +* `violate_action` (violateAction) - (string) Violate action. +* `violate_mark_cos` (violateMarkCos) - (string) Violate Mark cos. +* `violate_mark_dscp` (violateMarkDscp) - (string) Violate Mark Dscp. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_to_domain.md b/docs/data-sources/relation_to_domain.md new file mode 100644 index 000000000..fa813cecb --- /dev/null +++ b/docs/data-sources/relation_to_domain.md @@ -0,0 +1,83 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_domain" +sidebar_current: "docs-aci-data-source-aci_relation_to_domain" +description: |- + Data source for Relation To Domain +--- + +# aci_relation_to_domain # + +Data source for Relation To Domain + +## API Information ## + +* Class: [fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsdomAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Domains (VMs and Bare-Metals)` + +## Example Usage ## + +```hcl + +data "aci_relation_to_domain" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "uni/vmmp-VMware/dom-domain_2" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The name of the Physical Domain Profile. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Domain object. +* `annotation` (annotation) - (string) The annotation of the Relation To Domain object. +* `binding_type` (bindingType) - (string) Binding type for ports. +* `class_preference` (classPref) - (string) classPref. +* `custom_epg_name` (customEpgName) - (string) User-configured port-group display name. +* `delimiter` (delimiter) - (string) delimiter. +* `encapsulation` (encap) - (string) The port encapsulation. +* `encapsulation_mode` (encapMode) - (string) encapMode. +* `epg_cos` (epgCos) - (string) Represents Epg Cos for AVS. +* `epg_cos_pref` (epgCosPref) - (string) Represents parameter used to enable/disable Epg Cos Policy. +* `deployment_immediacy` (instrImedcy) - (string) Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM. +* `ipam_dhcp_override` (ipamDhcpOverride) - (string) ipamDhcpOverride. +* `ipam_enabled` (ipamEnabled) - (string) ipamEnabled. +* `ipam_gateway` (ipamGateway) - (string) ipamGateway. +* `lag_policy_name` (lagPolicyName) - (string) LAG Policy Name. +* `netflow_direction` (netflowDir) - (string) Represents NetFlow monitoring direction. +* `enable_netflow` (netflowPref) - (string) Represents parameter used to enable/disable Netflow Policy. +* `number_of_ports` (numPorts) - (string) Number of ports for binding type. +* `port_allocation` (portAllocation) - (string) Port allocation for ports. +* `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. +* `primary_encapsulation_inner` (primaryEncapInner) - (string) primaryEncapInner. +* `resolve_immediacy` (resImedcy) - (string) Specifies if policies are to be resolved immmediately or when needed. +* `secondary_encapsulation_inner` (secondaryEncapInner) - (string) secondaryEncapInner. +* `switching_mode` (switchingMode) - (string) switchingMode. +* `untagged` (untagged) - (string) untagged. +* `vnet_only` (vnetOnly) - (string) vnetOnly. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_to_fibre_channel_path.md b/docs/data-sources/relation_to_fibre_channel_path.md new file mode 100644 index 000000000..0cf183201 --- /dev/null +++ b/docs/data-sources/relation_to_fibre_channel_path.md @@ -0,0 +1,62 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_fibre_channel_path" +sidebar_current: "docs-aci-data-source-aci_relation_to_fibre_channel_path" +description: |- + Data source for Relation To Fibre Channel Path +--- + +# aci_relation_to_fibre_channel_path # + +Data source for Relation To Fibre Channel Path + +## API Information ## + +* Class: [fvRsFcPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsFcPathAtt/overview) + +* Supported in ACI versions: 2.0(1m) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsfcPathAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Fibre Channel (Paths)` + +## Example Usage ## + +```hcl + +data "aci_relation_to_fibre_channel_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The distinguished name of the target. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Fibre Channel Path object. +* `annotation` (annotation) - (string) The annotation of the Relation To Fibre Channel Path object. +* `description` (descr) - (string) The description of the Relation To Fibre Channel Path object. +* `vsan` (vsan) - (string) port vsan. +* `vsan_mode` (vsanMode) - (string) vsanMode. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_to_static_leaf.md b/docs/data-sources/relation_to_static_leaf.md new file mode 100644 index 000000000..57fb002b5 --- /dev/null +++ b/docs/data-sources/relation_to_static_leaf.md @@ -0,0 +1,63 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_static_leaf" +sidebar_current: "docs-aci-data-source-aci_relation_to_static_leaf" +description: |- + Data source for Relation To Static Leaf +--- + +# aci_relation_to_static_leaf # + +Data source for Relation To Static Leaf + +## API Information ## + +* Class: [fvRsNodeAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsNodeAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsnodeAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Static Leafs` + +## Example Usage ## + +```hcl + +data "aci_relation_to_static_leaf" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/node-101" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The distinguished name of the target of this static binding. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Static Leaf object. +* `annotation` (annotation) - (string) The annotation of the Relation To Static Leaf object. +* `description` (descr) - (string) The description of the Relation To Static Leaf object. +* `encapsulation` (encap) - (string) The encapsulation method (VLAN) for the static binding. +* `deployment_immediacy` (instrImedcy) - (string) null. +* `mode` (mode) - (string) The mode of the static association with the path. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/relation_to_static_path.md b/docs/data-sources/relation_to_static_path.md new file mode 100644 index 000000000..5a2184a77 --- /dev/null +++ b/docs/data-sources/relation_to_static_path.md @@ -0,0 +1,64 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_static_path" +sidebar_current: "docs-aci-data-source-aci_relation_to_static_path" +description: |- + Data source for Relation To Static Path +--- + +# aci_relation_to_static_path # + +Data source for Relation To Static Path + +## API Information ## + +* Class: [fvRsPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsPathAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rspathAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Static Ports` + +## Example Usage ## + +```hcl + +data "aci_relation_to_static_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) null. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Static Path object. +* `annotation` (annotation) - (string) The annotation of the Relation To Static Path object. +* `description` (descr) - (string) The description of the Relation To Static Path object. +* `encapsulation` (encap) - (string) The encapsulation method (VLAN) of the path. +* `deployment_immediacy` (instrImedcy) - (string) The deployment immediacy preference of this path association. +* `mode` (mode) - (string) The mode of the static association with the path. +* `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/data-sources/tag.md b/docs/data-sources/tag.md index 2d1e008e2..498db47c8 100644 --- a/docs/data-sources/tag.md +++ b/docs/data-sources/tag.md @@ -57,8 +57,10 @@ data "aci_tag" "example_application_epg" { - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/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_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/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)) @@ -66,14 +68,12 @@ data "aci_tag" "example_application_epg" { - [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_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) + - [aci_relation_to_application_epg_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_application_epg_monitoring_policy) ([fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) + - [aci_relation_to_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_bridge_domain) ([fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_relation_to_custom_qos_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_custom_qos_policy) ([fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) + - [aci_relation_to_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_domain) ([fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. ### Read-Only ### diff --git a/docs/data-sources/trust_control_policy.md b/docs/data-sources/trust_control_policy.md new file mode 100644 index 000000000..e832c18a3 --- /dev/null +++ b/docs/data-sources/trust_control_policy.md @@ -0,0 +1,69 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_trust_control_policy" +sidebar_current: "docs-aci-data-source-aci_trust_control_policy" +description: |- + Data source for Trust Control Policy +--- + +# aci_trust_control_policy # + +Data source for Trust Control Policy + +## API Information ## + +* Class: [fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview) + +* Supported in ACI versions: 3.0(1k) and later. + +* Distinguished Name Format: `uni/tn-{name}/trustctrlpol-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> First Hop Security -> Trust Control Policies` + +## Example Usage ## + +```hcl + +data "aci_trust_control_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `name` (name) - (string) The name of the Trust Control Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Trust Control Policy object. +* `annotation` (annotation) - (string) The annotation of the Trust Control Policy object. +* `description` (descr) - (string) The description of the Trust Control Policy object. +* `has_dhcpv4_server` (hasDhcpv4Server) - (string) Contains DHCPv4 servers. +* `has_dhcpv6_server` (hasDhcpv6Server) - (string) Contains DHCPv6 servers. +* `has_ipv6_router` (hasIpv6Router) - (string) Contains IPv6 routers. +* `name_alias` (nameAlias) - (string) The name alias of the Trust Control Policy 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. +* `trust_arp` (trustArp) - (string) Trust ARP. +* `trust_nd` (trustNd) - (string) Trust ND. +* `trust_ra` (trustRa) - (string) Trust router advertisement. + +* `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. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/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. + * `value` (value) - (string) The value of the property. diff --git a/docs/resources/annotation.md b/docs/resources/annotation.md index 95004ab73..af4679f75 100644 --- a/docs/resources/annotation.md +++ b/docs/resources/annotation.md @@ -66,8 +66,10 @@ All examples for the Annotation resource can be found in the [examples](https:// - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/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_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/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)) @@ -75,14 +77,12 @@ All examples for the Annotation resource can be found in the [examples](https:// - [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_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) + - [aci_relation_to_application_epg_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_application_epg_monitoring_policy) ([fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) + - [aci_relation_to_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_bridge_domain) ([fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_relation_to_custom_qos_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_custom_qos_policy) ([fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) + - [aci_relation_to_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_domain) ([fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/docs/resources/application_epg.md b/docs/resources/application_epg.md new file mode 100644 index 000000000..4ab0854fb --- /dev/null +++ b/docs/resources/application_epg.md @@ -0,0 +1,536 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_application_epg" +sidebar_current: "docs-aci-resource-aci_application_epg" +description: |- + Manages ACI Application Epg +--- + +# aci_application_epg # + +Manages ACI Application Epg + + + +## API Information ## + +* Class: [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs` + +## Example Usage ## + +The configuration snippet below creates a Application Epg with only required attributes. + +```hcl + +resource "aci_application_epg" "example_application_profile" { + parent_dn = aci_application_profile.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Application Epg. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_application_epg" "full_example_application_profile" { + parent_dn = aci_application_profile.example.id + annotation = "annotation" + description = "description" + exception_tag = "exception_tag" + flood_on_encap = "disabled" + forwarding_control = "proxy-arp" + has_multicast_source = "no" + useg_epg = "no" + match_criteria = "All" + name = "test_name" + name_alias = "name_alias" + intra_epg_isolation = "enforced" + preferred_group_member = "exclude" + priority = "level1" + admin_state = "no" + relation_to_application_epg_monitoring_policy = [ + { + annotation = "annotation_1" + monitoring_policy_name = aci_monitoring_policy.example.name + } + ] + relation_to_bridge_domain = [ + { + annotation = "annotation_1" + bridge_domain_name = aci_bridge_domain.example.name + } + ] + relation_to_consumed_contracts = [ + { + annotation = "annotation_1" + priority = "level1" + contract_name = aci_contract.example.name + } + ] + relation_to_imported_contracts = [ + { + annotation = "annotation_1" + priority = "level1" + imported_contract_name = aci_imported_contract.example.name + } + ] + relation_to_custom_qos_policy = [ + { + annotation = "annotation_1" + custom_qos_policy_name = aci_custom_qos_policy.example.name + } + ] + relation_to_domains = [ + { + annotation = "annotation_1" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name_1" + delimiter = "delimiter_1" + encapsulation = "encapsulation_1" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + deployment_immediacy = "immediate" + ipam_dhcp_override = "ipam_dhcp_override_1" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway_1" + lag_policy_name = "lag_policy_name_1" + netflow_direction = "both" + enable_netflow = "disabled" + number_of_ports = "number_of_ports_1" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation_1" + primary_encapsulation_inner = "primary_encapsulation_inner_1" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner_1" + switching_mode = "AVE" + target_dn = "uni/vmmp-VMware/dom-domain_1" + untagged = "no" + vnet_only = "no" + } + ] + relation_to_data_plane_policing_policy = [ + { + annotation = "annotation_1" + data_plane_policing_policy_name = aci_data_plane_policing_policy.example.name + } + ] + relation_to_fibre_channel_paths = [ + { + annotation = "annotation_1" + description = "description_1" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + vsan = "vsan_1" + vsan_mode = "native" + } + ] + relation_to_intra_epg_contracts = [ + { + annotation = "annotation_1" + contract_name = aci_contract.example.name + } + ] + relation_to_static_leafs = [ + { + annotation = "annotation_1" + description = "description_1" + encapsulation = "encapsulation_1" + deployment_immediacy = "immediate" + mode = "native" + target_dn = "topology/pod-1/node-101" + } + ] + relation_to_static_paths = [ + { + annotation = "annotation_1" + description = "description_1" + encapsulation = "encapsulation_1" + deployment_immediacy = "immediate" + mode = "native" + primary_encapsulation = "primary_encapsulation_1" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + } + ] + relation_to_taboo_contracts = [ + { + annotation = "annotation_1" + taboo_contract_name = aci_taboo_contract.example.name + } + ] + relation_to_provided_contracts = [ + { + annotation = "annotation_1" + match_criteria = "All" + priority = "level1" + contract_name = aci_contract.example.name + } + ] + relation_to_contract_masters = [ + { + annotation = "annotation_1" + target_dn = aci_application_epg.test_2.id + } + ] + relation_to_trust_control_policy = [ + { + annotation = "annotation_1" + trust_control_policy_name = aci_trust_control_policy.example.name + } + ] + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Application Epg resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_application_epg) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [aci_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) +* `name` (name) - (string) The name of the Application Epg object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Application Epg object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Application Epg object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Application Epg object. +* `exception_tag` (exceptionTag) - (string) Contract Exception Tag. +* `flood_on_encap` (floodOnEncap) - (string) Control at EPG level if the traffic L2 Multicast/Broadcast and Link Local Layer should be flooded only on ENCAP or based on bridg-domain settings. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. +* `forwarding_control` (fwdCtrl) - (string) Forwarding Control. + - Default: `none` + - Valid Values: `none`, `proxy-arp`. +* `has_multicast_source` (hasMcastSource) - (string) EPg with Multisite Mcast Source. + - Default: `false` + - Valid Values: `no`, `yes`. +* `useg_epg` (isAttrBasedEPg) - (string) Attribute Based EPG. + - Default: `false` + - Valid Values: `no`, `yes`. +* `match_criteria` (matchT) - (string) The provider label match criteria. + - Default: `AtleastOne` + - Valid Values: `All`, `AtleastOne`, `AtmostOne`, `None`. +* `name_alias` (nameAlias) - (string) The name alias of the Application Epg object. +* `intra_epg_isolation` (pcEnfPref) - (string) Represents parameter used by the node (i.e. Leaf) to enforce filter rules in this EPG. + - Default: `unenforced` + - Valid Values: `enforced`, `unenforced`. +* `preferred_group_member` (prefGrMemb) - (string) Represents parameter used to determine if EPg is part of a group that does not a contract for communication. + - Default: `exclude` + - Valid Values: `exclude`, `include`. +* `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + - Default: `unspecified` + - Valid Values: `level1`, `level2`, `level3`, `level4`, `level5`, `level6`, `unspecified`. +* `admin_state` (shutdown) - (string) Withdraw AEPg Configuration from all Nodes in the Fabric. + - Default: `no` + - Valid Values: `no`, `yes`. + +* `relation_to_application_epg_monitoring_policy` - (list) A list of Relation To Application Epg Monitoring Policy (ACI object [fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) pointing to Monitoring Policy (ACI Object [monEPGPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/monEPGPol/overview)) which can be configured using the [aci_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/monitoring_policy) resource. + - Max Items: 1 + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Application Epg Monitoring Policy object. + - Default: `orchestrator:terraform` + * `monitoring_policy_name` (tnMonEPGPolName) - (string) The name of the monitoring policy. + +* `relation_to_bridge_domain` - (list) A list of Relation To Bridge Domain (ACI object [fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) pointing to Bridge Domain (ACI Object [fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) which can be configured using the [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) resource. + - Max Items: 1 + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Bridge Domain object. + - Default: `orchestrator:terraform` + * `bridge_domain_name` (tnFvBDName) - (string) The name of the bridge domain associated with this EPG. + +* `relation_to_consumed_contracts` - (list) A list of Relation To Consumed Contracts (ACI object [fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)) which can be configured using the [aci_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) resource. + + #### Required #### + + * `contract_name` (tnVzBrCPName) - (string) The consumer contract name. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) with `aci_contract.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/contract) with `data.aci_contract.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Consumed Contract object. + - Default: `orchestrator:terraform` + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + - Default: `unspecified` + - Valid Values: `level1`, `level2`, `level3`, `level4`, `level5`, `level6`, `unspecified`. + +* `relation_to_imported_contracts` - (list) A list of Relation To Imported Contracts (ACI object [fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) pointing to Imported Contract (ACI Object [vzCPIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzCPIf/overview)) which can be configured using the [aci_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/imported_contract) resource. + + #### Required #### + + * `imported_contract_name` (tnVzCPIfName) - (string) The contract interface name. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/imported_contract) with `aci_imported_contract.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/imported_contract) with `data.aci_imported_contract.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Imported Contract object. + - Default: `orchestrator:terraform` + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + - Default: `unspecified` + - Valid Values: `level1`, `level2`, `level3`, `level4`, `level5`, `level6`, `unspecified`. + +* `relation_to_custom_qos_policy` - (list) A list of Relation To Custom Qos Policy (ACI object [fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) pointing to Custom Qos Policy (ACI Object [qosCustomPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosCustomPol/overview)) which can be configured using the [aci_custom_qos_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/custom_qos_policy) resource. + - Max Items: 1 + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Custom Qos Policy object. + - Default: `orchestrator:terraform` + * `custom_qos_policy_name` (tnQosCustomPolName) - (string) The Custom QoS traffic policy name. + +* `relation_to_domains` - (list) A list of Relation To Domains (ACI object [fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) pointing to (ACI Object [infraDomP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraDomP/overview)) which can be configured using the [aci_](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/) resource. + + #### Required #### + + * `target_dn` (tDn) - (string) The name of the Physical Domain Profile. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Domain object. + - Default: `orchestrator:terraform` + * `binding_type` (bindingType) - (string) Binding type for ports. + - Default: `none` + - Valid Values: `dynamicBinding`, `ephemeral`, `none`, `staticBinding`. + * `class_preference` (classPref) - (string) classPref. + - Default: `encap` + - Valid Values: `encap`, `useg`. + * `custom_epg_name` (customEpgName) - (string) User-configured port-group display name. + * `delimiter` (delimiter) - (string) delimiter. + * `encapsulation` (encap) - (string) The port encapsulation. + * `encapsulation_mode` (encapMode) - (string) encapMode. + - Default: `auto` + - Valid Values: `auto`, `vlan`, `vxlan`. + * `epg_cos` (epgCos) - (string) Represents Epg Cos for AVS. + - Default: `Cos0` + - Valid Values: `Cos0`, `Cos1`, `Cos2`, `Cos3`, `Cos4`, `Cos5`, `Cos6`, `Cos7`. + * `epg_cos_pref` (epgCosPref) - (string) Represents parameter used to enable/disable Epg Cos Policy. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `deployment_immediacy` (instrImedcy) - (string) Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. + * `ipam_dhcp_override` (ipamDhcpOverride) - (string) ipamDhcpOverride. + * `ipam_enabled` (ipamEnabled) - (string) ipamEnabled. + - Default: `false` + - Valid Values: `no`, `yes`. + * `ipam_gateway` (ipamGateway) - (string) ipamGateway. + * `lag_policy_name` (lagPolicyName) - (string) LAG Policy Name. + * `netflow_direction` (netflowDir) - (string) Represents NetFlow monitoring direction. + - Default: `both` + - Valid Values: `both`, `egress`, `ingress`. + * `enable_netflow` (netflowPref) - (string) Represents parameter used to enable/disable Netflow Policy. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. + * `number_of_ports` (numPorts) - (string) Number of ports for binding type. + * `port_allocation` (portAllocation) - (string) Port allocation for ports. + - Default: `none` + - Valid Values: `elastic`, `fixed`, `none`. + * `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + * `primary_encapsulation_inner` (primaryEncapInner) - (string) primaryEncapInner. + * `resolve_immediacy` (resImedcy) - (string) Specifies if policies are to be resolved immmediately or when needed. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`, `pre-provision`. + * `secondary_encapsulation_inner` (secondaryEncapInner) - (string) secondaryEncapInner. + * `switching_mode` (switchingMode) - (string) switchingMode. + - Default: `native` + - Valid Values: `AVE`, `native`. + * `untagged` (untagged) - (string) untagged. + - Default: `false` + - Valid Values: `no`, `yes`. + * `vnet_only` (vnetOnly) - (string) vnetOnly. + - Default: `false` + - Valid Values: `no`, `yes`. + +* `relation_to_data_plane_policing_policy` - (list) A list of Relation To Data Plane Policing Policy (ACI object [fvRsDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDppPol/overview)) pointing to Data Plane Policing Policy (ACI Object [qosDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosDppPol/overview)) which can be configured using the [aci_data_plane_policing_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/data_plane_policing_policy) resource. This attribute is supported in ACI versions: 3.0(1k) and later. + - Max Items: 1 + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Data Plane Policing Policy object. + - Default: `orchestrator:terraform` + * `data_plane_policing_policy_name` (tnQosDppPolName) - (string) Name. + +* `relation_to_fibre_channel_paths` - (list) A list of Relation To Fibre Channel Paths (ACI object [fvRsFcPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsFcPathAtt/overview)) pointing to (ACI Object [fabricPathEp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricPathEp/overview)) which can be configured using the [aci_](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/) resource. This attribute is supported in ACI versions: 2.0(1m) and later. + + #### Required #### + + * `target_dn` (tDn) - (string) The distinguished name of the target. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Fibre Channel Path object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Relation To Fibre Channel Path object. + * `vsan` (vsan) - (string) port vsan. + * `vsan_mode` (vsanMode) - (string) vsanMode. + - Default: `regular` + - Valid Values: `native`, `regular`. + +* `relation_to_intra_epg_contracts` - (list) A list of Relation To Intra Epg Contracts (ACI object [fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)) which can be configured using the [aci_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) resource. This attribute is supported in ACI versions: 3.0(1k) and later. + + #### Required #### + + * `contract_name` (tnVzBrCPName) - (string) The contract name. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) with `aci_contract.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/contract) with `data.aci_contract.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Intra Epg Contract object. + - Default: `orchestrator:terraform` + +* `relation_to_static_leafs` - (list) A list of Relation To Static Leafs (ACI object [fvRsNodeAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsNodeAtt/overview)) pointing to (ACI Object [fabricNode](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricNode/overview)) which can be configured using the [aci_](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/) resource. + + #### Required #### + + * `target_dn` (tDn) - (string) The distinguished name of the target of this static binding. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Static Leaf object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Relation To Static Leaf object. + * `encapsulation` (encap) - (string) The encapsulation method (VLAN) for the static binding. + * `deployment_immediacy` (instrImedcy) - (string) null. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. + * `mode` (mode) - (string) The mode of the static association with the path. + - Default: `regular` + - Valid Values: `native`, `regular`, `untagged`. + +* `relation_to_static_paths` - (list) A list of Relation To Static Paths (ACI object [fvRsPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsPathAtt/overview)) pointing to (ACI Object [fabricPathEp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fabricPathEp/overview)) which can be configured using the [aci_](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/) resource. + + #### Required #### + + * `target_dn` (tDn) - (string) null. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Static Path object. + - Default: `orchestrator:terraform` + * `description` (descr) - (string) The description of the Relation To Static Path object. + * `encapsulation` (encap) - (string) The encapsulation method (VLAN) of the path. + * `deployment_immediacy` (instrImedcy) - (string) The deployment immediacy preference of this path association. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. + * `mode` (mode) - (string) The mode of the static association with the path. + - Default: `regular` + - Valid Values: `native`, `regular`, `untagged`. + * `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + +* `relation_to_taboo_contracts` - (list) A list of Relation To Taboo Contracts (ACI object [fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) pointing to Taboo Contract (ACI Object [vzTaboo](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzTaboo/overview)) which can be configured using the [aci_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/taboo_contract) resource. + + #### Required #### + + * `taboo_contract_name` (tnVzTabooName) - (string) A contract for denying specific classes of traffic. Taboo rules are applied in the hardware before applying the rules of regular contracts. Without a contract, the default forwarding policy is to not allow any communication between EPGs. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/taboo_contract) with `aci_taboo_contract.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/taboo_contract) with `data.aci_taboo_contract.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Taboo Contract object. + - Default: `orchestrator:terraform` + +* `relation_to_provided_contracts` - (list) A list of Relation To Provided Contracts (ACI object [fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) pointing to Contract (ACI Object [vzBrCP](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/vzBrCP/overview)) which can be configured using the [aci_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) resource. + + #### Required #### + + * `contract_name` (tnVzBrCPName) - (string) The provider contract name. This attribute can be referenced from a [resource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/contract) with `aci_contract.example.name` or from a [datasource](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/data-sources/contract) with `data.aci_contract.example.name`. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Provided Contract object. + - Default: `orchestrator:terraform` + * `match_criteria` (matchT) - (string) The provider label match criteria. + - Default: `AtleastOne` + - Valid Values: `All`, `AtleastOne`, `AtmostOne`, `None`. + * `priority` (prio) - (string) The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles. + - Default: `unspecified` + - Valid Values: `level1`, `level2`, `level3`, `level4`, `level5`, `level6`, `unspecified`. + +* `relation_to_contract_masters` - (list) A list of Relation To Contract Masters (ACI object [fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) pointing to Application Epg (ACI Object [fvAEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAEPg/overview)) which can be configured using the [aci_application_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_epg) resource. This attribute is supported in ACI versions: 2.3(1e) and later. + + #### Required #### + + * `target_dn` (tDn) - (string) The distinguished name of the target. + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Contract Master object. + - Default: `orchestrator:terraform` + +* `relation_to_trust_control_policy` - (list) A list of Relation To Trust Control Policy (ACI object [fvRsTrustCtrl](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsTrustCtrl/overview)) pointing to Trust Control Policy (ACI Object [fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview)) which can be configured using the [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) resource. This attribute is supported in ACI versions: 3.0(1k) and later. + - Max Items: 1 + + + #### Optional #### + + * `annotation` (annotation) - (string) The annotation of the Relation To Trust Control Policy object. + - Default: `orchestrator:terraform` + * `trust_control_policy_name` (tnFhsTrustCtrlPolName) - (string) Name. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Application Epg 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_application_epg.example_application_profile uni/tn-{name}/ap-{name}/epg-{name} +``` + +Starting in Terraform version 1.5, an existing Application Epg 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}" + to = aci_application_epg.example_application_profile +} +``` diff --git a/docs/resources/custom_qos_policy.md b/docs/resources/custom_qos_policy.md new file mode 100644 index 000000000..955886e71 --- /dev/null +++ b/docs/resources/custom_qos_policy.md @@ -0,0 +1,126 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_custom_qos_policy" +sidebar_current: "docs-aci-resource-aci_custom_qos_policy" +description: |- + Manages ACI Custom Qos Policy +--- + +# aci_custom_qos_policy # + +Manages ACI Custom Qos Policy + + + +## API Information ## + +* Class: [qosCustomPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosCustomPol/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/qoscustom-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> Custom QoS` + +## Example Usage ## + +The configuration snippet below creates a Custom Qos Policy with only required attributes. + +```hcl + +resource "aci_custom_qos_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Custom Qos Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_custom_qos_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description" + name = "test_name" + 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" + } + ] +} + +``` + +All examples for the Custom Qos Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_custom_qos_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `name` (name) - (string) The name of the Custom Qos Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Custom Qos Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Custom Qos Policy object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Custom Qos Policy object. +* `name_alias` (nameAlias) - (string) The name alias of the Custom Qos Policy 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. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Custom Qos Policy 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_custom_qos_policy.example_tenant uni/tn-{name}/qoscustom-{name} +``` + +Starting in Terraform version 1.5, an existing Custom Qos Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/qoscustom-{name}" + to = aci_custom_qos_policy.example_tenant +} +``` diff --git a/docs/resources/data_plane_policing_policy.md b/docs/resources/data_plane_policing_policy.md new file mode 100644 index 000000000..338c939fc --- /dev/null +++ b/docs/resources/data_plane_policing_policy.md @@ -0,0 +1,211 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_data_plane_policing_policy" +sidebar_current: "docs-aci-resource-aci_data_plane_policing_policy" +description: |- + Manages ACI Data Plane Policing Policy +--- + +# aci_data_plane_policing_policy # + +Manages ACI Data Plane Policing Policy + + + +## API Information ## + +* Class: [qosDppPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/qosDppPol/overview) + +* Supported in ACI versions: 1.2(2g) and later. + +* Distinguished Name Formats: + - `uni/infra/qosdpppol-{name}` + - `uni/tn-{name}/qosdpppol-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> Data Plane Policing` + +## Example Usage ## + +The configuration snippet below creates a Data Plane Policing Policy with only required attributes. + +```hcl + +resource "aci_data_plane_policing_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Data Plane Policing Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_data_plane_policing_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_st = "disabled" + annotation = "annotation" + be = "unspecified" + be_unit = "giga" + burst = "unspecified" + burst_unit = "giga" + conform_action = "drop" + conform_mark_cos = "unspecified" + conform_mark_dscp = "unspecified" + description = "description" + exceed_action = "drop" + exceed_mark_cos = "unspecified" + exceed_mark_dscp = "unspecified" + mode = "bit" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + pir = "pir" + pir_unit = "giga" + rate = "rate" + rate_unit = "giga" + sharing_mode = "dedicated" + type = "1R2C" + violate_action = "drop" + violate_mark_cos = "unspecified" + violate_mark_dscp = "unspecified" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Data Plane Policing Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_data_plane_policing_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) + - The distinguished name (DN) of classes below can be used but currently there is no available resource for it: + - [infraInfra](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/infraInfra/overview) + +* `name` (name) - (string) The name of the Data Plane Policing Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Data Plane Policing Policy object. + +### Optional ### + +* `admin_st` (adminSt) - (string) The Administrative state of the policy. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. +* `annotation` (annotation) - (string) The annotation of the Data Plane Policing Policy object. + - Default: `orchestrator:terraform` +* `be` (be) - (string) Excessive burst size (2R3C policer only). + - Default: `unspecified` + - Valid Values: `unspecified`. +* `be_unit` (beUnit) - (string) Excessive Burst unit - none, Kilo, Mega, Giga, ms, us. + - Default: `unspecified` + - Valid Values: `giga`, `kilo`, `mega`, `msec`, `unspecified`, `usec`. +* `burst` (burst) - (string) Committed burst size, number of packets to absorb during a burst. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `burst_unit` (burstUnit) - (string) Burst unit - byte, kbyte, mbyte etc. + - Default: `unspecified` + - Valid Values: `giga`, `kilo`, `mega`, `msec`, `unspecified`, `usec`. +* `conform_action` (conformAction) - (string) Confirm action. + - Default: `transmit` + - Valid Values: `drop`, `mark`, `transmit`. +* `conform_mark_cos` (conformMarkCos) - (string) Conform Mark cos. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `conform_mark_dscp` (conformMarkDscp) - (string) Conform Mark Dscp. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `description` (descr) - (string) The description of the Data Plane Policing Policy object. +* `exceed_action` (exceedAction) - (string) Exceed action. + - Default: `drop` + - Valid Values: `drop`, `mark`, `transmit`. +* `exceed_mark_cos` (exceedMarkCos) - (string) Exceed Mark cos. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `exceed_mark_dscp` (exceedMarkDscp) - (string) Exceed Mark Dscp. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `mode` (mode) - (string) Policer mode - bytes or packet policer. + - Default: `bit` + - Valid Values: `bit`, `packet`. +* `name_alias` (nameAlias) - (string) The name alias of the Data Plane Policing Policy 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. +* `pir` (pir) - (string) Peak rate (pir) (2R3C policer only). +* `pir_unit` (pirUnit) - (string) Peak Rate unit - none, Kilo, Mega, Giga. + - Default: `unspecified` + - Valid Values: `giga`, `kilo`, `mega`, `unspecified`. +* `rate` (rate) - (string) Allowed rate, committed rate at which the packets are allowed into the system. +* `rate_unit` (rateUnit) - (string) Rate unit - bps, kbps, mbps, packets etc. + - Default: `unspecified` + - Valid Values: `giga`, `kilo`, `mega`, `unspecified`. +* `sharing_mode` (sharingMode) - (string) Policer sharing mode. + - Default: `dedicated` + - Valid Values: `dedicated`, `shared`. +* `type` (type) - (string) Policer type. + - Default: `1R2C` + - Valid Values: `1R2C`, `2R3C`. +* `violate_action` (violateAction) - (string) Violate action. + - Default: `drop` + - Valid Values: `drop`, `mark`, `transmit`. +* `violate_mark_cos` (violateMarkCos) - (string) Violate Mark cos. + - Default: `unspecified` + - Valid Values: `unspecified`. +* `violate_mark_dscp` (violateMarkDscp) - (string) Violate Mark Dscp. + - Default: `unspecified` + - Valid Values: `unspecified`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Data Plane Policing Policy 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_data_plane_policing_policy.example_tenant uni/infra/qosdpppol-{name} +``` + +Starting in Terraform version 1.5, an existing Data Plane Policing Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/infra/qosdpppol-{name}" + to = aci_data_plane_policing_policy.example_tenant +} +``` diff --git a/docs/resources/relation_to_domain.md b/docs/resources/relation_to_domain.md new file mode 100644 index 000000000..5856897e8 --- /dev/null +++ b/docs/resources/relation_to_domain.md @@ -0,0 +1,194 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_domain" +sidebar_current: "docs-aci-resource-aci_relation_to_domain" +description: |- + Manages ACI Relation To Domain +--- + +# aci_relation_to_domain # + +Manages ACI Relation To Domain + + + +## API Information ## + +* Class: [fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsdomAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Domains (VMs and Bare-Metals)` + +## Example Usage ## + +The configuration snippet below creates a Relation To Domain with only required attributes. + +```hcl + +resource "aci_relation_to_domain" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "uni/vmmp-VMware/dom-domain_2" +} + +``` +The configuration snippet below shows all possible attributes of the Relation To Domain. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_to_domain" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name" + delimiter = "delimiter" + encapsulation = "encapsulation" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + deployment_immediacy = "immediate" + ipam_dhcp_override = "ipam_dhcp_override" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway" + lag_policy_name = "lag_policy_name" + netflow_direction = "both" + enable_netflow = "disabled" + number_of_ports = "number_of_ports" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation" + primary_encapsulation_inner = "primary_encapsulation_inner" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner" + switching_mode = "AVE" + target_dn = "uni/vmmp-VMware/dom-domain_2" + untagged = "no" + vnet_only = "no" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation To Domain resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_to_domain) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The name of the Physical Domain Profile. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Domain object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation To Domain object. + - Default: `orchestrator:terraform` +* `binding_type` (bindingType) - (string) Binding type for ports. + - Default: `none` + - Valid Values: `dynamicBinding`, `ephemeral`, `none`, `staticBinding`. +* `class_preference` (classPref) - (string) classPref. + - Default: `encap` + - Valid Values: `encap`, `useg`. +* `custom_epg_name` (customEpgName) - (string) User-configured port-group display name. +* `delimiter` (delimiter) - (string) delimiter. +* `encapsulation` (encap) - (string) The port encapsulation. +* `encapsulation_mode` (encapMode) - (string) encapMode. + - Default: `auto` + - Valid Values: `auto`, `vlan`, `vxlan`. +* `epg_cos` (epgCos) - (string) Represents Epg Cos for AVS. + - Default: `Cos0` + - Valid Values: `Cos0`, `Cos1`, `Cos2`, `Cos3`, `Cos4`, `Cos5`, `Cos6`, `Cos7`. +* `epg_cos_pref` (epgCosPref) - (string) Represents parameter used to enable/disable Epg Cos Policy. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. +* `deployment_immediacy` (instrImedcy) - (string) Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. +* `ipam_dhcp_override` (ipamDhcpOverride) - (string) ipamDhcpOverride. +* `ipam_enabled` (ipamEnabled) - (string) ipamEnabled. + - Default: `false` + - Valid Values: `no`, `yes`. +* `ipam_gateway` (ipamGateway) - (string) ipamGateway. +* `lag_policy_name` (lagPolicyName) - (string) LAG Policy Name. +* `netflow_direction` (netflowDir) - (string) Represents NetFlow monitoring direction. + - Default: `both` + - Valid Values: `both`, `egress`, `ingress`. +* `enable_netflow` (netflowPref) - (string) Represents parameter used to enable/disable Netflow Policy. + - Default: `disabled` + - Valid Values: `disabled`, `enabled`. +* `number_of_ports` (numPorts) - (string) Number of ports for binding type. +* `port_allocation` (portAllocation) - (string) Port allocation for ports. + - Default: `none` + - Valid Values: `elastic`, `fixed`, `none`. +* `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. +* `primary_encapsulation_inner` (primaryEncapInner) - (string) primaryEncapInner. +* `resolve_immediacy` (resImedcy) - (string) Specifies if policies are to be resolved immmediately or when needed. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`, `pre-provision`. +* `secondary_encapsulation_inner` (secondaryEncapInner) - (string) secondaryEncapInner. +* `switching_mode` (switchingMode) - (string) switchingMode. + - Default: `native` + - Valid Values: `AVE`, `native`. +* `untagged` (untagged) - (string) untagged. + - Default: `false` + - Valid Values: `no`, `yes`. +* `vnet_only` (vnetOnly) - (string) vnetOnly. + - Default: `false` + - Valid Values: `no`, `yes`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation To Domain 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_relation_to_domain.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/rsdomAtt-[{tDn}] +``` + +Starting in Terraform version 1.5, an existing Relation To Domain 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}/rsdomAtt-[{tDn}]" + to = aci_relation_to_domain.example_application_epg +} +``` diff --git a/docs/resources/relation_to_fibre_channel_path.md b/docs/resources/relation_to_fibre_channel_path.md new file mode 100644 index 000000000..04e2d36b4 --- /dev/null +++ b/docs/resources/relation_to_fibre_channel_path.md @@ -0,0 +1,126 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_fibre_channel_path" +sidebar_current: "docs-aci-resource-aci_relation_to_fibre_channel_path" +description: |- + Manages ACI Relation To Fibre Channel Path +--- + +# aci_relation_to_fibre_channel_path # + +Manages ACI Relation To Fibre Channel Path + + + +## API Information ## + +* Class: [fvRsFcPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsFcPathAtt/overview) + +* Supported in ACI versions: 2.0(1m) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsfcPathAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Fibre Channel (Paths)` + +## Example Usage ## + +The configuration snippet below creates a Relation To Fibre Channel Path with only required attributes. + +```hcl + +resource "aci_relation_to_fibre_channel_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "" +} + +``` +The configuration snippet below shows all possible attributes of the Relation To Fibre Channel Path. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_to_fibre_channel_path" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + target_dn = "" + vsan = "vsan" + vsan_mode = "native" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation To Fibre Channel Path resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_to_fibre_channel_path) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The distinguished name of the target. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Fibre Channel Path object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation To Fibre Channel Path object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Relation To Fibre Channel Path object. +* `vsan` (vsan) - (string) port vsan. +* `vsan_mode` (vsanMode) - (string) vsanMode. + - Default: `regular` + - Valid Values: `native`, `regular`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation To Fibre Channel Path 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_relation_to_fibre_channel_path.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/rsfcPathAtt-[{tDn}] +``` + +Starting in Terraform version 1.5, an existing Relation To Fibre Channel Path 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}/rsfcPathAtt-[{tDn}]" + to = aci_relation_to_fibre_channel_path.example_application_epg +} +``` diff --git a/docs/resources/relation_to_static_leaf.md b/docs/resources/relation_to_static_leaf.md new file mode 100644 index 000000000..2d44204e4 --- /dev/null +++ b/docs/resources/relation_to_static_leaf.md @@ -0,0 +1,130 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_static_leaf" +sidebar_current: "docs-aci-resource-aci_relation_to_static_leaf" +description: |- + Manages ACI Relation To Static Leaf +--- + +# aci_relation_to_static_leaf # + +Manages ACI Relation To Static Leaf + + + +## API Information ## + +* Class: [fvRsNodeAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsNodeAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rsnodeAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Static Leafs` + +## Example Usage ## + +The configuration snippet below creates a Relation To Static Leaf with only required attributes. + +```hcl + +resource "aci_relation_to_static_leaf" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/node-101" +} + +``` +The configuration snippet below shows all possible attributes of the Relation To Static Leaf. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_to_static_leaf" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + encapsulation = "encapsulation" + deployment_immediacy = "immediate" + mode = "native" + target_dn = "topology/pod-1/node-101" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation To Static Leaf resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_to_static_leaf) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) The distinguished name of the target of this static binding. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Static Leaf object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation To Static Leaf object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Relation To Static Leaf object. +* `encapsulation` (encap) - (string) The encapsulation method (VLAN) for the static binding. +* `deployment_immediacy` (instrImedcy) - (string) null. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. +* `mode` (mode) - (string) The mode of the static association with the path. + - Default: `regular` + - Valid Values: `native`, `regular`, `untagged`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation To Static Leaf 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_relation_to_static_leaf.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/rsnodeAtt-[{tDn}] +``` + +Starting in Terraform version 1.5, an existing Relation To Static Leaf 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}/rsnodeAtt-[{tDn}]" + to = aci_relation_to_static_leaf.example_application_epg +} +``` diff --git a/docs/resources/relation_to_static_path.md b/docs/resources/relation_to_static_path.md new file mode 100644 index 000000000..711df8da1 --- /dev/null +++ b/docs/resources/relation_to_static_path.md @@ -0,0 +1,132 @@ +--- +# Documentation 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). +subcategory: "Application Management" +layout: "aci" +page_title: "ACI: aci_relation_to_static_path" +sidebar_current: "docs-aci-resource-aci_relation_to_static_path" +description: |- + Manages ACI Relation To Static Path +--- + +# aci_relation_to_static_path # + +Manages ACI Relation To Static Path + + + +## API Information ## + +* Class: [fvRsPathAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsPathAtt/overview) + +* Supported in ACI versions: 1.0(1e) and later. + +* Distinguished Name Format: `uni/tn-{name}/ap-{name}/epg-{name}/rspathAtt-[{tDn}]` + +## GUI Information ## + +* Location: `Tenants -> Application Profiles -> Application EPGs -> Static Ports` + +## Example Usage ## + +The configuration snippet below creates a Relation To Static Path with only required attributes. + +```hcl + +resource "aci_relation_to_static_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" +} + +``` +The configuration snippet below shows all possible attributes of the Relation To Static Path. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_relation_to_static_path" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + encapsulation = "encapsulation" + deployment_immediacy = "immediate" + mode = "native" + primary_encapsulation = "primary_encapsulation" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Relation To Static Path resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_relation_to_static_path) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `target_dn` (tDn) - (string) null. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Relation To Static Path object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Relation To Static Path object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Relation To Static Path object. +* `encapsulation` (encap) - (string) The encapsulation method (VLAN) of the path. +* `deployment_immediacy` (instrImedcy) - (string) The deployment immediacy preference of this path association. + - Default: `lazy` + - Valid Values: `immediate`, `lazy`. +* `mode` (mode) - (string) The mode of the static association with the path. + - Default: `regular` + - Valid Values: `native`, `regular`, `untagged`. +* `primary_encapsulation` (primaryEncap) - (string) Represents the primary encap when the EPG is isolated. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Relation To Static Path 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_relation_to_static_path.example_application_epg uni/tn-{name}/ap-{name}/epg-{name}/rspathAtt-[{tDn}] +``` + +Starting in Terraform version 1.5, an existing Relation To Static Path 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}/rspathAtt-[{tDn}]" + to = aci_relation_to_static_path.example_application_epg +} +``` diff --git a/docs/resources/tag.md b/docs/resources/tag.md index 011b29aa2..8cbe46996 100644 --- a/docs/resources/tag.md +++ b/docs/resources/tag.md @@ -66,8 +66,10 @@ All examples for the Tag resource can be found in the [examples](https://github. - [aci_cloud_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_epg) ([cloudEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudEPg/overview)) - [aci_cloud_external_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_external_epg) ([cloudExtEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudExtEPg/overview)) - [aci_cloud_service_epg](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/cloud_service_epg) ([cloudSvcEPg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/cloudSvcEPg/overview)) + - [aci_trust_control_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/trust_control_policy) ([fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/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_application_profile](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/application_profile) ([fvAp](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvAp/overview)) + - [aci_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/bridge_domain) ([fvBD](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvBD/overview)) - [aci_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf) ([fvCtx](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvCtx/overview)) - [aci_endpoint_security_group](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/endpoint_security_group) ([fvESg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvESg/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)) @@ -75,14 +77,12 @@ All examples for the Tag resource can be found in the [examples](https://github. - [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_vrf_fallback_route](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/vrf_fallback_route) ([fvFBRoute](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvFBRoute/overview)) + - [aci_relation_to_application_epg_monitoring_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_application_epg_monitoring_policy) ([fvRsAEPgMonPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsAEPgMonPol/overview)) + - [aci_relation_to_bridge_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_bridge_domain) ([fvRsBd](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsBd/overview)) - [aci_relation_to_consumed_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_consumed_contract) ([fvRsCons](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCons/overview)) - [aci_relation_to_imported_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_imported_contract) ([fvRsConsIf](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsConsIf/overview)) - - [aci_relation_to_intra_epg_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_intra_epg_contract) ([fvRsIntraEpg](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsIntraEpg/overview)) - - [aci_relation_to_taboo_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_taboo_contract) ([fvRsProtBy](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProtBy/overview)) - - [aci_relation_to_provided_contract](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_provided_contract) ([fvRsProv](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsProv/overview)) - - [aci_relation_to_vrf](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_vrf) ([fvRsScope](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsScope/overview)) - - [aci_relation_to_contract_master](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_contract_master) ([fvRsSecInherited](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsSecInherited/overview)) - - [aci_tenant](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tenant) ([fvTenant](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvTenant/overview)) + - [aci_relation_to_custom_qos_policy](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_custom_qos_policy) ([fvRsCustQosPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsCustQosPol/overview)) + - [aci_relation_to_domain](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/relation_to_domain) ([fvRsDomAtt](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fvRsDomAtt/overview)) * `key` (key) - (string) The key used to uniquely identify this configuration object. * `value` (value) - (string) The value of the property. diff --git a/docs/resources/trust_control_policy.md b/docs/resources/trust_control_policy.md new file mode 100644 index 000000000..e31beab99 --- /dev/null +++ b/docs/resources/trust_control_policy.md @@ -0,0 +1,150 @@ +--- +# Documentation 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). +subcategory: "Tenant Policies" +layout: "aci" +page_title: "ACI: aci_trust_control_policy" +sidebar_current: "docs-aci-resource-aci_trust_control_policy" +description: |- + Manages ACI Trust Control Policy +--- + +# aci_trust_control_policy # + +Manages ACI Trust Control Policy + + + +## API Information ## + +* Class: [fhsTrustCtrlPol](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/fhsTrustCtrlPol/overview) + +* Supported in ACI versions: 3.0(1k) and later. + +* Distinguished Name Format: `uni/tn-{name}/trustctrlpol-{name}` + +## GUI Information ## + +* Location: `Tenants -> Policies -> Protocol -> First Hop Security -> Trust Control Policies` + +## Example Usage ## + +The configuration snippet below creates a Trust Control Policy with only required attributes. + +```hcl + +resource "aci_trust_control_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} + +``` +The configuration snippet below shows all possible attributes of the Trust Control Policy. + +!> This example might not be valid configuration and is only used to show all possible attributes. + +```hcl + +resource "aci_trust_control_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description" + has_dhcpv4_server = "no" + has_dhcpv6_server = "no" + has_ipv6_router = "no" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + trust_arp = "no" + trust_nd = "no" + trust_ra = "no" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} + +``` + +All examples for the Trust Control Policy resource can be found in the [examples](https://github.com/CiscoDevNet/terraform-provider-aci/tree/master/examples/resources/aci_trust_control_policy) folder. + +## Schema ## + +### Required ### + +* `parent_dn` - (string) The distinguished name (DN) of the parent object, possible resources: + - [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)) +* `name` (name) - (string) The name of the Trust Control Policy object. + +### Read-Only ### + +* `id` - (string) The distinguished name (DN) of the Trust Control Policy object. + +### Optional ### + +* `annotation` (annotation) - (string) The annotation of the Trust Control Policy object. + - Default: `orchestrator:terraform` +* `description` (descr) - (string) The description of the Trust Control Policy object. +* `has_dhcpv4_server` (hasDhcpv4Server) - (string) Contains DHCPv4 servers. + - Default: `false` + - Valid Values: `no`, `yes`. +* `has_dhcpv6_server` (hasDhcpv6Server) - (string) Contains DHCPv6 servers. + - Default: `false` + - Valid Values: `no`, `yes`. +* `has_ipv6_router` (hasIpv6Router) - (string) Contains IPv6 routers. + - Default: `false` + - Valid Values: `no`, `yes`. +* `name_alias` (nameAlias) - (string) The name alias of the Trust Control Policy 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. +* `trust_arp` (trustArp) - (string) Trust ARP. + - Default: `false` + - Valid Values: `no`, `yes`. +* `trust_nd` (trustNd) - (string) Trust ND. + - Default: `false` + - Valid Values: `no`, `yes`. +* `trust_ra` (trustRa) - (string) Trust router advertisement. + - Default: `false` + - Valid Values: `no`, `yes`. + +* `annotations` - (list) A list of Annotations (ACI object [tagAnnotation](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagAnnotation/overview)). Annotations can also be configured using a separate [aci_annotation](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/annotation) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +* `tags` - (list) A list of Tags (ACI object [tagTag](https://pubhub.devnetcloud.com/media/model-doc-latest/docs/app/index.html#/objects/tagTag/overview)). Tags can also be configured using a separate [aci_tag](https://registry.terraform.io/providers/CiscoDevNet/aci/latest/docs/resources/tag) resource. This attribute is supported in ACI versions: 3.2(1l) and later. + + #### Required #### + + * `key` (key) - (string) The key used to uniquely identify this configuration object. + * `value` (value) - (string) The value of the property. + +## Importing + +An existing Trust Control Policy 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_trust_control_policy.example_tenant uni/tn-{name}/trustctrlpol-{name} +``` + +Starting in Terraform version 1.5, an existing Trust Control Policy can be imported +using [import blocks](https://developer.hashicorp.com/terraform/language/import) via the following configuration: + +``` +import { + id = "uni/tn-{name}/trustctrlpol-{name}" + to = aci_trust_control_policy.example_tenant +} +``` diff --git a/examples/data-sources/aci_application_epg/data-source.tf b/examples/data-sources/aci_application_epg/data-source.tf new file mode 100644 index 000000000..c4b45596f --- /dev/null +++ b/examples/data-sources/aci_application_epg/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_application_epg" "example_application_profile" { + parent_dn = aci_application_profile.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_application_epg/provider.tf b/examples/data-sources/aci_application_epg/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_application_epg/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_custom_qos_policy/data-source.tf b/examples/data-sources/aci_custom_qos_policy/data-source.tf new file mode 100644 index 000000000..9cad89f8f --- /dev/null +++ b/examples/data-sources/aci_custom_qos_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_custom_qos_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_custom_qos_policy/provider.tf b/examples/data-sources/aci_custom_qos_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_custom_qos_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_data_plane_policing_policy/data-source.tf b/examples/data-sources/aci_data_plane_policing_policy/data-source.tf new file mode 100644 index 000000000..6f85a20ae --- /dev/null +++ b/examples/data-sources/aci_data_plane_policing_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_data_plane_policing_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_data_plane_policing_policy/provider.tf b/examples/data-sources/aci_data_plane_policing_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_data_plane_policing_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_to_domain/data-source.tf b/examples/data-sources/aci_relation_to_domain/data-source.tf new file mode 100644 index 000000000..5b31cd8c3 --- /dev/null +++ b/examples/data-sources/aci_relation_to_domain/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_relation_to_domain" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "uni/vmmp-VMware/dom-domain_2" +} diff --git a/examples/data-sources/aci_relation_to_domain/provider.tf b/examples/data-sources/aci_relation_to_domain/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_to_domain/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_to_fibre_channel_path/data-source.tf b/examples/data-sources/aci_relation_to_fibre_channel_path/data-source.tf new file mode 100644 index 000000000..61ae80230 --- /dev/null +++ b/examples/data-sources/aci_relation_to_fibre_channel_path/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_relation_to_fibre_channel_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "" +} diff --git a/examples/data-sources/aci_relation_to_fibre_channel_path/provider.tf b/examples/data-sources/aci_relation_to_fibre_channel_path/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_to_fibre_channel_path/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_to_static_leaf/data-source.tf b/examples/data-sources/aci_relation_to_static_leaf/data-source.tf new file mode 100644 index 000000000..6f8ef84c8 --- /dev/null +++ b/examples/data-sources/aci_relation_to_static_leaf/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_relation_to_static_leaf" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/node-101" +} diff --git a/examples/data-sources/aci_relation_to_static_leaf/provider.tf b/examples/data-sources/aci_relation_to_static_leaf/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_to_static_leaf/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_relation_to_static_path/data-source.tf b/examples/data-sources/aci_relation_to_static_path/data-source.tf new file mode 100644 index 000000000..8b180f2b2 --- /dev/null +++ b/examples/data-sources/aci_relation_to_static_path/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_relation_to_static_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" +} diff --git a/examples/data-sources/aci_relation_to_static_path/provider.tf b/examples/data-sources/aci_relation_to_static_path/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_relation_to_static_path/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/data-sources/aci_trust_control_policy/data-source.tf b/examples/data-sources/aci_trust_control_policy/data-source.tf new file mode 100644 index 000000000..6cf6e380f --- /dev/null +++ b/examples/data-sources/aci_trust_control_policy/data-source.tf @@ -0,0 +1,5 @@ + +data "aci_trust_control_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/data-sources/aci_trust_control_policy/provider.tf b/examples/data-sources/aci_trust_control_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/data-sources/aci_trust_control_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_application_epg/provider.tf b/examples/resources/aci_application_epg/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_application_epg/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_application_epg/resource-all-attributes.tf b/examples/resources/aci_application_epg/resource-all-attributes.tf new file mode 100644 index 000000000..172cfd2f4 --- /dev/null +++ b/examples/resources/aci_application_epg/resource-all-attributes.tf @@ -0,0 +1,160 @@ + +resource "aci_application_epg" "full_example_application_profile" { + parent_dn = aci_application_profile.example.id + annotation = "annotation" + description = "description" + exception_tag = "exception_tag" + flood_on_encap = "disabled" + forwarding_control = "proxy-arp" + has_multicast_source = "no" + useg_epg = "no" + match_criteria = "All" + name = "test_name" + name_alias = "name_alias" + intra_epg_isolation = "enforced" + preferred_group_member = "exclude" + priority = "level1" + admin_state = "no" + relation_to_application_epg_monitoring_policy = [ + { + annotation = "annotation_1" + monitoring_policy_name = aci_monitoring_policy.example.name + } + ] + relation_to_bridge_domain = [ + { + annotation = "annotation_1" + bridge_domain_name = aci_bridge_domain.example.name + } + ] + relation_to_consumed_contracts = [ + { + annotation = "annotation_1" + priority = "level1" + contract_name = aci_contract.example.name + } + ] + relation_to_imported_contracts = [ + { + annotation = "annotation_1" + priority = "level1" + imported_contract_name = aci_imported_contract.example.name + } + ] + relation_to_custom_qos_policy = [ + { + annotation = "annotation_1" + custom_qos_policy_name = aci_custom_qos_policy.example.name + } + ] + relation_to_domains = [ + { + annotation = "annotation_1" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name_1" + delimiter = "delimiter_1" + encapsulation = "encapsulation_1" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + deployment_immediacy = "immediate" + ipam_dhcp_override = "ipam_dhcp_override_1" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway_1" + lag_policy_name = "lag_policy_name_1" + netflow_direction = "both" + enable_netflow = "disabled" + number_of_ports = "number_of_ports_1" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation_1" + primary_encapsulation_inner = "primary_encapsulation_inner_1" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner_1" + switching_mode = "AVE" + target_dn = "uni/vmmp-VMware/dom-domain_1" + untagged = "no" + vnet_only = "no" + } + ] + relation_to_data_plane_policing_policy = [ + { + annotation = "annotation_1" + data_plane_policing_policy_name = aci_data_plane_policing_policy.example.name + } + ] + relation_to_fibre_channel_paths = [ + { + annotation = "annotation_1" + description = "description_1" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + vsan = "vsan_1" + vsan_mode = "native" + } + ] + relation_to_intra_epg_contracts = [ + { + annotation = "annotation_1" + contract_name = aci_contract.example.name + } + ] + relation_to_static_leafs = [ + { + annotation = "annotation_1" + description = "description_1" + encapsulation = "encapsulation_1" + deployment_immediacy = "immediate" + mode = "native" + target_dn = "topology/pod-1/node-101" + } + ] + relation_to_static_paths = [ + { + annotation = "annotation_1" + description = "description_1" + encapsulation = "encapsulation_1" + deployment_immediacy = "immediate" + mode = "native" + primary_encapsulation = "primary_encapsulation_1" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + } + ] + relation_to_taboo_contracts = [ + { + annotation = "annotation_1" + taboo_contract_name = aci_taboo_contract.example.name + } + ] + relation_to_provided_contracts = [ + { + annotation = "annotation_1" + match_criteria = "All" + priority = "level1" + contract_name = aci_contract.example.name + } + ] + relation_to_contract_masters = [ + { + annotation = "annotation_1" + target_dn = aci_application_epg.test_2.id + } + ] + relation_to_trust_control_policy = [ + { + annotation = "annotation_1" + trust_control_policy_name = aci_trust_control_policy.example.name + } + ] + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_application_epg/resource.tf b/examples/resources/aci_application_epg/resource.tf new file mode 100644 index 000000000..0986d252b --- /dev/null +++ b/examples/resources/aci_application_epg/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_application_epg" "example_application_profile" { + parent_dn = aci_application_profile.example.id + name = "test_name" +} diff --git a/examples/resources/aci_custom_qos_policy/provider.tf b/examples/resources/aci_custom_qos_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_custom_qos_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_custom_qos_policy/resource-all-attributes.tf b/examples/resources/aci_custom_qos_policy/resource-all-attributes.tf new file mode 100644 index 000000000..6f4e3370e --- /dev/null +++ b/examples/resources/aci_custom_qos_policy/resource-all-attributes.tf @@ -0,0 +1,22 @@ + +resource "aci_custom_qos_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description" + name = "test_name" + 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_custom_qos_policy/resource.tf b/examples/resources/aci_custom_qos_policy/resource.tf new file mode 100644 index 000000000..a1ac4a3ba --- /dev/null +++ b/examples/resources/aci_custom_qos_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_custom_qos_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_data_plane_policing_policy/provider.tf b/examples/resources/aci_data_plane_policing_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_data_plane_policing_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_data_plane_policing_policy/resource-all-attributes.tf b/examples/resources/aci_data_plane_policing_policy/resource-all-attributes.tf new file mode 100644 index 000000000..6fbb791d8 --- /dev/null +++ b/examples/resources/aci_data_plane_policing_policy/resource-all-attributes.tf @@ -0,0 +1,43 @@ + +resource "aci_data_plane_policing_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + admin_st = "disabled" + annotation = "annotation" + be = "unspecified" + be_unit = "giga" + burst = "unspecified" + burst_unit = "giga" + conform_action = "drop" + conform_mark_cos = "unspecified" + conform_mark_dscp = "unspecified" + description = "description" + exceed_action = "drop" + exceed_mark_cos = "unspecified" + exceed_mark_dscp = "unspecified" + mode = "bit" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + pir = "pir" + pir_unit = "giga" + rate = "rate" + rate_unit = "giga" + sharing_mode = "dedicated" + type = "1R2C" + violate_action = "drop" + violate_mark_cos = "unspecified" + violate_mark_dscp = "unspecified" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_data_plane_policing_policy/resource.tf b/examples/resources/aci_data_plane_policing_policy/resource.tf new file mode 100644 index 000000000..e3b5d03ad --- /dev/null +++ b/examples/resources/aci_data_plane_policing_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_data_plane_policing_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/examples/resources/aci_relation_to_domain/provider.tf b/examples/resources/aci_relation_to_domain/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_to_domain/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_to_domain/resource-all-attributes.tf b/examples/resources/aci_relation_to_domain/resource-all-attributes.tf new file mode 100644 index 000000000..ac3829466 --- /dev/null +++ b/examples/resources/aci_relation_to_domain/resource-all-attributes.tf @@ -0,0 +1,42 @@ + +resource "aci_relation_to_domain" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name" + delimiter = "delimiter" + encapsulation = "encapsulation" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + deployment_immediacy = "immediate" + ipam_dhcp_override = "ipam_dhcp_override" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway" + lag_policy_name = "lag_policy_name" + netflow_direction = "both" + enable_netflow = "disabled" + number_of_ports = "number_of_ports" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation" + primary_encapsulation_inner = "primary_encapsulation_inner" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner" + switching_mode = "AVE" + target_dn = "uni/vmmp-VMware/dom-domain_2" + untagged = "no" + vnet_only = "no" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_to_domain/resource.tf b/examples/resources/aci_relation_to_domain/resource.tf new file mode 100644 index 000000000..84f83930c --- /dev/null +++ b/examples/resources/aci_relation_to_domain/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_relation_to_domain" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "uni/vmmp-VMware/dom-domain_2" +} diff --git a/examples/resources/aci_relation_to_fibre_channel_path/provider.tf b/examples/resources/aci_relation_to_fibre_channel_path/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_to_fibre_channel_path/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_to_fibre_channel_path/resource-all-attributes.tf b/examples/resources/aci_relation_to_fibre_channel_path/resource-all-attributes.tf new file mode 100644 index 000000000..f0b9658fc --- /dev/null +++ b/examples/resources/aci_relation_to_fibre_channel_path/resource-all-attributes.tf @@ -0,0 +1,21 @@ + +resource "aci_relation_to_fibre_channel_path" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + target_dn = "" + vsan = "vsan" + vsan_mode = "native" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_to_fibre_channel_path/resource.tf b/examples/resources/aci_relation_to_fibre_channel_path/resource.tf new file mode 100644 index 000000000..0e7e649dc --- /dev/null +++ b/examples/resources/aci_relation_to_fibre_channel_path/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_relation_to_fibre_channel_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "" +} diff --git a/examples/resources/aci_relation_to_static_leaf/provider.tf b/examples/resources/aci_relation_to_static_leaf/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_to_static_leaf/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_to_static_leaf/resource-all-attributes.tf b/examples/resources/aci_relation_to_static_leaf/resource-all-attributes.tf new file mode 100644 index 000000000..822070c59 --- /dev/null +++ b/examples/resources/aci_relation_to_static_leaf/resource-all-attributes.tf @@ -0,0 +1,22 @@ + +resource "aci_relation_to_static_leaf" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + encapsulation = "encapsulation" + deployment_immediacy = "immediate" + mode = "native" + target_dn = "topology/pod-1/node-101" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_to_static_leaf/resource.tf b/examples/resources/aci_relation_to_static_leaf/resource.tf new file mode 100644 index 000000000..d1366219e --- /dev/null +++ b/examples/resources/aci_relation_to_static_leaf/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_relation_to_static_leaf" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/node-101" +} diff --git a/examples/resources/aci_relation_to_static_path/provider.tf b/examples/resources/aci_relation_to_static_path/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_relation_to_static_path/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_relation_to_static_path/resource-all-attributes.tf b/examples/resources/aci_relation_to_static_path/resource-all-attributes.tf new file mode 100644 index 000000000..0ad77cd92 --- /dev/null +++ b/examples/resources/aci_relation_to_static_path/resource-all-attributes.tf @@ -0,0 +1,23 @@ + +resource "aci_relation_to_static_path" "full_example_application_epg" { + parent_dn = aci_application_epg.example.id + annotation = "annotation" + description = "description" + encapsulation = "encapsulation" + deployment_immediacy = "immediate" + mode = "native" + primary_encapsulation = "primary_encapsulation" + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_relation_to_static_path/resource.tf b/examples/resources/aci_relation_to_static_path/resource.tf new file mode 100644 index 000000000..d6fa0e21e --- /dev/null +++ b/examples/resources/aci_relation_to_static_path/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_relation_to_static_path" "example_application_epg" { + parent_dn = aci_application_epg.example.id + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]" +} diff --git a/examples/resources/aci_trust_control_policy/provider.tf b/examples/resources/aci_trust_control_policy/provider.tf new file mode 100644 index 000000000..975fca093 --- /dev/null +++ b/examples/resources/aci_trust_control_policy/provider.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + aci = { + source = "ciscodevnet/aci" + } + } +} + +provider "aci" { + username = "" + password = "" + url = "" + insecure = true +} \ No newline at end of file diff --git a/examples/resources/aci_trust_control_policy/resource-all-attributes.tf b/examples/resources/aci_trust_control_policy/resource-all-attributes.tf new file mode 100644 index 000000000..f62484535 --- /dev/null +++ b/examples/resources/aci_trust_control_policy/resource-all-attributes.tf @@ -0,0 +1,28 @@ + +resource "aci_trust_control_policy" "full_example_tenant" { + parent_dn = aci_tenant.example.id + annotation = "annotation" + description = "description" + has_dhcpv4_server = "no" + has_dhcpv6_server = "no" + has_ipv6_router = "no" + name = "test_name" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + trust_arp = "no" + trust_nd = "no" + trust_ra = "no" + annotations = [ + { + key = "key_0" + value = "value_1" + } + ] + tags = [ + { + key = "key_0" + value = "value_1" + } + ] +} diff --git a/examples/resources/aci_trust_control_policy/resource.tf b/examples/resources/aci_trust_control_policy/resource.tf new file mode 100644 index 000000000..eec6f36d5 --- /dev/null +++ b/examples/resources/aci_trust_control_policy/resource.tf @@ -0,0 +1,5 @@ + +resource "aci_trust_control_policy" "example_tenant" { + parent_dn = aci_tenant.example.id + name = "test_name" +} diff --git a/gen/definitions/classes.yaml b/gen/definitions/classes.yaml index 3a56d0b3d..41032fffd 100644 --- a/gen/definitions/classes.yaml +++ b/gen/definitions/classes.yaml @@ -8,8 +8,135 @@ global: fvTenant: resource_name: "tenant" +fvBD: + resource_name: "bridge_domain" + fvAEPg: resource_name: "application_epg" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs" + sub_category: "Application Management" + migration_version: 1 + migration_blocks: + fvAEPg: + application_profile_dn: parent_dn + match_t: match_criteria + pc_enf_pref: intra_epg_isolation + pref_gr_memb: preferred_group_member + fwd_ctrl: forwarding_control + has_mcast_source: has_multicast_source + is_attr_based_epg: useg_epg + prio: priority + shutdown: admin_state + fvRsBd: + relation_fv_rs_bd: relation_to_bridge_domain.bridge_domain_name + fvRsCustQosPol: + relation_fv_rs_cust_qos_pol: relation_to_custom_qos_policy.custom_qos_policy_name + fvRsFcPathAtt: + relation_fv_rs_fc_path_att: relation_to_fibre_channel_paths.fibre_channel_path_name + fvRsProv: + relation_fv_rs_prov: relation_to_provided_contracts.contract_name + fvRsConsIf: + relation_fv_rs_cons_if: relation_to_imported_contracts.imported_contract_name + fvRsSecInherited: + relation_fv_rs_sec_inherited: relation_to_contract_masters.target_dn + fvRsDppPol: + relation_fv_rs_dpp_pol: relation_to_data_plane_policing_policy.data_plane_policing_policy_name + fvRsCons: + relation_fv_rs_cons: relation_to_consumed_contracts.contract_name + fvRsTrustCtrl: + relation_fv_rs_trust_ctrl: relation_to_trust_control_policy.trust_control_policy_name + fvRsProtBy: + relation_fv_rs_prot_by: relation_to_taboo_contracts.taboo_contract_name + fvRsAEPgMonPol: + relation_fv_rs_aepg_mon_pol: relation_to_application_epg_monitoring_policy.monitoring_policy_name + fvRsIntraEpg: + relation_fv_rs_intra_epg: relation_to_intra_epg_contracts.contract_name + fvRsPathAtt: + relation_fv_rs_path_att: relation_to_static_paths.target_dn + fvRsNodeAtt: + relation_fv_rs_node_att: relation_to_static_leafs + node_dn: relation_to_static_leafs.target_dn + encap: relation_to_static_leafs.encapsulation + description: relation_to_static_leafs.description + deployment_immediacy: relation_to_static_leafs.deployment_immediacy + mode: relation_to_static_leafs.mode + +fvRsAEPgMonPol: + resource_name: "relation_to_application_epg_monitoring_policy" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Policy -> General" + sub_category: "Application Management" + +fvRsBd: + resource_name: "relation_to_bridge_domain" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Policy -> General" + sub_category: "Application Management" + +fvRsCustQosPol: + resource_name: "relation_to_custom_qos_policy" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Policy -> General" + sub_category: "Application Management" + +fvRsDppPol: + resource_name: "relation_to_data_plane_policing_policy" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Policy -> General" + sub_category: "Application Management" + +fvRsFcPathAtt: + resource_name: "relation_to_fibre_channel_path" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Fibre Channel (Paths)" + sub_category: "Application Management" + +fvRsNodeAtt: + resource_name: "relation_to_static_leaf" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Static Leafs" + sub_category: "Application Management" + +fvRsDomAtt: + resource_name: "relation_to_domain" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Domains (VMs and Bare-Metals)" + sub_category: "Application Management" + +fvRsPathAtt: + resource_name: "relation_to_static_path" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Static Ports" + sub_category: "Application Management" + +fvRsTrustCtrl: + resource_name: "relation_to_trust_control_policy" + ui_locations: + - "Tenants -> Application Profiles -> Application EPGs -> Policy -> General" + sub_category: "Application Management" + +qosCustomPol: + resource_name: "custom_qos_policy" + ui_locations: + - "Tenants -> Policies -> Protocol -> Custom QoS" + sub_category: "Tenant Policies" + +fhsTrustCtrlPol: + ui_locations: + - "Tenants -> Policies -> Protocol -> First Hop Security -> Trust Control Policies" + sub_category: "Tenant Policies" + +qosDppPol: + ui_locations: + - "Tenants -> Policies -> Protocol -> Data Plane Policing" + sub_category: "Tenant Policies" + +monEPGPol: + resource_name: "monitoring_policy" + +vmmDomP: + resource_name: "vmm_domain" fvAp: resource_name: "application_profile" @@ -254,6 +381,7 @@ fvESg: sub_category: "Application Management" exclude_children: - "fvRsProtBy" + - "fvRsCustQosPol" migration_version: 1 migration_blocks: fvESg: diff --git a/gen/definitions/properties.yaml b/gen/definitions/properties.yaml index 8c248811b..ec3e4dba9 100644 --- a/gen/definitions/properties.yaml +++ b/gen/definitions/properties.yaml @@ -23,7 +23,17 @@ global: prio: "priority" match_t: "match_criteria" descr: "description" - + encap: "encapsulation" + encap_mode: "encapsulation_mode" + primary_encap: "primary_encapsulation" + primary_encap_inner: "primary_encapsulation_inner" + secondary_encap_inner: "secondary_encapsulation_inner" + instr_imedcy: "deployment_immediacy" + res_imedcy: "resolve_immediacy" + netflow_dir: "netflow_direction" + netflow_pref: "enable_netflow" + num_ports: "number_of_ports" + class_pref: "class_preference" resource_name_doc_overwrite: Vrf: VRF Sid: "SR-MPLS Segment ID" @@ -359,6 +369,8 @@ fvESg: parents: - class_name: "fvAp" parent_dependency: "fvTenant" + exclude_targets: + - "fvAEPg" ignores: - "floodOnEncap" - "prio" @@ -454,3 +466,115 @@ fvRsSecInherited: relation_resource_name: "contract_master" properties: name: "epg_3" + +fvAEPg: + default_values: + shutdown: "no" + type_overwrites: + fwdCtrl: "string" + overwrites: + pref_gr_memb: "preferred_group_member" + pc_enf_pref: "intra_epg_isolation" + shutdown: "admin_state" + fwd_ctrl: "forwarding_control" + has_mcast_source: "has_multicast_source" + is_attr_based_e_pg: "useg_epg" + test_values: + default: + forwarding_control: "none" + all: + forwarding_control: "proxy-arp" + exclude_targets: + - "fvESg" + parents: + - class_name: "fvAp" + parent_dependency: "fvTenant" + +fvRsAEPgMonPol: + documentation: + tnMonEPGPolName: "The name of the monitoring policy." + +fvRsFcPathAtt: + parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + target_classes: + - "fabricNode" + targets: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + relation_resource_name: "fibre_channel_path" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + relation_resource_name: "fibre_channel_path" + static: true + +fvRsNodeAtt: + parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + target_classes: + - "fabricNode" + targets: + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-101" + relation_resource_name: "static_leaf" + static: true + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-102" + relation_resource_name: "static_leaf" + static: true + +fvRsDomAtt: + ignores: + - "apiMode" + parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + target_classes: + - "vmmDomP" + targets: + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_1" + relation_resource_name: "domain" + static: true + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_2" + relation_resource_name: "domain" + static: true + +fvRsPathAtt: + parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + target_classes: + - "fabricPathEp" + targets: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + relation_resource_name: "static_path" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + relation_resource_name: "static_path" + static: true + +qosCustomPol: + parents: + - class_name: "fvTenant" + parent_dn: "aci_tenant.test.id" + +fhsTrustCtrlPol: + parents: + - class_name: "fvTenant" + parent_dn: "aci_tenant.test.id" + +qosDppPol: + parents: + - class_name: "fvTenant" + parent_dn: "aci_tenant.test.id" \ No newline at end of file diff --git a/gen/generator.go b/gen/generator.go index 985a8ff95..342b29e36 100644 --- a/gen/generator.go +++ b/gen/generator.go @@ -868,6 +868,7 @@ type TestDependency struct { TargetDnRef string TargetResourceName string RelationResourceName string + Static bool Properties map[string]string } @@ -1299,7 +1300,7 @@ func (m *Model) SetClassProperties(classDetails interface{}) { ResourceClassName: strings.ToUpper(m.PkgName[:1]) + m.PkgName[1:], PkgName: m.PkgName, IdentifiedBy: m.IdentifiedBy, - ValueType: propertyValue.(map[string]interface{})["uitype"].(string), + ValueType: getOverwritePropertyType(propertyName, m.PkgName, propertyValue.(map[string]interface{})["uitype"].(string), m.Definitions), Label: propertyValue.(map[string]interface{})["label"].(string), IsNaming: propertyValue.(map[string]interface{})["isNaming"].(bool), CreateOnly: propertyValue.(map[string]interface{})["createOnly"].(bool), @@ -1492,6 +1493,7 @@ func (m *Model) SetLegacyAttributes(definitions Definitions) { blockTypes := legacyResource.(map[string]interface{})["block"].(map[string]interface{})["block_types"].(map[string]interface{}) for blockName, blockDetails := range blockTypes { + block := LegacyBlock{ Name: blockName, NestingMode: blockDetails.(map[string]interface{})["nesting_mode"].(string), @@ -1504,17 +1506,20 @@ func (m *Model) SetLegacyAttributes(definitions Definitions) { if legacyAttribute.AttributeName == "target_dn" { legacyAttribute.Name = "TargetDn" + } else if strings.HasSuffix(legacyAttribute.AttributeName, "_dn") { + legacyAttribute.Name = "TDn" } childClass := m.Children[block.ClassName] for _, property := range childClass.Properties { - if legacyAttribute.AttributeName == property.SnakeCaseName { + if GetOverwriteAttributeName(m.PkgName, legacyAttribute.AttributeName, definitions) == GetOverwriteAttributeName(m.PkgName, property.SnakeCaseName, definitions) { legacyAttribute.Name = property.Name break } } block.Attributes[propertyName] = legacyAttribute } + m.LegacyBlocks = append(m.LegacyBlocks, block) } @@ -1629,6 +1634,24 @@ func getOverwritePropertyComment(propertyName, classPkgName string, definitions return "" } +func getOverwritePropertyType(propertyName, classPkgName, uiType string, definitions Definitions) string { + precedenceList := []string{classPkgName, "global"} + for _, precedence := range precedenceList { + if classDetails, ok := definitions.Properties[precedence]; ok { + for key, value := range classDetails.(map[interface{}]interface{}) { + if key.(string) == "type_overwrites" { + for k, v := range value.(map[interface{}]interface{}) { + if k.(string) == propertyName { + return v.(string) + } + } + } + } + } + } + return uiType +} + /* Determine if a property should be ignored as defined in the properties.yaml file Precendence order is: @@ -1869,7 +1892,7 @@ func (m *Model) SetModelTestDependencies(classModels map[string]Model, definitio if key.(string) == "targets" { for index, v := range value.([]interface{}) { targetMap := v.(map[interface{}]interface{}) - if className, ok := targetMap["class_name"]; ok && className.(string) == m.PkgName { + if className, ok := targetMap["class_name"]; ok && !slices.Contains(m.getExcludeTargets(), className.(string)) { childTestDependencies = append(childTestDependencies, getTestDependency(className.(string), targetMap, definitions, index)) } } @@ -1883,6 +1906,20 @@ func (m *Model) SetModelTestDependencies(classModels map[string]Model, definitio } +func (m *Model) getExcludeTargets() []string { + excludeTargets := []string{} + if v, ok := m.Definitions.Properties[m.PkgName]; ok { + for key, value := range v.(map[interface{}]interface{}) { + if key.(string) == "exclude_targets" { + for _, v := range value.([]interface{}) { + excludeTargets = append(excludeTargets, v.(string)) + } + } + } + } + return excludeTargets +} + func getTestDependency(className string, targetMap map[interface{}]interface{}, definitions Definitions, index int) TestDependency { testDependency := TestDependency{} @@ -1916,6 +1953,11 @@ func getTestDependency(className string, targetMap map[interface{}]interface{}, testDependency.ParentDnKey = overwriteKey.(string) } + testDependency.Static = false + if static, ok := targetMap["static"]; ok { + testDependency.Static = static.(bool) + } + return testDependency } @@ -1927,6 +1969,7 @@ func GetTestTargetDn(targets []interface{}, resourceName, targetDnValue string, if targetClasses != nil { // CHANGE logic here when allowing for multiple target classes in single resource targetClass := targetClasses.([]interface{})[0].(string) + for _, target := range targets { if targetClass == target.(map[interface{}]interface{})["class_name"].(string) { filteredTargets = append(filteredTargets, target) @@ -1937,18 +1980,26 @@ func GetTestTargetDn(targets []interface{}, resourceName, targetDnValue string, } for _, target := range filteredTargets { + targetRelationResourceName := target.(map[interface{}]interface{})["relation_resource_name"].(string) + + static := false + if v, ok := target.(map[interface{}]interface{})["static"]; ok { + static = v.(bool) + } + if targetResourceName == targetRelationResourceName || strings.TrimSuffix(targetResourceName, "s") == targetRelationResourceName { if index > 0 { index = index - 1 } else { - if reference { + if reference && !static { return target.(map[interface{}]interface{})["target_dn_ref"].(string) } return target.(map[interface{}]interface{})["target_dn"].(string) } } } + return targetDnValue } diff --git a/gen/meta/fhsTrustCtrlPol.json b/gen/meta/fhsTrustCtrlPol.json new file mode 100644 index 000000000..de1c939f1 --- /dev/null +++ b/gen/meta/fhsTrustCtrlPol.json @@ -0,0 +1,1131 @@ +{ + "fhs:TrustCtrlPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Delegate": "", + "fhs:RtTrustCtrl": "", + "tag:Annotation": "", + "tag:Tag": "" + }, + "rnMap": { + "annotationKey-": "tag:Annotation", + "fd-": "fault:Delegate", + "rbacDom-": "aaa:RbacAnnotation", + "rtfvTrustCtrl-": "fhs:RtTrustCtrl", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "trustctrlpol-{name}", + "containedBy": { + "fv:Tenant": "" + }, + "superClasses": [ + "fhs:ATrustCtrlPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "fhs:RtTrustCtrl": "fv:AEPg" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/tn-{name}/trustctrlpol-{name}" + ], + "writeAccess": [ + "admin" + ], + "readAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile" + ], + "faults": { + + }, + "events": { + "E4213786": "creation||fhs:TrustCtrlPol", + "E4213787": "modification||fhs:TrustCtrlPol", + "E4213788": "deletion||fhs:TrustCtrlPol" + }, + "stats": { + + }, + "versions": "3.0(1k)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": false, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": false, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "9281", + "className": "TrustCtrlPol", + "classPkg": "fhs", + "featureTag": "", + "moCategory": "Regular", + "label": "Trust Control Policy", + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38559", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40698", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "hasDhcpv4Server": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27517", + "propLocalId": "6427", + "label": "Contains DHCPv4 servers", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "hasDhcpv6Server": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27518", + "propLocalId": "6428", + "label": "Contains DHCPv6 servers", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "hasIpv6Router": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27519", + "propLocalId": "6429", + "label": "Contains IPv6 routers", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "3.0(1k)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "27558", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustArp": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27515", + "propLocalId": "6425", + "label": "Trust ARP", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustDhcpv4": { + "versions": "3.0(1k)-", + "isConfigurable": false, + "propGlobalId": "27512", + "propLocalId": "6422", + "label": "Trust DHCPv4", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "no", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustDhcpv6": { + "versions": "3.0(1k)-", + "isConfigurable": false, + "propGlobalId": "27513", + "propLocalId": "6423", + "label": "Trust DHCPv6", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "no", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustIpv4Src": { + "versions": "3.0(1k)-", + "isConfigurable": false, + "propGlobalId": "27510", + "propLocalId": "6420", + "label": "Trust IPv6 source", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "no", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustIpv6Src": { + "versions": "3.0(1k)-", + "isConfigurable": false, + "propGlobalId": "27511", + "propLocalId": "6421", + "label": "Trust IPv6 source", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "no", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustNd": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27516", + "propLocalId": "6426", + "label": "Trust ND", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "trustRa": { + "versions": "3.0(1k)-", + "isConfigurable": true, + "propGlobalId": "27514", + "propLocalId": "6424", + "label": "Trust router advertisement", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/fvRsDomAtt.json b/gen/meta/fvRsDomAtt.json new file mode 100644 index 000000000..ca32f42e7 --- /dev/null +++ b/gen/meta/fvRsDomAtt.json @@ -0,0 +1,2342 @@ +{ + "fv:RsDomAtt": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Counts": "", + "fault:Inst": "", + "fv:AEPgAddrMgmtPoolAtt": "", + "fv:AEPgLagPolAtt": "", + "fv:UplinkOrderCont": "", + "health:Inst": "", + "tag:AliasDelInst": "", + "tag:AliasInst": "", + "tag:Annotation": "", + "tag:ExtMngdInst": "", + "tag:Inst": "", + "tag:Tag": "", + "vmm:SecP": "" + }, + "rnMap": { + "alias": "tag:AliasInst", + "aliasdel-": "tag:AliasDelInst", + "annotationKey-": "tag:Annotation", + "epgipampoolatt": "fv:AEPgAddrMgmtPoolAtt", + "epglagpolatt": "fv:AEPgLagPolAtt", + "extmngd": "tag:ExtMngdInst", + "fault-": "fault:Inst", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "rbacDom-": "aaa:RbacAnnotation", + "sec": "vmm:SecP", + "tag-": "tag:Inst", + "tagKey-": "tag:Tag", + "uplinkorder": "fv:UplinkOrderCont" + }, + "identifiedBy": [ + "tDn" + ], + "rnFormat": "rsdomAtt-[{tDn}]", + "containedBy": { + "fv:AEPg": "" + }, + "superClasses": [ + "reln:To", + "reln:Inst" + ], + "subClasses": { + + }, + "relationInfo": { + "type": "explicit", + "cardinality": "n-to-m", + "fromMo": "fv:AEPg", + "fromRelMo": "fv:RsDomAtt", + "toMo": "infra:DomP", + "toRelMo": "infra:RtDomAtt", + "enforceable": true, + "resolvable": true + }, + "dnFormats": [ + "uni/tn-{name}/ap-{name}/epg-{name}/rsdomAtt-[{tDn}]" + ], + "writeAccess": [ + "admin", + "tenant-epg", + "tenant-network-profile", + "vmm-policy" + ], + "readAccess": [ + "admin", + "ops", + "tenant-epg", + "tenant-network-profile", + "vmm-policy" + ], + "faults": { + "F2531": "fltFvRsDomAttInvalidConfigOnRsDomAtt", + "F0956": "fltFvRsDomAttResolveFail" + }, + "events": { + "E4212008": "creation||fv:RsDomAtt", + "E4212009": "modification||fv:RsDomAtt", + "E4212010": "deletion||fv:RsDomAtt" + }, + "stats": { + + }, + "versions": "1.0(1e)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": false, + "isStat": false, + "isFaultable": true, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "regular", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + "apic" + ], + "classId": "1986", + "className": "RsDomAtt", + "classPkg": "fv", + "featureTag": "", + "moCategory": "RelationshipToLocal", + "label": "Domain", + "comment": [ + "An EPG can be linked to a domain profile via the Associated Domain Profiles. The domain profiles attached can be VMM, Physical, L2 External, or L3 External Domains." + ], + "properties": { + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "37661", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "apiMode": { + "versions": "6.0(3d)-", + "isConfigurable": true, + "propGlobalId": "69172", + "propLocalId": "15059", + "label": "apiMode", + "baseType": "scalar:Enum8", + "modelType": "fv:apiModes", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "mgmt", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "mgmt", + "platformFlavors": [ + + ], + "label": "Management API mode "}, + { "value": "255", "localName": "not-applicable", + "platformFlavors": [ + + ], + "label": "N/A "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy API mode "} + ], + "default": "mgmt", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "bindingType": { + "versions": "4.0(1h)-", + "comment": [ + "Binding type for ports" + ], + "isConfigurable": true, + "propGlobalId": "44516", + "propLocalId": "9792", + "label": "bindingType", + "baseType": "scalar:Enum8", + "modelType": "fv:BindingType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "dynamicBinding", + "platformFlavors": [ + + ], + "label": "Dynamic Binding "}, + { "value": "3", "localName": "ephemeral", + "platformFlavors": [ + + ], + "label": "Ephemeral "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "label": "Default "}, + { "value": "1", "localName": "staticBinding", + "platformFlavors": [ + + ], + "label": "Static Binding "} + ], + "default": "none", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "classPref": { + "versions": "1.2(2g)-", + "isConfigurable": true, + "propGlobalId": "23486", + "propLocalId": "5776", + "label": "classPref", + "baseType": "scalar:Enum8", + "modelType": "fv:ClassPref", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "encap", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "encap", + "platformFlavors": [ + + ], + "label": "Packet Encapsulation "}, + { "value": "1", "localName": "useg", + "platformFlavors": [ + + ], + "label": "uSeg "} + ], + "default": "encap", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "configIssues": { + "versions": "2.0(2f)-", + "comment": [ + "Bitmask representation of the configuration issues found during the endpoint group deployment." + ], + "isConfigurable": false, + "propGlobalId": "27720", + "propLocalId": "153", + "label": "configIssues", + "baseType": "scalar:Bitmask64", + "modelType": "fv:ConfigIssues", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2048", "localName": "allow-useg-inconsistent", + "platformFlavors": [ + + ], + "comment": [ + "allow useg Validations" + ], + "label": "allow-useg flag inconsistent across vmm domain (DVS) attaches "}, + { "value": "256", "localName": "bd-id-not-allocated", + "platformFlavors": [ + + ], + "label": "BD IDs Not Allocated "}, + { "value": "1", "localName": "bd-not-present", + "platformFlavors": [ + + ], + "comment": [ + "BD Validations" + ], + "label": "BD Not present "}, + { "value": "512", "localName": "context-id-not-allocated", + "platformFlavors": [ + + ], + "label": "Context IDs Not Allocated "}, + { "value": "2", "localName": "context-not-present", + "platformFlavors": [ + + ], + "comment": [ + "Context Validations" + ], + "label": "Context Not present. Configure Context and/or attach Context to Bridge-group domain for application EPG or attach Context to ESG for security group. "}, + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "8", "localName": "encap-assignment", + "platformFlavors": [ + + ], + "label": "Encapsulation Not Valid "}, + { "value": "0x4000", "localName": "esg-association-contract-inheritance-present", + "platformFlavors": [ + + ], + "comment": [ + "EPgSelector Contract Inheritance Validations" + ], + "label": "Security features (contract inheritance) present on the EPG mapped to an ESG via an EPG Selector (fvEPgSelector). Once appropriate contract configuration is done on the ESG, delete any contract association on this EPG. "}, + { "value": "0x2000", "localName": "esg-association-contract-present", + "platformFlavors": [ + + ], + "comment": [ + "EPgSelector Contract Validations" + ], + "label": "Security features (contract association) present on the EPG mapped to an ESG via an EPG Selector (fvEPgSelector). Once appropriate contract configuration is done on the ESG, delete any contract association on this EPG. "}, + { "value": "0x8000", "localName": "esg-association-contract-taboo-present", + "platformFlavors": [ + + ], + "comment": [ + "EPgSelector Taboo Contract Validations" + ], + "label": "Security features (Taboo contract) present on the EPG mapped to an ESG via an EPG Selector (fvEPgSelector). Once appropriate contract configuration is done on the ESG, delete any contract association on this EPG. "}, + { "value": "0x10000", "localName": "esg-tag-selector-match-obj-not-associated", + "platformFlavors": [ + + ], + "comment": [ + "ESG TagSelector Duplicate Detected" + ], + "label": "a Tag Selector is matching an object, but the object is not associated to this ESG since it is matching multiple ESG Tag Selectors at the same time. Check under ESG - > Operational -> Tag Selectors tab for further information "}, + { "value": "4", "localName": "id-not-allocated", + "platformFlavors": [ + + ], + "label": "IDs Not Allocated "}, + { "value": "1024", "localName": "instrimedcy-unsupported", + "platformFlavors": [ + + ], + "comment": [ + "Deployment Immediacy Validation" + ], + "label": "On-Demand deployment immediacy is not supported for uSeg EPG associated to VMware DVS domain "}, + { "value": "32", "localName": "invalid-rel-to-rtctrlProfile", + "platformFlavors": [ + + ], + "label": "Invalid Association to Route Control Policy "}, + { "value": "128", "localName": "l3port-and-sub-interface-on-path", + "platformFlavors": [ + + ], + "label": "L3 Port and Sub-Interface Not Allowed on Same Path "}, + { "value": "4096", "localName": "no-conslbl-association", + "platformFlavors": [ + + ], + "comment": [ + "MPLS InstP Validations" + ], + "label": "No consumer label association for the MPLS external EPG "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "label": "none "}, + { "value": "64", "localName": "not-associated-with-mgmt-zone", + "platformFlavors": [ + + ], + "label": "Not Associated With Management Zone "} + ], + "default": "none", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "customEpgName": { + "versions": "4.2(3j)-", + "comment": [ + "User-configured port-group display name" + ], + "isConfigurable": true, + "propGlobalId": "56471", + "propLocalId": "12800", + "label": "customEpgName", + "baseType": "string:Basic", + "modelType": "fv:EpgName", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 80 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "delimiter": { + "versions": "2.0(1m)-", + "isConfigurable": true, + "propGlobalId": "26231", + "propLocalId": "6220", + "label": "delimiter", + "baseType": "string:Basic", + "modelType": "vmm:DelimiterType", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": true, + "readWrite": false, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1, + "regexs": [ + {"regex" : "^[^a-zA-Z0-9;>\"-*`,-.;\\[\\]/\\\\{}:?\\s&<]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "encap": { + "versions": "1.1(1j)-", + "comment": [ + "The port encapsulation." + ], + "isConfigurable": true, + "propGlobalId": "20385", + "propLocalId": "143", + "label": "encap", + "baseType": "base:Encap", + "modelType": "base:Encap", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "encapMode": { + "versions": "2.1(1h)-", + "isConfigurable": true, + "propGlobalId": "27724", + "propLocalId": "5390", + "label": "encapMode", + "baseType": "scalar:Enum8", + "modelType": "fv:EncapMode", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "0", "localName": "auto", + "platformFlavors": [ + + ], + "label": "Auto "}, + { "value": "auto", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "vlan", + "platformFlavors": [ + + ], + "label": "VLAN "}, + { "value": "2", "localName": "vxlan", + "platformFlavors": [ + + ], + "label": "VXLAN "} + ], + "default": "auto", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "epgCos": { + "versions": "3.0(1k)-", + "comment": [ + "Represents Epg Cos for AVS" + ], + "isConfigurable": true, + "propGlobalId": "33158", + "propLocalId": "7914", + "label": "epgCos", + "baseType": "scalar:Enum8", + "modelType": "fv:EpgCos", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "0", "localName": "Cos0", + "platformFlavors": [ + + ], + "label": "Cos0 "}, + { "value": "1", "localName": "Cos1", + "platformFlavors": [ + + ], + "label": "Cos1 "}, + { "value": "2", "localName": "Cos2", + "platformFlavors": [ + + ], + "label": "Cos2 "}, + { "value": "3", "localName": "Cos3", + "platformFlavors": [ + + ], + "label": "Cos3 "}, + { "value": "4", "localName": "Cos4", + "platformFlavors": [ + + ], + "label": "Cos4 "}, + { "value": "5", "localName": "Cos5", + "platformFlavors": [ + + ], + "label": "Cos5 "}, + { "value": "6", "localName": "Cos6", + "platformFlavors": [ + + ], + "label": "Cos6 "}, + { "value": "7", "localName": "Cos7", + "platformFlavors": [ + + ], + "label": "Cos7 "}, + { "value": "Cos0", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "Cos0", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "epgCosPref": { + "versions": "3.0(1k)-", + "comment": [ + "Represents parameter used to\n enable/disable Epg Cos Policy" + ], + "isConfigurable": true, + "propGlobalId": "33188", + "propLocalId": "7930", + "label": "epgCosPref", + "baseType": "scalar:Enum8", + "modelType": "fv:EpgCosPref", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "disabled "}, + { "value": "2", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "39800", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "forceResolve": { + "versions": "1.0(1e)-", + "comment": [ + "Whether the relation should force pull the target." + ], + "isConfigurable": false, + "propGlobalId": "107", + "propLocalId": "83", + "label": "Force Resolve", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "true", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "yes", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "instrImedcy": { + "versions": "1.0(1e)-", + "comment": [ + "Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM." + ], + "isConfigurable": true, + "propGlobalId": "12327", + "propLocalId": "881", + "label": "instrImedcy", + "baseType": "scalar:Enum8", + "modelType": "fv:InstrImedcy", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "lazy", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "immediate", + "platformFlavors": [ + + ], + "label": "Immediate "}, + { "value": "2", "localName": "lazy", + "platformFlavors": [ + + ], + "label": "On Demand "} + ], + "default": "lazy", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ipamDhcpOverride": { + "versions": "6.0(3d)-", + "isConfigurable": true, + "propGlobalId": "69801", + "propLocalId": "15328", + "label": "ipamDhcpOverride", + "baseType": "address:Ip", + "modelType": "address:Ip", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validateAsIPv4OrIPv6": true, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ipamEnabled": { + "versions": "6.0(3d)-", + "isConfigurable": true, + "propGlobalId": "69802", + "propLocalId": "15326", + "label": "ipamEnabled", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ipamGateway": { + "versions": "6.0(3d)-", + "isConfigurable": true, + "propGlobalId": "69803", + "propLocalId": "15327", + "label": "ipamGateway", + "baseType": "address:Ip", + "modelType": "address:Ip", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validateAsIPv4OrIPv6": true, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lagPolicyName": { + "versions": "3.2(10e)-3.2(10g),3.2(7f)-", + "comment": [ + "LAG Policy Name" + ], + "isConfigurable": true, + "propGlobalId": "44366", + "propLocalId": "9764", + "label": "lagPolicyName", + "baseType": "string:Basic", + "modelType": "string:Basic", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 512 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "mode": { + "versions": "1.3(1g)-", + "comment": [ + "Represents the mode of vmm domain" + ], + "isConfigurable": false, + "propGlobalId": "26214", + "propLocalId": "14", + "label": "mode", + "baseType": "scalar:Enum8", + "modelType": "vmm:Mode", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "6", "localName": "cf", + "platformFlavors": [ + + ], + "label": "Cloud Foundry "}, + { "value": "0", "localName": "default", + "platformFlavors": [ + + ], + "label": "Distributed Switch "}, + { "value": "default", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "k8s", + "platformFlavors": [ + + ], + "label": "Kubernetes "}, + { "value": "1", "localName": "n1kv", + "platformFlavors": [ + + ], + "label": "Cisco AVS "}, + { "value": "8", "localName": "nsx", + "platformFlavors": [ + + ], + "label": "NSX "}, + { "value": "11", "localName": "nutanix_pc", + "platformFlavors": [ + + ], + "label": "Nutanix Prism Central "}, + { "value": "10", "localName": "nutanix_pe", + "platformFlavors": [ + + ], + "label": "Nutanix Prism Element "}, + { "value": "7", "localName": "openshift", + "platformFlavors": [ + + ], + "label": "OpenShift "}, + { "value": "3", "localName": "ovs", + "platformFlavors": [ + + ], + "label": "Open vSwitch "}, + { "value": "9", "localName": "rancher", + "platformFlavors": [ + + ], + "label": "Rancher RKE "}, + { "value": "5", "localName": "rhev", + "platformFlavors": [ + + ], + "label": "RHEV "}, + { "value": "2", "localName": "unknown", + "platformFlavors": [ + + ], + "label": "Unknown "} + ], + "default": "default", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "monPolDn": { + "versions": "1.0(1e)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "14288", + "propLocalId": "228", + "label": "Monitoring Policy", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "netflowDir": { + "versions": "3.0(1k)-", + "comment": [ + "Represents NetFlow monitoring direction" + ], + "isConfigurable": true, + "propGlobalId": "31105", + "propLocalId": "7824", + "label": "netflowDir", + "baseType": "scalar:Enum8", + "modelType": "fv:NetflowDir", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "3", "localName": "both", + "platformFlavors": [ + + ], + "label": "both "}, + { "value": "both", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "egress", + "platformFlavors": [ + + ], + "label": "egress "}, + { "value": "1", "localName": "ingress", + "platformFlavors": [ + + ], + "label": "ingress "} + ], + "default": "both", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "netflowPref": { + "versions": "2.2(1k)-", + "comment": [ + "Represents parameter used to\n enable/disable Netflow Policy" + ], + "isConfigurable": true, + "propGlobalId": "27589", + "propLocalId": "6416", + "label": "netflowPref", + "baseType": "scalar:Enum8", + "modelType": "fv:NetflowPref", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "disabled "}, + { "value": "2", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "numPorts": { + "versions": "4.0(1h)-", + "comment": [ + "Number of ports for binding type" + ], + "isConfigurable": true, + "propGlobalId": "44517", + "propLocalId": "2063", + "label": "numPorts", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "portAllocation": { + "versions": "4.0(1h)-", + "comment": [ + "Port allocation for ports" + ], + "isConfigurable": true, + "propGlobalId": "44518", + "propLocalId": "9793", + "label": "portAllocation", + "baseType": "scalar:Enum8", + "modelType": "fv:PortAllocation", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "elastic", + "platformFlavors": [ + + ], + "label": "Elastic "}, + { "value": "1", "localName": "fixed", + "platformFlavors": [ + + ], + "label": "Fixed "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "label": "Default "} + ], + "default": "none", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "primaryEncap": { + "versions": "1.2(2g)-", + "comment": [ + "Represents the primary encap when the EPG is isolated" + ], + "isConfigurable": true, + "propGlobalId": "23487", + "propLocalId": "5727", + "label": "primaryEncap", + "baseType": "base:Encap", + "modelType": "base:Encap", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "primaryEncapInner": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "34693", + "propLocalId": "8178", + "label": "primaryEncapInner", + "baseType": "base:Encap", + "modelType": "base:Encap", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rType": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the type of resolver." + ], + "isConfigurable": false, + "propGlobalId": "106", + "propLocalId": "82", + "label": "Resolver Type", + "baseType": "scalar:Enum8", + "modelType": "reln:ResolverType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "mo", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "2", "localName": "service", + "platformFlavors": [ + + ], + "label": "Service "} + ], + "default": "mo", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "resImedcy": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies if policies are to be resolved immmediately or when needed." + ], + "isConfigurable": true, + "propGlobalId": "12328", + "propLocalId": "527", + "label": "resImedcy", + "baseType": "scalar:Enum8", + "modelType": "fv:ResImedcy", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "lazy", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "immediate", + "platformFlavors": [ + + ], + "label": "Immediate "}, + { "value": "2", "localName": "lazy", + "platformFlavors": [ + + ], + "label": "On Demand "}, + { "value": "3", "localName": "pre-provision", + "platformFlavors": [ + + ], + "label": "Pre-Provision "} + ], + "default": "lazy", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "secondaryEncapInner": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "34694", + "propLocalId": "8179", + "label": "secondaryEncapInner", + "baseType": "base:Encap", + "modelType": "base:Encap", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "state": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "103", + "propLocalId": "26", + "label": "State", + "baseType": "scalar:Enum8", + "modelType": "reln:State", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "5", "localName": "cardinality-violation", + "platformFlavors": [ + + ], + "comment": [ + "cardinality violation - When relations are created such that\n they violate the cardinality, state of the relation would be\n set to this." + ], + "label": "Cardinality Violation "}, + { "value": "unformed", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "formed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is formed with the target object" + ], + "label": "Formed "}, + { "value": "4", "localName": "invalid-target", + "platformFlavors": [ + + ], + "comment": [ + "invalid target DN" + ], + "label": "Invalid Target "}, + { "value": "2", "localName": "missing-target", + "platformFlavors": [ + + ], + "comment": [ + "target does not exist" + ], + "label": "Missing Target "}, + { "value": "0", "localName": "unformed", + "platformFlavors": [ + + ], + "comment": [ + "the relationship is not formed" + ], + "label": "Unformed "} + ], + "default": "unformed", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "stateQual": { + "versions": "1.0(1e)-", + "comment": [ + "Represents the state qualifier of the relationship." + ], + "isConfigurable": false, + "propGlobalId": "104", + "propLocalId": "80", + "label": "State Qualifier", + "baseType": "scalar:Enum8", + "modelType": "reln:StateQual", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "default-target", + "platformFlavors": [ + + ], + "comment": [ + "target not specified, using default" + ], + "label": "Target Not Specified "}, + { "value": "none", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mismatch-target", + "platformFlavors": [ + + ], + "comment": [ + "target not found, using default" + ], + "label": "Target Not Found "}, + { "value": "0", "localName": "none", + "platformFlavors": [ + + ], + "comment": [ + "no issue" + ], + "label": "None "} + ], + "default": "none", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "switchingMode": { + "versions": "3.1(1i)-", + "isConfigurable": true, + "propGlobalId": "35613", + "propLocalId": "8294", + "label": "switchingMode", + "baseType": "scalar:Enum8", + "modelType": "fv:SwitchingModeT", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "1", "localName": "AVE", + "platformFlavors": [ + + ], + "label": "AVE "}, + { "value": "native", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "native", + "platformFlavors": [ + + ], + "label": "native "} + ], + "default": "native", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tCl": { + "versions": "1.0(1e)-", + "comment": [ + "" + ], + "isConfigurable": false, + "propGlobalId": "12326", + "propLocalId": "78", + "label": "Target Class", + "baseType": "scalar:Enum16", + "modelType": "reln:ClassId", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validValues": [ + { "value": "4517", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "12672", "localName": "extdevGroupP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "8727", "localName": "fcDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4517", "localName": "infraDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1745", "localName": "l2extDomDef", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1744", "localName": "l2extDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1780", "localName": "l3extDomDef", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1779", "localName": "l3extDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1809", "localName": "physDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "unspecified "}, + { "value": "2136", "localName": "vmmDomP", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2147", "localName": "vmmDomPDef", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "infraDomP", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tDn": { + "versions": "1.0(1e)-", + "comment": [ + "The name of the Physical Domain Profile." + ], + "isConfigurable": true, + "propGlobalId": "12325", + "propLocalId": "77", + "label": "Target-dn", + "baseType": "reference:BinRef", + "modelType": "reln:Dn", + "needsPropDelimiters": true, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "tType": { + "versions": "1.0(1e)-", + "comment": [ + "The type of target." + ], + "isConfigurable": false, + "propGlobalId": "105", + "propLocalId": "81", + "label": "Target Type", + "baseType": "scalar:Enum8", + "modelType": "reln:TargetType", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "all", + "platformFlavors": [ + + ], + "label": "All "}, + { "value": "mo", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "mo", + "platformFlavors": [ + + ], + "label": "MO "}, + { "value": "0", "localName": "name", + "platformFlavors": [ + + ], + "label": "Name "} + ], + "default": "mo", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "triggerSt": { + "versions": "1.0(1e)-", + "comment": [ + "" + ], + "isConfigurable": false, + "propGlobalId": "12329", + "propLocalId": "898", + "label": "triggerSt", + "baseType": "scalar:Enum8", + "modelType": "fv:TriggerSt", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "not_triggerable", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "not_triggerable", + "platformFlavors": [ + + ], + "label": "not_triggerable "}, + { "value": "1", "localName": "triggerable", + "platformFlavors": [ + + ], + "label": "triggerable "} + ], + "default": "not_triggerable", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "txId": { + "versions": "1.3(1g)-", + "comment": [ + "The identifier of the transaction in which the user action occurred." + ], + "isConfigurable": false, + "propGlobalId": "26233", + "propLocalId": "64", + "label": "txId", + "baseType": "scalar:Uint64", + "modelType": "scalar:Uint64", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "untagged": { + "versions": "3.2(10e)-3.2(10g),3.2(7f)-3.2(9h),4.2(1i)-", + "isConfigurable": true, + "propGlobalId": "54983", + "propLocalId": "12489", + "label": "untagged", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "vnetOnly": { + "versions": "4.2(6d)-4.2(7w),5.1(2e)-", + "isConfigurable": true, + "propGlobalId": "62493", + "propLocalId": "13649", + "label": "vnetOnly", + "baseType": "scalar:Bool", + "modelType": "scalar:Bool", + "needsPropDelimiters": false, + "uitype": "boolean", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "false", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "false", "localName": "no", + "platformFlavors": [ + + ], + "label": "No "}, + { "value": "true", "localName": "yes", + "platformFlavors": [ + + ], + "label": "Yes "} + ], + "default": "false", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/meta/qosDppPol.json b/gen/meta/qosDppPol.json new file mode 100644 index 000000000..d9601c3ae --- /dev/null +++ b/gen/meta/qosDppPol.json @@ -0,0 +1,1816 @@ +{ + "qos:DppPol": { + "contains": { + "aaa:RbacAnnotation": "", + "fault:Counts": "", + "fault:Delegate": "", + "health:Inst": "", + "qos:RtDppPol": "", + "qos:RtEgressDppPol": "", + "qos:RtEgressQosDppPol": "", + "qos:RtIngressDppPol": "", + "qos:RtIngressQosDppPol": "", + "qos:RtQosDppIfPol": "", + "qos:RtQosEgressDppIfPol": "", + "qos:RtQosEgressDppIfPolCons": "", + "qos:RtQosIngressDppIfPol": "", + "qos:RtQosIngressDppIfPolCons": "", + "tag:AliasDelInst": "", + "tag:AliasInst": "", + "tag:Annotation": "", + "tag:ExtMngdInst": "", + "tag:Inst": "", + "tag:Tag": "" + }, + "rnMap": { + "alias": "tag:AliasInst", + "aliasdel-": "tag:AliasDelInst", + "annotationKey-": "tag:Annotation", + "extmngd": "tag:ExtMngdInst", + "fd-": "fault:Delegate", + "fltCnts": "fault:Counts", + "health": "health:Inst", + "rbacDom-": "aaa:RbacAnnotation", + "rtegressDppPol-": "qos:RtEgressDppPol", + "rtfvDppPol-": "qos:RtDppPol", + "rtinfraQosDppIfPol-": "qos:RtQosDppIfPol", + "rtinfraQosEgressDppIfPol-": "qos:RtQosEgressDppIfPol", + "rtinfraQosIngressDppIfPol-": "qos:RtQosIngressDppIfPol", + "rtingressDppPol-": "qos:RtIngressDppPol", + "rtl1QosEgressDppIfPolCons-": "qos:RtQosEgressDppIfPolCons", + "rtl1QosIngressDppIfPolCons-": "qos:RtQosIngressDppIfPolCons", + "rtl3extEgressQosDppPol-": "qos:RtEgressQosDppPol", + "rtl3extIngressQosDppPol-": "qos:RtIngressQosDppPol", + "tag-": "tag:Inst", + "tagKey-": "tag:Tag" + }, + "identifiedBy": [ + "name" + ], + "rnFormat": "qosdpppol-{name}", + "containedBy": { + "fv:Tenant": "", + "infra:Infra": "" + }, + "superClasses": [ + "qos:ADppPol", + "fabric:L2IfPol", + "fabric:ProtoIfPol", + "fabric:ProtoPol", + "pol:Def", + "pol:Obj", + "naming:NamedObject" + ], + "subClasses": { + + }, + "relationFrom": { + "qos:RtDppPol": "fv:AEPg", + "qos:RtEgressDppPol": "qos:Requirement", + "qos:RtEgressQosDppPol": "l3ext:LIfP", + "qos:RtIngressDppPol": "qos:Requirement", + "qos:RtIngressQosDppPol": "l3ext:LIfP", + "qos:RtQosDppIfPol": "infra:AccGrp", + "qos:RtQosEgressDppIfPol": "infra:AccGrp", + "qos:RtQosEgressDppIfPolCons": "l1:EthIf", + "qos:RtQosIngressDppIfPol": "infra:AccGrp", + "qos:RtQosIngressDppIfPolCons": "l1:EthIf" + }, + "relationTo": { + + }, + "dnFormats": [ + "uni/infra/qosdpppol-{name}", + "uni/tn-{name}/qosdpppol-{name}" + ], + "writeAccess": [ + "admin", + "custom-port-privilege", + "tenant-qos" + ], + "readAccess": [ + "access-connectivity", + "admin", + "custom-port-privilege", + "ops", + "tenant-epg", + "tenant-ext-connectivity", + "tenant-network-profile", + "tenant-qos" + ], + "faults": { + + }, + "events": { + "E4214450": "creation||qos:DppPol", + "E4214451": "modification||qos:DppPol", + "E4214452": "deletion||qos:DppPol" + }, + "stats": { + + }, + "versions": "1.2(2g)-", + "isAbstract": false, + "isConfigurable": true, + "isContextRoot": false, + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false, + "isEncrypted": false, + "isExportable": true, + "isPersistent": true, + "isSubjectToQuota": false, + "isObservable": true, + "hasStats": false, + "isStat": false, + "isFaultable": false, + "isDomainable": false, + "isHealthScorable": true, + "shouldCollectHealthStats": false, + "healthCollectionSource": "faults", + "hasEventRules": false, + "abstractionLayer": "logical", + "apicNxProcessing": false, + "monitoringPolicySource": "Parent", + "isCreatableDeletable": "always", + "platformFlavors": [ + + ], + "classId": "7681", + "className": "DppPol", + "classPkg": "qos", + "featureTag": "", + "moCategory": "Regular", + "label": "Data Plane Policing Policy", + "comment": [ + "Define a Data Plane Policing policy. User is supposed\n to use this in scenarios where the incoming traffic need\n to be policed to certain levels" + ], + "properties": { + "adminSt": { + "versions": "1.2(2g)-", + "comment": [ + "The Administrative state of the policy" + ], + "isConfigurable": true, + "propGlobalId": "23167", + "propLocalId": "46", + "label": "adminSt", + "baseType": "scalar:Enum8", + "modelType": "qos:DppPolAdminState", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "disabled", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "disabled", + "platformFlavors": [ + + ], + "label": "disabled "}, + { "value": "0", "localName": "enabled", + "platformFlavors": [ + + ], + "label": "enabled "} + ], + "default": "disabled", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "annotation": { + "versions": "3.2(1l)-", + "comment": [ + "User annotation. Suggested format orchestrator:value" + ], + "isConfigurable": true, + "propGlobalId": "38360", + "propLocalId": "8719", + "label": "Annotation", + "baseType": "string:Basic", + "modelType": "mo:Annotation", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "be": { + "versions": "1.2(2g)-", + "comment": [ + "Excessive burst size (2R3C policer only)" + ], + "isConfigurable": true, + "propGlobalId": "22908", + "propLocalId": "5695", + "label": "Excessive Burst", + "baseType": "scalar:Uint64", + "modelType": "dpp:Burst", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:be", + "validators": [ + {"min" : 0, "max": 549755813760 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffffffffffffffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "beUnit": { + "versions": "1.2(2g)-", + "comment": [ + "Excessive Burst unit - none, Kilo, Mega, Giga, ms, us" + ], + "isConfigurable": true, + "propGlobalId": "22910", + "propLocalId": "5697", + "label": "Excessive Burst Unit", + "baseType": "scalar:Enum8", + "modelType": "dpp:BurstUnit", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:beUnit", + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "giga", + "platformFlavors": [ + + ], + "label": "Giga Bytes/Packets "}, + { "value": "1", "localName": "kilo", + "platformFlavors": [ + + ], + "label": "Kilo Bytes/Packets "}, + { "value": "2", "localName": "mega", + "platformFlavors": [ + + ], + "label": "Mega Bytes/Packets "}, + { "value": "4", "localName": "msec", + "platformFlavors": [ + + ], + "label": "Milli Seconds "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Bytes/Packets "}, + { "value": "5", "localName": "usec", + "platformFlavors": [ + + ], + "label": "Micro Seconds "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "burst": { + "versions": "1.2(2g)-", + "comment": [ + "Committed burst size, number of packets to absorb during\n a burst" + ], + "isConfigurable": true, + "propGlobalId": "22724", + "propLocalId": "986", + "label": "Burst", + "baseType": "scalar:Uint64", + "modelType": "dpp:Burst", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:burst", + "validators": [ + {"min" : 0, "max": 549755813760 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffffffffffffffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "burstUnit": { + "versions": "1.2(2g)-", + "comment": [ + "Burst unit - byte, kbyte, mbyte etc." + ], + "isConfigurable": true, + "propGlobalId": "22726", + "propLocalId": "5593", + "label": "Burst Unit", + "baseType": "scalar:Enum8", + "modelType": "dpp:BurstUnit", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:burstUnit", + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "giga", + "platformFlavors": [ + + ], + "label": "Giga Bytes/Packets "}, + { "value": "1", "localName": "kilo", + "platformFlavors": [ + + ], + "label": "Kilo Bytes/Packets "}, + { "value": "2", "localName": "mega", + "platformFlavors": [ + + ], + "label": "Mega Bytes/Packets "}, + { "value": "4", "localName": "msec", + "platformFlavors": [ + + ], + "label": "Milli Seconds "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Bytes/Packets "}, + { "value": "5", "localName": "usec", + "platformFlavors": [ + + ], + "label": "Micro Seconds "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "childAction": { + "versions": "1.0(1e)-", + "comment": [ + "Delete or ignore. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "4", + "propLocalId": "5", + "label": "childAction", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationChildAction", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "16384", "localName": "deleteAll", + "platformFlavors": [ + + ], + "label": "Delete All "}, + { "value": "8192", "localName": "deleteNonPresent", + "platformFlavors": [ + + ], + "label": "Delete Non Present "}, + { "value": "4096", "localName": "ignore", + "platformFlavors": [ + + ], + "label": "Ignore "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "conformAction": { + "versions": "1.2(2g)-", + "comment": [ + "Confirm action" + ], + "isConfigurable": true, + "propGlobalId": "22911", + "propLocalId": "5698", + "label": "Confirm Action", + "baseType": "scalar:Enum8", + "modelType": "dpp:ConformRateAction", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:conformAction", + "validValues": [ + { "value": "transmit", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "drop", + "platformFlavors": [ + + ], + "label": "Drop "}, + { "value": "3", "localName": "mark", + "platformFlavors": [ + + ], + "label": "Mark "}, + { "value": "1", "localName": "transmit", + "platformFlavors": [ + + ], + "label": "Transmit "} + ], + "default": "transmit", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "conformMarkCos": { + "versions": "1.2(2g)-", + "comment": [ + "Conform Mark cos" + ], + "isConfigurable": true, + "propGlobalId": "22917", + "propLocalId": "5704", + "label": "Conform mark cos", + "baseType": "scalar:Uint16", + "modelType": "dpp:CosMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:conformMarkCos", + "validators": [ + {"min" : 0, "max": 7 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "conformMarkDscp": { + "versions": "1.2(2g)-", + "comment": [ + "Conform Mark Dscp" + ], + "isConfigurable": true, + "propGlobalId": "22914", + "propLocalId": "5701", + "label": "Conform mark dscp", + "baseType": "scalar:Uint16", + "modelType": "dpp:DscpMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:conformMarkDscp", + "validators": [ + {"min" : 0, "max": 63 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "descr": { + "versions": "1.0(1e)-", + "comment": [ + "Specifies a description of the policy definition." + ], + "isConfigurable": true, + "propGlobalId": "5579", + "propLocalId": "28", + "label": "Description", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "naming:Described:descr", + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "dn": { + "versions": "1.0(1e)-", + "comment": [ + "A tag or metadata is a non-hierarchical keyword or term assigned to the fabric module." + ], + "isConfigurable": false, + "propGlobalId": "1", + "propLocalId": "2", + "label": "dn", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "exceedAction": { + "versions": "1.2(2g)-", + "comment": [ + "Exceed action" + ], + "isConfigurable": true, + "propGlobalId": "22912", + "propLocalId": "5699", + "label": "Exceed Action", + "baseType": "scalar:Enum8", + "modelType": "dpp:ExceedRateAction", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:exceedAction", + "validValues": [ + { "value": "drop", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "drop", + "platformFlavors": [ + + ], + "label": "Drop "}, + { "value": "3", "localName": "mark", + "platformFlavors": [ + + ], + "label": "Mark "}, + { "value": "1", "localName": "transmit", + "platformFlavors": [ + + ], + "label": "Transmit "} + ], + "default": "drop", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "exceedMarkCos": { + "versions": "1.2(2g)-", + "comment": [ + "Exceed Mark cos" + ], + "isConfigurable": true, + "propGlobalId": "22918", + "propLocalId": "5705", + "label": "Exceed mark cos", + "baseType": "scalar:Uint16", + "modelType": "dpp:CosMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:exceedMarkCos", + "validators": [ + {"min" : 0, "max": 7 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "exceedMarkDscp": { + "versions": "1.2(2g)-", + "comment": [ + "Exceed Mark Dscp" + ], + "isConfigurable": true, + "propGlobalId": "22915", + "propLocalId": "5702", + "label": "Exceed mark dscp", + "baseType": "scalar:Uint16", + "modelType": "dpp:DscpMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:exceedMarkDscp", + "validators": [ + {"min" : 0, "max": 63 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "extMngdBy": { + "versions": "3.2(1l)-", + "comment": [ + "Indicates which orchestrator is managing this MO" + ], + "isConfigurable": false, + "propGlobalId": "40499", + "propLocalId": "8023", + "label": "Managed By", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ExtMngdByType", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "undefined", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "msc", + "platformFlavors": [ + + ], + "label": "MSC "}, + { "value": "0", "localName": "undefined", + "platformFlavors": [ + + ], + "label": "Undefined "} + ], + "default": "undefined", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "lcOwn": { + "versions": "1.0(1e)-", + "comment": [ + "A value that indicates how this object was created. For internal use only." + ], + "isConfigurable": false, + "propGlobalId": "9", + "propLocalId": "9", + "label": "lcOwn", + "baseType": "scalar:Enum8", + "modelType": "mo:Owner", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "local", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "4", "localName": "implicit", + "platformFlavors": [ + + ], + "label": "Implicit "}, + { "value": "0", "localName": "local", + "platformFlavors": [ + + ], + "label": "Local "}, + { "value": "1", "localName": "policy", + "platformFlavors": [ + + ], + "label": "Policy "}, + { "value": "2", "localName": "replica", + "platformFlavors": [ + + ], + "label": "Replica "}, + { "value": "3", "localName": "resolveOnBehalf", + "platformFlavors": [ + + ], + "label": "Resolved On Behalf "} + ], + "default": "local", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "modTs": { + "versions": "1.0(1e)-", + "comment": [ + "The time when this object was last modified." + ], + "isConfigurable": false, + "propGlobalId": "7", + "propLocalId": "7", + "label": "modTs", + "baseType": "scalar:Date", + "modelType": "mo:TStamp", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "never", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0", "localName": "never", + "platformFlavors": [ + + ], + "label": "Never "} + ], + "default": "never", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "mode": { + "versions": "1.2(2g)-", + "comment": [ + "Policer mode - bytes or packet policer" + ], + "isConfigurable": true, + "propGlobalId": "22906", + "propLocalId": "14", + "label": "Bit or Packet", + "baseType": "scalar:Enum8", + "modelType": "dpp:Mode", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:mode", + "validValues": [ + { "value": "1", "localName": "bit", + "platformFlavors": [ + + ], + "label": "Bit policer "}, + { "value": "bit", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "packet", + "platformFlavors": [ + + ], + "label": "Packet Policer "} + ], + "default": "bit", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "monPolDn": { + "versions": "5.1(1h)-", + "comment": [ + "The monitoring policy attached to this observable object." + ], + "isConfigurable": false, + "propGlobalId": "26896", + "propLocalId": "228", + "label": "Monitoring Policy", + "baseType": "reference:BinRef", + "modelType": "reference:BinRef", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "name": { + "versions": "1.2(2g)-", + "comment": [ + "The name of the object." + ], + "isConfigurable": true, + "propGlobalId": "22803", + "propLocalId": "13", + "label": "Name", + "baseType": "string:Basic", + "modelType": "naming:Name", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": false, + "readOnly": false, + "isNaming": true, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": true, + "isLike": false, + "validators": [ + {"min" : 1, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "nameAlias": { + "versions": "2.2(1k)-", + "isConfigurable": true, + "propGlobalId": "28417", + "propLocalId": "6719", + "label": "Display Name", + "baseType": "string:Basic", + "modelType": "naming:NameAlias", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 63, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.-]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerKey": { + "versions": "1.0(1e)-", + "comment": [ + "The key for enabling clients to own their data for entity correlation." + ], + "isConfigurable": true, + "propGlobalId": "15230", + "propLocalId": "4100", + "label": "ownerKey", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 128, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "ownerTag": { + "versions": "1.0(1e)-", + "comment": [ + "A tag for enabling clients to add their own data. For example, to indicate who created this object." + ], + "isConfigurable": true, + "propGlobalId": "15231", + "propLocalId": "4101", + "label": "ownerTag", + "baseType": "string:Basic", + "modelType": "naming:Descr", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 64, + "regexs": [ + {"regex" : "^[a-zA-Z0-9\\\\!#$%()*,-./:;@ _{|}~?&+]+$", "type": "include"} + ] + } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "pir": { + "versions": "1.2(2g)-", + "comment": [ + "Peak rate (pir) (2R3C policer only)" + ], + "isConfigurable": true, + "propGlobalId": "22907", + "propLocalId": "5694", + "label": "Peak Rate", + "baseType": "scalar:Uint64", + "modelType": "dpp:Rate", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:pir", + "validators": [ + {"min" : 0, "max": 4398046510080 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "pirUnit": { + "versions": "1.2(2g)-", + "comment": [ + "Peak Rate unit - none, Kilo, Mega, Giga" + ], + "isConfigurable": true, + "propGlobalId": "22909", + "propLocalId": "5696", + "label": "Peak Rate Unit", + "baseType": "scalar:Enum8", + "modelType": "dpp:RateUnit", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:pirUnit", + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "giga", + "platformFlavors": [ + + ], + "label": "Giga Bits/Packets per second "}, + { "value": "1", "localName": "kilo", + "platformFlavors": [ + + ], + "label": "Kilo Bits/Packets per second "}, + { "value": "2", "localName": "mega", + "platformFlavors": [ + + ], + "label": "Mega Bits/Packets per second "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Bits/Packets per second "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rate": { + "versions": "1.2(2g)-", + "comment": [ + "Allowed rate, committed rate at which the packets\n are allowed into the system" + ], + "isConfigurable": true, + "propGlobalId": "22723", + "propLocalId": "985", + "label": "Rate", + "baseType": "scalar:Uint64", + "modelType": "dpp:Rate", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:rate", + "validators": [ + {"min" : 0, "max": 4398046510080 } + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rateUnit": { + "versions": "1.2(2g)-", + "comment": [ + "Rate unit - bps, kbps, mbps, packets etc." + ], + "isConfigurable": true, + "propGlobalId": "22725", + "propLocalId": "5592", + "label": "Rate Unit", + "baseType": "scalar:Enum8", + "modelType": "dpp:RateUnit", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:rateUnit", + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "3", "localName": "giga", + "platformFlavors": [ + + ], + "label": "Giga Bits/Packets per second "}, + { "value": "1", "localName": "kilo", + "platformFlavors": [ + + ], + "label": "Kilo Bits/Packets per second "}, + { "value": "2", "localName": "mega", + "platformFlavors": [ + + ], + "label": "Mega Bits/Packets per second "}, + { "value": "0", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Bits/Packets per second "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "rn": { + "versions": "1.0(1e)-", + "comment": [ + "Identifies an object from its siblings within the context of its parent object. The distinguished name contains a sequence of relative names." + ], + "isConfigurable": false, + "propGlobalId": "2", + "propLocalId": "3", + "label": "rn", + "baseType": "reference:BinRN", + "modelType": "reference:BinRN", + "needsPropDelimiters": true, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "sharingMode": { + "versions": "3.1(1i)-", + "comment": [ + "Policer sharing mode" + ], + "isConfigurable": true, + "propGlobalId": "34347", + "propLocalId": "8135", + "label": "Policer Sharing Mode", + "baseType": "scalar:Enum8", + "modelType": "dpp:SharingMode", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:sharingMode", + "validValues": [ + { "value": "2", "localName": "dedicated", + "platformFlavors": [ + + ], + "comment": [ + "Policer is Dedicated on the members of the\n place where is attached" + ], + "label": "Dedicated Policer "}, + { "value": "dedicated", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "1", "localName": "shared", + "platformFlavors": [ + + ], + "comment": [ + "Policer is Shared on a given leaf among the\n attachment points using it" + ], + "label": "Shared Policer "} + ], + "default": "dedicated", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "status": { + "versions": "1.0(1e)-", + "comment": [ + "The upgrade status. This property is for internal use only." + ], + "isConfigurable": false, + "propGlobalId": "3", + "propLocalId": "4", + "label": "status", + "baseType": "scalar:Bitmask32", + "modelType": "mo:ModificationStatus", + "needsPropDelimiters": false, + "uitype": "bitmask", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validValues": [ + { "value": "2", "localName": "created", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be created. An error is returned if the object already exists. \nIn the return value of a setter method: indicates that an object has been created. \n" + ], + "label": "Created "}, + { "value": "8", "localName": "deleted", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be deleted. \nIn the return value of a setter method: indicates that an object has been deleted.\n" + ], + "label": "Deleted "}, + { "value": "4", "localName": "modified", + "platformFlavors": [ + + ], + "comment": [ + "In a setter method: specifies that an object should be modified \nIn the return value of a setter method: indicates that an object has been modified.\n" + ], + "label": "Modified "} + ], + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "type": { + "versions": "1.2(2g)-", + "comment": [ + "Policer type" + ], + "isConfigurable": true, + "propGlobalId": "22905", + "propLocalId": "33", + "label": "1R2C or 2R3C Policer", + "baseType": "scalar:Enum8", + "modelType": "dpp:Type", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:type", + "validValues": [ + { "value": "1", "localName": "1R2C", + "platformFlavors": [ + + ], + "label": "1 Rate 2 Color "}, + { "value": "2", "localName": "2R3C", + "platformFlavors": [ + + ], + "label": "2 Rate 3 Color "}, + { "value": "1R2C", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "1R2C", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "uid": { + "versions": "1.0(1e)-", + "comment": [ + "A unique identifier for this object." + ], + "isConfigurable": false, + "propGlobalId": "8", + "propLocalId": "8", + "label": "uid", + "baseType": "scalar:Uint16", + "modelType": "scalar:Uint16", + "needsPropDelimiters": false, + "uitype": "auto", + "createOnly": false, + "readWrite": false, + "readOnly": true, + "isNaming": false, + "secure": false, + "implicit": true, + "mandatory": false, + "isOverride": false, + "isLike": false, + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "userdom": { + "versions": "5.0(1k)-", + "isConfigurable": true, + "propGlobalId": "60657", + "propLocalId": "13244", + "label": "userdom", + "baseType": "string:Basic", + "modelType": "mo:UserDomType", + "needsPropDelimiters": false, + "uitype": "string", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": false, + "validators": [ + {"min" : 0, "max": 1024, + "regexs": [ + {"regex" : "^[a-zA-Z0-9_.:-]+$", "type": "include"} + ] + } + ], + "validValues": [ + { "value": "all", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "} + ], + "default": "all", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "violateAction": { + "versions": "1.2(2g)-", + "comment": [ + "Violate action" + ], + "isConfigurable": true, + "propGlobalId": "22913", + "propLocalId": "5700", + "label": "Violate Action", + "baseType": "scalar:Enum8", + "modelType": "dpp:ViolateRateAction", + "needsPropDelimiters": false, + "uitype": "enum", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:violateAction", + "validValues": [ + { "value": "drop", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "2", "localName": "drop", + "platformFlavors": [ + + ], + "label": "Drop "}, + { "value": "3", "localName": "mark", + "platformFlavors": [ + + ], + "label": "Mark "}, + { "value": "1", "localName": "transmit", + "platformFlavors": [ + + ], + "label": "Transmit "} + ], + "default": "drop", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "violateMarkCos": { + "versions": "1.2(2g)-", + "comment": [ + "Violate Mark cos" + ], + "isConfigurable": true, + "propGlobalId": "22919", + "propLocalId": "5706", + "label": "Violate mark cos", + "baseType": "scalar:Uint16", + "modelType": "dpp:CosMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:violateMarkCos", + "validators": [ + {"min" : 0, "max": 7 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + }, + "violateMarkDscp": { + "versions": "1.2(2g)-", + "comment": [ + "Violate Mark Dscp" + ], + "isConfigurable": true, + "propGlobalId": "22916", + "propLocalId": "5703", + "label": "Violate mark dscp", + "baseType": "scalar:Uint16", + "modelType": "dpp:DscpMarkingValue", + "needsPropDelimiters": false, + "uitype": "number", + "createOnly": false, + "readWrite": true, + "readOnly": false, + "isNaming": false, + "secure": false, + "implicit": false, + "mandatory": false, + "isOverride": false, + "isLike": true, + "likeProp": "dpp:Policer:violateMarkDscp", + "validators": [ + {"min" : 0, "max": 63 } + ], + "validValues": [ + { "value": "unspecified", "localName": "defaultValue", + "platformFlavors": [ + + ], + "label": " "}, + { "value": "0xffff", "localName": "unspecified", + "platformFlavors": [ + + ], + "label": "Unspecified "} + ], + "default": "unspecified", + "platformFlavors": [ + + ], + "isNxosConverged": false, + "isDeprecated": false, + "isHidden": false + } + } + } +} diff --git a/gen/templates/datasource_example.tf.tmpl b/gen/templates/datasource_example.tf.tmpl index c5c868d12..c2e0e9f21 100644 --- a/gen/templates/datasource_example.tf.tmpl +++ b/gen/templates/datasource_example.tf.tmpl @@ -7,8 +7,8 @@ data "aci_{{$.ResourceName}}" "example_{{getResourceName $key $.Definitions}}" { {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = aci_{{getResourceName .NamedPropertyClass $.Definitions}}.example.name {{- else if eq .SnakeCaseName "t_dn" }}{{$attributeKey := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- range $index, $testParent := $.TestVars.parents }} - {{- if eq $index $parentIndex }} - {{$attributeKey}} = {{getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{- if eq $index $parentIndex }}{{$attributeVale := getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{$attributeKey}} = {{if containsString $attributeVale "."}}{{$attributeVale}}{{else}}"{{$attributeVale}}"{{end}} {{- $parentIndex = add $parentIndex 1 }}{{- break}} {{- end}} {{- end}} diff --git a/gen/templates/resource.go.tmpl b/gen/templates/resource.go.tmpl index 305ebd4d8..85f323ea1 100644 --- a/gen/templates/resource.go.tmpl +++ b/gen/templates/resource.go.tmpl @@ -308,7 +308,7 @@ func (r *{{.ResourceClassName}}Resource) UpgradeState(ctx context.Context) map[i {{- else}} {{- if isNewNamedClassAttribute $Overwrite }} {{ .Name }}: basetypes.NewStringValue(GetMOName(priorStateData{{ .ResourceClassName }})), - {{- else}} + {{- else if eq .Name "TDn"}} {{ .Name }}: basetypes.NewStringValue(priorStateData{{ .ResourceClassName }}), {{- end}} {{- end}} @@ -383,7 +383,9 @@ func set{{ .ResourceClassName }}LegacyAttributes(ctx context.Context, diags *dia {{- if .HasChild}} {{- range $.Children}}{{- if isLegacyChild .PkgName $.LegacyChildren}} {{- $childClassType := getValueFromMap .PkgName $.MigrationClassTypes}} - {{- if eq $childClassType "set,string" }} + {{- if eq $childClassType "string" }} + data.Deprecated{{.ResourceClassName}} = basetypes.NewStringNull() + {{- else if eq $childClassType "set,string" }} Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List := make([]string, 0) {{- end }} {{- end }}{{- end }} @@ -422,7 +424,7 @@ func set{{ .ResourceClassName }}LegacyAttributes(ctx context.Context, diags *dia {{- if eq $AttributeName (capitalize .PkgName)}} if childAttributeName == "tDn" && childAttributeValue != "" { Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List = append(Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List, childAttributeValue.(string)) - } + }{{break}} {{- else if ne $AttributeName ""}} if childAttributeName == "{{.PropertyName}}" { Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List = append(Deprecated{{.ResourceClassName}}{{$.ResourceClassName}}List, childAttributeValue.(string)) @@ -533,7 +535,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if ne $AttributeName ""}} + {{- if or (eq .Name "TDn") (isNewNamedClassAttribute $Overwrite)}} newAttributeValues = append(newAttributeValues, attributeValue.{{ .Name }}.ValueString()) {{- end }} {{- end }} @@ -567,7 +569,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if ne $AttributeName ""}} + {{- if or (eq .Name "TDn") (isNewNamedClassAttribute $Overwrite)}} if newAttributeValue.{{ .Name }}.ValueString() == {{- if isNewNamedClassAttribute $Overwrite }}GetMOName(attributeValue){{- else}}attributeValue{{- end}} { {{.ResourceClassName}}Value = newAttributeValue foundAttributeValue = true @@ -580,7 +582,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if ne $AttributeName ""}} + {{- if or (eq .Name "TDn") (isNewNamedClassAttribute $Overwrite)}} {{ .Name }}: {{- if isNewNamedClassAttribute $Overwrite }}basetypes.NewStringValue(GetMOName(attributeValue)){{- else}}basetypes.NewStringValue(attributeValue){{- end}}, {{- end}} {{- end}} @@ -590,7 +592,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} - {{- if eq $AttributeName ""}} + {{- if and (ne .Name "TDn") (not (isNewNamedClassAttribute $Overwrite))}} {{ .ResourceClassName }}.{{ .Name }} = {{.ResourceClassName}}Value.{{ .Name }} {{- end}} {{- end}} @@ -639,6 +641,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res stateData.{{.ResourceClassName}}.ElementsAs(ctx, &newAttributeValues, false) for _, attributeValue := range attributeValues { {{- $NewProperties := getNewChildAttributes (getChildAttributesFromBlocks $ClassName $.LegacyBlocks) .Properties}} + {{- if ne (len $NewProperties) 0}} {{- range .Properties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- $AttributeName := getLegacyChildAttribute .PkgName $Overwrite . $.LegacyAttributes $.LegacyBlocks}} @@ -646,7 +649,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res planned{{ .ResourceClassName }} := {{ .ResourceClassName }}{{$.ResourceClassName}}ResourceModel{} foundAttributeValue := false for _, newAttributeValue := range newAttributeValues { - if newAttributeValue.{{ .Name }}.ValueString() == {{- if isNewNamedClassAttribute $Overwrite }}GetMOName(attributeValue.{{ $AttributeName }}.ValueString()){{- else}}attributeValue{{- end}} { + if newAttributeValue.{{ .Name }}.ValueString() == {{- if isNewNamedClassAttribute $Overwrite }}GetMOName(attributeValue.{{ $AttributeName }}.ValueString()){{- else}}attributeValue.TDn.ValueString(){{- end}} { planned{{ .ResourceClassName }} = newAttributeValue foundAttributeValue = true break @@ -654,6 +657,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res } {{- end}} {{- end}} + {{- end}} {{ .ResourceClassName }} := {{ .ResourceClassName }}{{$.ResourceClassName}}ResourceModel { {{- range .Properties}} @@ -667,6 +671,8 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- end}} } + {{- if ne (len $NewProperties) 0}} + if foundAttributeValue { {{- range $NewProperties}} {{- $Overwrite := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} @@ -686,6 +692,7 @@ func (r *{{.ResourceClassName}}Resource) ModifyPlan(ctx context.Context, req res {{- end}} {{- end}} } + {{- end}} {{.ResourceClassName}}List = append({{.ResourceClassName}}List, {{ .ResourceClassName }}) } diff --git a/gen/templates/resource_example.tf.tmpl b/gen/templates/resource_example.tf.tmpl index bbb4bd2b7..63c2819b5 100644 --- a/gen/templates/resource_example.tf.tmpl +++ b/gen/templates/resource_example.tf.tmpl @@ -7,8 +7,8 @@ resource "aci_{{$.ResourceName}}" "example_{{getResourceName $key $.Definitions} {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = aci_{{getResourceName .NamedPropertyClass $.Definitions}}.example.name {{- else if eq .SnakeCaseName "t_dn" }}{{$attributeKey := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- range $index, $testParent := $.TestVars.parents }} - {{- if eq $index $parentIndex }} - {{$attributeKey}} = {{getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{- if eq $index $parentIndex }}{{$attributeVale := getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{$attributeKey}} = {{if containsString $attributeVale "."}}{{$attributeVale}}{{else}}"{{$attributeVale}}"{{end}} {{- $parentIndex = add $parentIndex 1 }}{{- break}} {{- end}} {{- end}} diff --git a/gen/templates/resource_example_all_attributes.tf.tmpl b/gen/templates/resource_example_all_attributes.tf.tmpl index efee67a7a..c9df215cf 100644 --- a/gen/templates/resource_example_all_attributes.tf.tmpl +++ b/gen/templates/resource_example_all_attributes.tf.tmpl @@ -7,8 +7,8 @@ resource "aci_{{$.ResourceName}}" "full_example_{{getResourceName $key $.Definit {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = aci_{{getResourceName .NamedPropertyClass $.Definitions}}.example.name {{- else if eq .SnakeCaseName "t_dn" }}{{$attributeKey := overwriteProperty .PkgName .SnakeCaseName $.Definitions}} {{- range $index, $testParent := $.TestVars.parents }} - {{- if eq $index $parentIndex }} - {{$attributeKey}} = {{getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{- if eq $index $parentIndex }}{{$attributeVale := getTestTargetDn $.TestVars.targets $.TestVars.resourceName "" true $testParent.target_classes $index | replace "test" "example" | replace "_0" "" | replace "_1" "_2" }} + {{$attributeKey}} = {{if containsString $attributeVale "."}}{{$attributeVale}}{{else}}"{{$attributeVale}}"{{end}} {{- $parentIndex = add $parentIndex 1 }}{{- break}} {{- end}} {{- end}} @@ -22,8 +22,8 @@ resource "aci_{{$.ResourceName}}" "full_example_{{getResourceName $key $.Definit { {{- range .Properties}}{{- if ne .NamedPropertyClass ""}} {{overwriteProperty .PkgName .SnakeCaseName $.Definitions}} = aci_{{getResourceName .NamedPropertyClass $.Definitions}}.example.name {{- else if eq .SnakeCaseName "t_dn" }} - {{- range $index, $testParent := $.TestVars.parents }} - target_dn = {{getTestTargetDn $.TestVars.child_targets $ChildResourceName "target_dn_0" true nil 0 | replace "test_0" "example_2" }} + {{- range $index, $testParent := $.TestVars.parents }}{{$attributeVale := getTestTargetDn $.TestVars.child_targets $ChildResourceName "target_dn_0" true nil 0 | replace "test_0" "example_2" }} + target_dn = {{if containsString $attributeVale "."}}{{$attributeVale}}{{else}}"{{$attributeVale}}"{{end}} {{- break}} {{- end}} {{- else}} diff --git a/gen/templates/testvars.yaml.tmpl b/gen/templates/testvars.yaml.tmpl index 1dfa19707..3f1f1b50d 100644 --- a/gen/templates/testvars.yaml.tmpl +++ b/gen/templates/testvars.yaml.tmpl @@ -130,6 +130,7 @@ targets: target_resource_name: "{{ .TargetResourceName }}" relation_resource_name: "{{ .RelationResourceName }}" parent_dn_key: "{{ .ParentDnKey }}" + static: {{ .Static }} properties: {{- range $key, $value := .Properties}} {{ $key }}: "{{ $value }}" @@ -141,11 +142,13 @@ child_targets: {{- range .ChildTestDependencies }} - class_name: "{{ .ClassName }}" target_dn: "{{ .TargetDn }}" + relation_resource_name: "{{ .RelationResourceName }}" + static: {{ .Static }} + {{- if not .Static}} target_dn_ref: "{{ .TargetDnRef }}" parent_dependency: "{{ .ParentDependency}}" parent_dependency_dn_ref: "{{.ParentDependencyDnRef}}" target_resource_name: "{{ .TargetResourceName }}" - relation_resource_name: "{{ .RelationResourceName }}" parent_dn_key: "{{ .ParentDnKey }}" properties: {{- range $key, $value := .Properties}} @@ -153,4 +156,5 @@ child_targets: {{- end }} {{- end }} {{- end }} + {{- end}} {{- end}} diff --git a/gen/testvars/fhsTrustCtrlPol.yaml b/gen/testvars/fhsTrustCtrlPol.yaml new file mode 100644 index 000000000..bc9196257 --- /dev/null +++ b/gen/testvars/fhsTrustCtrlPol.yaml @@ -0,0 +1,59 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + has_dhcpv4_server: "false" + has_dhcpv6_server: "false" + has_ipv6_router: "false" + name_alias: "" + owner_key: "" + owner_tag: "" + trust_arp: "false" + trust_nd: "false" + trust_ra: "false" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + description: "description" + has_dhcpv4_server: "no" + has_dhcpv6_server: "no" + has_ipv6_router: "no" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + trust_arp: "no" + trust_nd: "no" + trust_ra: "no" + +children: + 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" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/fvAEPg.yaml b/gen/testvars/fvAEPg.yaml new file mode 100644 index 000000000..dba3e8dc2 --- /dev/null +++ b/gen/testvars/fvAEPg.yaml @@ -0,0 +1,290 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + exception_tag: "" + flood_on_encap: "disabled" + forwarding_control: "none" + has_multicast_source: "false" + useg_epg: "false" + match_criteria: "AtleastOne" + name_alias: "" + intra_epg_isolation: "unenforced" + preferred_group_member: "exclude" + priority: "unspecified" + admin_state: "no" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + description: "description" + exception_tag: "exception_tag" + flood_on_encap: "disabled" + forwarding_control: "proxy-arp" + has_multicast_source: "no" + useg_epg: "no" + match_criteria: "All" + name_alias: "name_alias" + intra_epg_isolation: "enforced" + preferred_group_member: "exclude" + priority: "level1" + admin_state: "no" + +children: + relation_to_application_epg_monitoring_policy: + - annotation: "annotation_1" + monitoring_policy_name: "monitoring_policy_name_1" + deletable_child: true + relation_to_bridge_domain: + - annotation: "annotation_1" + bridge_domain_name: "bridge_domain_name_1" + deletable_child: false + + relation_to_consumed_contracts: + - annotation: "annotation_1" + priority: "level1" + contract_name: "contract_name_0" + + - annotation: "annotation_2" + priority: "level2" + contract_name: "contract_name_1" + + relation_to_imported_contracts: + - annotation: "annotation_1" + priority: "level1" + imported_contract_name: "imported_contract_name_0" + + - annotation: "annotation_2" + priority: "level2" + imported_contract_name: "imported_contract_name_1" + + relation_to_custom_qos_policy: + - annotation: "annotation_1" + custom_qos_policy_name: "custom_qos_policy_name_1" + deletable_child: false + + relation_to_domains: + - annotation: "annotation_1" + binding_type: "dynamicBinding" + class_preference: "encap" + custom_epg_name: "custom_epg_name_1" + delimiter: "delimiter_1" + encapsulation: "encapsulation_1" + encapsulation_mode: "auto" + epg_cos: "Cos0" + epg_cos_pref: "disabled" + deployment_immediacy: "immediate" + ipam_dhcp_override: "ipam_dhcp_override_1" + ipam_enabled: "no" + ipam_gateway: "ipam_gateway_1" + lag_policy_name: "lag_policy_name_1" + netflow_direction: "both" + enable_netflow: "disabled" + number_of_ports: "number_of_ports_1" + port_allocation: "elastic" + primary_encapsulation: "primary_encapsulation_1" + primary_encapsulation_inner: "primary_encapsulation_inner_1" + resolve_immediacy: "immediate" + secondary_encapsulation_inner: "secondary_encapsulation_inner_1" + switching_mode: "AVE" + target_dn: "target_dn_0" + untagged: "no" + vnet_only: "no" + + - annotation: "annotation_2" + binding_type: "ephemeral" + class_preference: "useg" + custom_epg_name: "custom_epg_name_2" + delimiter: "delimiter_2" + encapsulation: "encapsulation_2" + encapsulation_mode: "vlan" + epg_cos: "Cos1" + epg_cos_pref: "enabled" + deployment_immediacy: "lazy" + ipam_dhcp_override: "ipam_dhcp_override_2" + ipam_enabled: "yes" + ipam_gateway: "ipam_gateway_2" + lag_policy_name: "lag_policy_name_2" + netflow_direction: "egress" + enable_netflow: "enabled" + number_of_ports: "number_of_ports_2" + port_allocation: "fixed" + primary_encapsulation: "primary_encapsulation_2" + primary_encapsulation_inner: "primary_encapsulation_inner_2" + resolve_immediacy: "lazy" + secondary_encapsulation_inner: "secondary_encapsulation_inner_2" + switching_mode: "native" + target_dn: "target_dn_1" + untagged: "yes" + vnet_only: "yes" + + relation_to_data_plane_policing_policy: + - annotation: "annotation_1" + data_plane_policing_policy_name: "data_plane_policing_policy_name_1" + deletable_child: true + relation_to_fibre_channel_paths: + - annotation: "annotation_1" + description: "description_1" + target_dn: "target_dn_0" + vsan: "vsan_1" + vsan_mode: "native" + + - annotation: "annotation_2" + description: "description_2" + target_dn: "target_dn_1" + vsan: "vsan_2" + vsan_mode: "regular" + + relation_to_intra_epg_contracts: + - annotation: "annotation_1" + contract_name: "contract_name_0" + + - annotation: "annotation_2" + contract_name: "contract_name_1" + + relation_to_static_leafs: + - annotation: "annotation_1" + description: "description_1" + encapsulation: "encapsulation_1" + deployment_immediacy: "immediate" + mode: "native" + target_dn: "target_dn_0" + + - annotation: "annotation_2" + description: "description_2" + encapsulation: "encapsulation_2" + deployment_immediacy: "lazy" + mode: "regular" + target_dn: "target_dn_1" + + relation_to_static_paths: + - annotation: "annotation_1" + description: "description_1" + encapsulation: "encapsulation_1" + deployment_immediacy: "immediate" + mode: "native" + primary_encapsulation: "primary_encapsulation_1" + target_dn: "target_dn_0" + + - annotation: "annotation_2" + description: "description_2" + encapsulation: "encapsulation_2" + deployment_immediacy: "lazy" + mode: "regular" + primary_encapsulation: "primary_encapsulation_2" + target_dn: "target_dn_1" + + relation_to_taboo_contracts: + - annotation: "annotation_1" + taboo_contract_name: "taboo_contract_name_0" + + - annotation: "annotation_2" + taboo_contract_name: "taboo_contract_name_1" + + relation_to_provided_contracts: + - annotation: "annotation_1" + match_criteria: "All" + priority: "level1" + contract_name: "contract_name_0" + + - annotation: "annotation_2" + match_criteria: "AtleastOne" + priority: "level2" + contract_name: "contract_name_1" + + relation_to_contract_masters: + - annotation: "annotation_1" + target_dn: "target_dn_0" + + - annotation: "annotation_2" + target_dn: "target_dn_1" + + relation_to_trust_control_policy: + - annotation: "annotation_1" + trust_control_policy_name: "trust_control_policy_name_1" + deletable_child: true + 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" + +parents: + - class_name: "fvAp" + parent_dependency: "fvTenant" + parent_dn: "aci_application_profile.test.id" + class_in_parent: false +child_targets: + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_1" + relation_resource_name: "domain" + static: true + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_2" + relation_resource_name: "domain" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + relation_resource_name: "fibre_channel_path" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + relation_resource_name: "fibre_channel_path" + static: true + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-101" + relation_resource_name: "static_leaf" + static: true + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-102" + relation_resource_name: "static_leaf" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + relation_resource_name: "static_path" + static: true + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + relation_resource_name: "static_path" + static: true + - class_name: "fvAEPg" + target_dn: "uni/tn-test_tenant/ap-test_ap/epg-epg_2" + relation_resource_name: "contract_master" + static: false + target_dn_ref: "aci_application_epg.test_2.id" + parent_dependency: "fvAp" + parent_dependency_dn_ref: "aci_application_profile.test.id" + target_resource_name: "application_epg" + parent_dn_key: "application_profile_dn" + properties: + name: "epg_2" + - class_name: "fvAEPg" + target_dn: "uni/tn-test_tenant/ap-test_ap/epg-epg_3" + relation_resource_name: "contract_master" + static: false + target_dn_ref: "aci_application_epg.test_3.id" + parent_dependency: "fvAp" + parent_dependency_dn_ref: "aci_application_profile.test.id" + target_resource_name: "application_epg" + parent_dn_key: "application_profile_dn" + properties: + name: "epg_3" diff --git a/gen/testvars/fvESg.yaml b/gen/testvars/fvESg.yaml index baedb2001..9db1ec894 100644 --- a/gen/testvars/fvESg.yaml +++ b/gen/testvars/fvESg.yaml @@ -102,21 +102,23 @@ parents: child_targets: - class_name: "fvESg" target_dn: "uni/tn-test_tenant/ap-test_ap/esg-esg_0" + relation_resource_name: "contract_master" + static: false target_dn_ref: "aci_endpoint_security_group.test_0.id" parent_dependency: "fvAp" parent_dependency_dn_ref: "aci_application_profile.test.id" target_resource_name: "endpoint_security_group" - relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" properties: name: "esg_0" - class_name: "fvESg" target_dn: "uni/tn-test_tenant/ap-test_ap/esg-esg_1" + relation_resource_name: "contract_master" + static: false target_dn_ref: "aci_endpoint_security_group.test_1.id" parent_dependency: "fvAp" parent_dependency_dn_ref: "aci_application_profile.test.id" target_resource_name: "endpoint_security_group" - relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" properties: name: "esg_1" diff --git a/gen/testvars/fvRsDomAtt.yaml b/gen/testvars/fvRsDomAtt.yaml new file mode 100644 index 000000000..346b78518 --- /dev/null +++ b/gen/testvars/fvRsDomAtt.yaml @@ -0,0 +1,110 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + binding_type: "none" + class_preference: "encap" + custom_epg_name: "" + delimiter: "" + encapsulation: "" + encapsulation_mode: "auto" + epg_cos: "Cos0" + epg_cos_pref: "disabled" + deployment_immediacy: "lazy" + ipam_dhcp_override: "" + ipam_enabled: "false" + ipam_gateway: "" + lag_policy_name: "" + netflow_direction: "both" + enable_netflow: "disabled" + number_of_ports: "" + port_allocation: "none" + primary_encapsulation: "" + primary_encapsulation_inner: "" + resolve_immediacy: "lazy" + secondary_encapsulation_inner: "" + switching_mode: "native" + untagged: "false" + vnet_only: "false" + +datasource_non_existing: + target_dn: "non_existing_t_dn" + +datasource_required: + target_dn: "test_t_dn" + +resource_required: + target_dn: "test_t_dn" + +all: + annotation: "annotation" + binding_type: "dynamicBinding" + class_preference: "encap" + custom_epg_name: "custom_epg_name" + delimiter: "delimiter" + encapsulation: "encapsulation" + encapsulation_mode: "auto" + epg_cos: "Cos0" + epg_cos_pref: "disabled" + deployment_immediacy: "immediate" + ipam_dhcp_override: "ipam_dhcp_override" + ipam_enabled: "no" + ipam_gateway: "ipam_gateway" + lag_policy_name: "lag_policy_name" + netflow_direction: "both" + enable_netflow: "disabled" + number_of_ports: "number_of_ports" + port_allocation: "elastic" + primary_encapsulation: "primary_encapsulation" + primary_encapsulation_inner: "primary_encapsulation_inner" + resolve_immediacy: "immediate" + secondary_encapsulation_inner: "secondary_encapsulation_inner" + switching_mode: "AVE" + untagged: "no" + vnet_only: "no" + +children: + 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" + +parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + class_in_parent: false + target_classes: + - "vmmDomP" +targets: + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_1" + target_dn_ref: "aci_vmm_domain.test_0.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "vmm_domain" + relation_resource_name: "domain" + parent_dn_key: "parent_dn" + static: true + properties: + - class_name: "vmmDomP" + target_dn: "uni/vmmp-VMware/dom-domain_2" + target_dn_ref: "aci_vmm_domain.test_1.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "vmm_domain" + relation_resource_name: "domain" + parent_dn_key: "parent_dn" + static: true + properties: diff --git a/gen/testvars/fvRsFcPathAtt.yaml b/gen/testvars/fvRsFcPathAtt.yaml new file mode 100644 index 000000000..f1e41e084 --- /dev/null +++ b/gen/testvars/fvRsFcPathAtt.yaml @@ -0,0 +1,68 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + vsan: "" + vsan_mode: "regular" + +datasource_non_existing: + target_dn: "non_existing_t_dn" + +datasource_required: + target_dn: "test_t_dn" + +resource_required: + target_dn: "test_t_dn" + +all: + annotation: "annotation" + description: "description" + vsan: "vsan" + vsan_mode: "native" + +children: + 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" + +parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + class_in_parent: false + target_classes: + - "fabricNode" +targets: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + target_dn_ref: "aci_.test_0.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "fibre_channel_path" + parent_dn_key: "parent_dn" + static: true + properties: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + target_dn_ref: "aci_.test_1.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "fibre_channel_path" + parent_dn_key: "parent_dn" + static: true + properties: diff --git a/gen/testvars/fvRsNodeAtt.yaml b/gen/testvars/fvRsNodeAtt.yaml new file mode 100644 index 000000000..6950a65f0 --- /dev/null +++ b/gen/testvars/fvRsNodeAtt.yaml @@ -0,0 +1,70 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + encapsulation: "" + deployment_immediacy: "lazy" + mode: "regular" + +datasource_non_existing: + target_dn: "non_existing_t_dn" + +datasource_required: + target_dn: "test_t_dn" + +resource_required: + target_dn: "test_t_dn" + +all: + annotation: "annotation" + description: "description" + encapsulation: "encapsulation" + deployment_immediacy: "immediate" + mode: "native" + +children: + 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" + +parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + class_in_parent: false + target_classes: + - "fabricNode" +targets: + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-101" + target_dn_ref: "aci_.test_0.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "static_leaf" + parent_dn_key: "parent_dn" + static: true + properties: + - class_name: "fabricNode" + target_dn: "topology/pod-1/node-102" + target_dn_ref: "aci_.test_1.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "static_leaf" + parent_dn_key: "parent_dn" + static: true + properties: diff --git a/gen/testvars/fvRsPathAtt.yaml b/gen/testvars/fvRsPathAtt.yaml new file mode 100644 index 000000000..7299be563 --- /dev/null +++ b/gen/testvars/fvRsPathAtt.yaml @@ -0,0 +1,72 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + encapsulation: "" + deployment_immediacy: "lazy" + mode: "regular" + primary_encapsulation: "" + +datasource_non_existing: + target_dn: "non_existing_t_dn" + +datasource_required: + target_dn: "test_t_dn" + +resource_required: + target_dn: "test_t_dn" + +all: + annotation: "annotation" + description: "description" + encapsulation: "encapsulation" + deployment_immediacy: "immediate" + mode: "native" + primary_encapsulation: "primary_encapsulation" + +children: + 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" + +parents: + - class_name: "fvAEPg" + parent_dependency: "fvAp" + parent_dn: "aci_application_epg.test.id" + class_in_parent: false + target_classes: + - "fabricPathEp" +targets: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/1]" + target_dn_ref: "aci_.test_0.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "static_path" + parent_dn_key: "parent_dn" + static: true + properties: + - class_name: "fabricPathEp" + target_dn: "topology/pod-1/paths-101/pathep-[eth1/2]" + target_dn_ref: "aci_.test_1.id" + parent_dependency: "" + parent_dependency_dn_ref: "" + target_resource_name: "" + relation_resource_name: "static_path" + parent_dn_key: "parent_dn" + static: true + properties: diff --git a/gen/testvars/fvRsSecInherited.yaml b/gen/testvars/fvRsSecInherited.yaml index 3204eba52..c2f1532f5 100644 --- a/gen/testvars/fvRsSecInherited.yaml +++ b/gen/testvars/fvRsSecInherited.yaml @@ -54,6 +54,7 @@ targets: target_resource_name: "endpoint_security_group" relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" + static: false properties: name: "esg_0" - class_name: "fvESg" @@ -64,6 +65,7 @@ targets: target_resource_name: "endpoint_security_group" relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" + static: false properties: name: "esg_1" - class_name: "fvAEPg" @@ -74,6 +76,7 @@ targets: target_resource_name: "application_epg" relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" + static: false properties: name: "epg_2" - class_name: "fvAEPg" @@ -84,5 +87,6 @@ targets: target_resource_name: "application_epg" relation_resource_name: "contract_master" parent_dn_key: "application_profile_dn" + static: false properties: name: "epg_3" diff --git a/gen/testvars/l3extRsOutToFBRGroup.yaml b/gen/testvars/l3extRsOutToFBRGroup.yaml index e344cfd08..0d35c40aa 100644 --- a/gen/testvars/l3extRsOutToFBRGroup.yaml +++ b/gen/testvars/l3extRsOutToFBRGroup.yaml @@ -48,5 +48,6 @@ targets: target_resource_name: "vrf_fallback_route_group" relation_resource_name: "vrf_fallback_route_group" parent_dn_key: "parent_dn" + static: false properties: name: "vrf_fallback_route_group_0" diff --git a/gen/testvars/qosCustomPol.yaml b/gen/testvars/qosCustomPol.yaml new file mode 100644 index 000000000..cac7fd60c --- /dev/null +++ b/gen/testvars/qosCustomPol.yaml @@ -0,0 +1,47 @@ +# 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). + +default: + annotation: "orchestrator:terraform" + description: "" + name_alias: "" + owner_key: "" + owner_tag: "" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + annotation: "annotation" + description: "description" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + +children: + 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" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/gen/testvars/qosDppPol.yaml b/gen/testvars/qosDppPol.yaml new file mode 100644 index 000000000..f5a962475 --- /dev/null +++ b/gen/testvars/qosDppPol.yaml @@ -0,0 +1,89 @@ +# 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). + +default: + admin_st: "disabled" + annotation: "orchestrator:terraform" + be: "unspecified" + be_unit: "unspecified" + burst: "unspecified" + burst_unit: "unspecified" + conform_action: "transmit" + conform_mark_cos: "unspecified" + conform_mark_dscp: "unspecified" + description: "" + exceed_action: "drop" + exceed_mark_cos: "unspecified" + exceed_mark_dscp: "unspecified" + mode: "bit" + name_alias: "" + owner_key: "" + owner_tag: "" + pir: "" + pir_unit: "unspecified" + rate: "" + rate_unit: "unspecified" + sharing_mode: "dedicated" + type: "1R2C" + violate_action: "drop" + violate_mark_cos: "unspecified" + violate_mark_dscp: "unspecified" + +datasource_non_existing: + name: "non_existing_name" + +datasource_required: + name: "test_name" + +resource_required: + name: "test_name" + +all: + admin_st: "disabled" + annotation: "annotation" + be: "unspecified" + be_unit: "giga" + burst: "unspecified" + burst_unit: "giga" + conform_action: "drop" + conform_mark_cos: "unspecified" + conform_mark_dscp: "unspecified" + description: "description" + exceed_action: "drop" + exceed_mark_cos: "unspecified" + exceed_mark_dscp: "unspecified" + mode: "bit" + name_alias: "name_alias" + owner_key: "owner_key" + owner_tag: "owner_tag" + pir: "pir" + pir_unit: "giga" + rate: "rate" + rate_unit: "giga" + sharing_mode: "dedicated" + type: "1R2C" + violate_action: "drop" + violate_mark_cos: "unspecified" + violate_mark_dscp: "unspecified" + +children: + 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" + +parents: + - class_name: "fvTenant" + parent_dependency: "" + parent_dn: "aci_tenant.test.id" + class_in_parent: false diff --git a/internal/provider/data_source_aci_application_epg.go b/internal/provider/data_source_aci_application_epg.go new file mode 100644 index 000000000..1450bff01 --- /dev/null +++ b/internal/provider/data_source_aci_application_epg.go @@ -0,0 +1,731 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvAEPgDataSource{} + +func NewFvAEPgDataSource() datasource.DataSource { + return &FvAEPgDataSource{} +} + +// FvAEPgDataSource defines the data source implementation. +type FvAEPgDataSource struct { + client *client.Client +} + +func (d *FvAEPgDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_application_epg") + resp.TypeName = req.ProviderTypeName + "_application_epg" + tflog.Debug(ctx, "End metadata of datasource: aci_application_epg") +} + +func (d *FvAEPgDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_application_epg") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The application_epg datasource for the 'fvAEPg' class", + + Attributes: map[string]schema.Attribute{ + // Deprecated attributes + "fwd_ctrl": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'fwd_ctrl' will be deprecated soon, please refer to 'forwarding_control' instead", + }, + "has_mcast_source": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'has_mcast_source' will be deprecated soon, please refer to 'has_multicast_source' instead", + }, + "is_attr_based_epg": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'is_attr_based_epg' will be deprecated soon, please refer to 'useg_epg' instead", + }, + "match_t": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'match_t' will be deprecated soon, please refer to 'match_criteria' instead", + }, + "application_profile_dn": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'application_profile_dn' will be deprecated soon, please refer to 'parent_dn' instead", + }, + "pc_enf_pref": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'pc_enf_pref' will be deprecated soon, please refer to 'intra_epg_isolation' instead", + }, + "pref_gr_memb": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'pref_gr_memb' will be deprecated soon, please refer to 'preferred_group_member' instead", + }, + "prio": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'prio' will be deprecated soon, please refer to 'priority' instead", + }, + "shutdown": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'shutdown' will be deprecated soon, please refer to 'admin_state' instead", + }, + "relation_fv_rs_aepg_mon_pol": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_aepg_mon_pol' will be deprecated soon, please refer to 'relation_to_application_epg_monitoring_policy.monitoring_policy_name' instead", + }, + "relation_fv_rs_bd": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd' will be deprecated soon, please refer to 'relation_to_bridge_domain.bridge_domain_name' instead", + }, + "relation_fv_rs_cons": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_cons' will be deprecated soon, please refer to 'relation_to_consumed_contracts.contract_name' instead", + }, + "relation_fv_rs_sec_inherited": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_sec_inherited' will be deprecated soon, please refer to 'relation_to_contract_masters.target_dn' instead", + }, + "relation_fv_rs_cust_qos_pol": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_cust_qos_pol' will be deprecated soon, please refer to 'relation_to_custom_qos_policy.custom_qos_policy_name' instead", + }, + "relation_fv_rs_dpp_pol": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_dpp_pol' will be deprecated soon, please refer to 'relation_to_data_plane_policing_policy.data_plane_policing_policy_name' instead", + }, + "relation_fv_rs_fc_path_att": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_fc_path_att' will be deprecated soon, please refer to 'relation_to_fibre_channel_paths.fibre_channel_path_name' instead", + }, + "relation_fv_rs_cons_if": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_cons_if' will be deprecated soon, please refer to 'relation_to_imported_contracts.imported_contract_name' instead", + }, + "relation_fv_rs_intra_epg": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_intra_epg' will be deprecated soon, please refer to 'relation_to_intra_epg_contracts.contract_name' instead", + }, + "relation_fv_rs_prov": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_prov' will be deprecated soon, please refer to 'relation_to_provided_contracts.contract_name' instead", + }, + "relation_fv_rs_path_att": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_path_att' will be deprecated soon, please refer to 'relation_to_static_paths.target_dn' instead", + }, + "relation_fv_rs_prot_by": schema.SetAttribute{ + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_prot_by' will be deprecated soon, please refer to 'relation_to_taboo_contracts.taboo_contract_name' instead", + }, + "relation_fv_rs_trust_ctrl": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_trust_ctrl' will be deprecated soon, please refer to 'relation_to_trust_control_policy.trust_control_policy_name' instead", + }, + // End of deprecated attributes + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Application Epg object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Application Epg object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Application Epg object.`, + }, + "exception_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Contract Exception Tag.`, + }, + "flood_on_encap": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Control at EPG level if the traffic L2 Multicast/Broadcast and Link Local Layer should be flooded only on ENCAP or based on bridg-domain settings.`, + }, + "forwarding_control": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Forwarding Control.`, + }, + "has_multicast_source": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `EPg with Multisite Mcast Source.`, + }, + "useg_epg": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Attribute Based EPG.`, + }, + "match_criteria": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The provider label match criteria.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Application Epg object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Application Epg object.`, + }, + "intra_epg_isolation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used by the node (i.e. Leaf) to enforce filter rules in this EPG.`, + }, + "preferred_group_member": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used to determine if EPg is part of a group that does not a contract for communication.`, + }, + "priority": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "admin_state": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Withdraw AEPg Configuration from all Nodes in the Fabric.`, + }, + "relation_to_application_epg_monitoring_policy": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the monitoring policy model for the endpoint group semantic scope. This is an internal object.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Application Epg Monitoring Policy object.`, + }, + "monitoring_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the monitoring policy.`, + }, + }, + }, + }, + "relation_to_bridge_domain": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the bridge domain associated to this endpoint group. This is an internal object.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Bridge Domain object.`, + }, + "bridge_domain_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the bridge domain associated with this EPG.`, + }, + }, + }, + }, + "relation_to_consumed_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `The Consumer contract profile information.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Consumed Contract object.`, + }, + "priority": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "contract_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The consumer contract name.`, + }, + }, + }, + }, + "relation_to_imported_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `A contract for which the EPG will be a consumer.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Imported Contract object.`, + }, + "priority": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "imported_contract_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The contract interface name.`, + }, + }, + }, + }, + "relation_to_custom_qos_policy": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to a custom QoS policy that enables different levels of service to be assigned to network traffic, including specifications for the Differentiated Services Code Point (DSCP) value(s) and the 802.1p Dot1p priority. This is an internal object.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Custom Qos Policy object.`, + }, + "custom_qos_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Custom QoS traffic policy name.`, + }, + }, + }, + }, + "relation_to_domains": schema.SetNestedAttribute{ + MarkdownDescription: `An EPG can be linked to a domain profile via the Associated Domain Profiles. The domain profiles attached can be VMM, Physical, L2 External, or L3 External Domains.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Domain object.`, + }, + "binding_type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Binding type for ports.`, + }, + "class_preference": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `classPref.`, + }, + "custom_epg_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `User-configured port-group display name.`, + }, + "delimiter": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `delimiter.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The port encapsulation.`, + }, + "encapsulation_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `encapMode.`, + }, + "epg_cos": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents Epg Cos for AVS.`, + }, + "epg_cos_pref": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used to enable/disable Epg Cos Policy.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM.`, + }, + "ipam_dhcp_override": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamDhcpOverride.`, + }, + "ipam_enabled": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamEnabled.`, + }, + "ipam_gateway": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamGateway.`, + }, + "lag_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `LAG Policy Name.`, + }, + "netflow_direction": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents NetFlow monitoring direction.`, + }, + "enable_netflow": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used to enable/disable Netflow Policy.`, + }, + "number_of_ports": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Number of ports for binding type.`, + }, + "port_allocation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Port allocation for ports.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "primary_encapsulation_inner": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `primaryEncapInner.`, + }, + "resolve_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Specifies if policies are to be resolved immmediately or when needed.`, + }, + "secondary_encapsulation_inner": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `secondaryEncapInner.`, + }, + "switching_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `switchingMode.`, + }, + "target_dn": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name of the Physical Domain Profile.`, + }, + "untagged": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `untagged.`, + }, + "vnet_only": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `vnetOnly.`, + }, + }, + }, + }, + "relation_to_data_plane_policing_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relationship for Dpp QOS policy`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Data Plane Policing Policy object.`, + }, + "data_plane_policing_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Name.`, + }, + }, + }, + }, + "relation_to_fibre_channel_paths": schema.SetNestedAttribute{ + MarkdownDescription: `this object is used for creation of static association + with a Path for fcoe. Existence of this implies that the + corresponding set of policies will be resolved into the + node to which the relationship points.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Fibre Channel Path object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Fibre Channel Path object.`, + }, + "target_dn": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The distinguished name of the target.`, + }, + "vsan": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `port vsan.`, + }, + "vsan_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `vsanMode.`, + }, + }, + }, + }, + "relation_to_intra_epg_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `Intra EPg contract: + Represents that the EPg is moving from "allow all within epg" mode + to a "deny all within epg" mode. + The only type of traffic allowed between EPs in this EPg is the one + specified by contracts EPg associates to with this relation.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Intra Epg Contract object.`, + }, + "contract_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The contract name.`, + }, + }, + }, + }, + "relation_to_static_leafs": schema.SetNestedAttribute{ + MarkdownDescription: `The static association with an access group is a bundled or unbundled group of ports. The existence of this object implies that the corresponding set of policies will be resolved into the node to which the relationship points.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Static Leaf object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Static Leaf object.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The encapsulation method (VLAN) for the static binding.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `null.`, + }, + "mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "target_dn": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The distinguished name of the target of this static binding.`, + }, + }, + }, + }, + "relation_to_static_paths": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to an abstraction of a path endpoint.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Static Path object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Static Path object.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The encapsulation method (VLAN) of the path.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The deployment immediacy preference of this path association.`, + }, + "mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "target_dn": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `null.`, + }, + }, + }, + }, + "relation_to_taboo_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `The taboo contract for which the EPG will be a provider and consumer.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Taboo Contract object.`, + }, + "taboo_contract_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A contract for denying specific classes of traffic. Taboo rules are applied in the hardware before applying the rules of regular contracts. Without a contract, the default forwarding policy is to not allow any communication between EPGs.`, + }, + }, + }, + }, + "relation_to_provided_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `A contract for which the EPG will be a provider.`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Provided Contract object.`, + }, + "match_criteria": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The provider label match criteria.`, + }, + "priority": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "contract_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The provider contract name.`, + }, + }, + }, + }, + "relation_to_contract_masters": schema.SetNestedAttribute{ + MarkdownDescription: `Represents that the EPg is inheriting security configuration from another EPg`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Contract Master object.`, + }, + "target_dn": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The distinguished name of the target.`, + }, + }, + }, + }, + "relation_to_trust_control_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relationship for FHS trust control`, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Trust Control Policy object.`, + }, + "trust_control_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Name.`, + }, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_node_att": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'deployment_immediacy' will be deprecated soon, please refer to 'relation_to_static_leafs.deployment_immediacy' instead", + }, + "description": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'description' will be deprecated soon, please refer to 'relation_to_static_leafs.description' instead", + }, + "encap": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'encap' will be deprecated soon, please refer to 'relation_to_static_leafs.encapsulation' instead", + }, + "mode": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'mode' will be deprecated soon, please refer to 'relation_to_static_leafs.mode' instead", + }, + "node_dn": schema.StringAttribute{ + Computed: true, + DeprecationMessage: "Attribute 'node_dn' will be deprecated soon, please refer to 'relation_to_static_leafs.target_dn' instead", + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_application_epg") +} + +func (d *FvAEPgDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_application_epg") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_application_epg") +} + +func (d *FvAEPgDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_application_epg") + var data *FvAEPgResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvAEPgId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvAEPgAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_application_epg with id '%s'", data.Id.ValueString())) + + getAndSetFvAEPgAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_application_epg data source", + fmt.Sprintf("The aci_application_epg 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_application_epg with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_application_epg_test.go b/internal/provider/data_source_aci_application_epg_test.go new file mode 100644 index 000000000..5ebbe3dc1 --- /dev/null +++ b/internal/provider/data_source_aci_application_epg_test.go @@ -0,0 +1,62 @@ +// 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 TestAccDataSourceFvAEPgWithFvAp(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvAEPgDataSourceDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("data.aci_application_epg.test", "useg_epg", "false"), + ), + }, + { + Config: testConfigFvAEPgNotExistingFvAp, + ExpectError: regexp.MustCompile("Failed to read aci_application_epg data source"), + }, + }, + }) +} + +const testConfigFvAEPgDataSourceDependencyWithFvAp = testConfigFvAEPgMinDependencyWithFvAp + ` +data "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + depends_on = [aci_application_epg.test] +} +` + +const testConfigFvAEPgNotExistingFvAp = testConfigFvAEPgMinDependencyWithFvAp + ` +data "aci_application_epg" "test_non_existing" { + parent_dn = aci_application_profile.test.id + name = "non_existing_name" + depends_on = [aci_application_epg.test] +} +` diff --git a/internal/provider/data_source_aci_custom_qos_policy.go b/internal/provider/data_source_aci_custom_qos_policy.go new file mode 100644 index 000000000..3c1d8b011 --- /dev/null +++ b/internal/provider/data_source_aci_custom_qos_policy.go @@ -0,0 +1,165 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &QosCustomPolDataSource{} + +func NewQosCustomPolDataSource() datasource.DataSource { + return &QosCustomPolDataSource{} +} + +// QosCustomPolDataSource defines the data source implementation. +type QosCustomPolDataSource struct { + client *client.Client +} + +func (d *QosCustomPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_custom_qos_policy") + resp.TypeName = req.ProviderTypeName + "_custom_qos_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_custom_qos_policy") +} + +func (d *QosCustomPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_custom_qos_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The custom_qos_policy datasource for the 'qosCustomPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Custom Qos Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Custom Qos Policy object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Custom Qos Policy object.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Custom Qos Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Custom Qos Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_custom_qos_policy") +} + +func (d *QosCustomPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_custom_qos_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_custom_qos_policy") +} + +func (d *QosCustomPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_custom_qos_policy") + var data *QosCustomPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setQosCustomPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetQosCustomPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) + + getAndSetQosCustomPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_custom_qos_policy data source", + fmt.Sprintf("The aci_custom_qos_policy 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_custom_qos_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_custom_qos_policy_test.go b/internal/provider/data_source_aci_custom_qos_policy_test.go new file mode 100644 index 000000000..7ee2ce119 --- /dev/null +++ b/internal/provider/data_source_aci_custom_qos_policy_test.go @@ -0,0 +1,54 @@ +// 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 TestAccDataSourceQosCustomPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigQosCustomPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_custom_qos_policy.test", "owner_tag", ""), + ), + }, + { + Config: testConfigQosCustomPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_custom_qos_policy data source"), + }, + }, + }) +} + +const testConfigQosCustomPolDataSourceDependencyWithFvTenant = testConfigQosCustomPolMinDependencyWithFvTenant + ` +data "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_custom_qos_policy.test] +} +` + +const testConfigQosCustomPolNotExistingFvTenant = testConfigQosCustomPolMinDependencyWithFvTenant + ` +data "aci_custom_qos_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" + depends_on = [aci_custom_qos_policy.test] +} +` diff --git a/internal/provider/data_source_aci_data_plane_policing_policy.go b/internal/provider/data_source_aci_data_plane_policing_policy.go new file mode 100644 index 000000000..67a7b4f69 --- /dev/null +++ b/internal/provider/data_source_aci_data_plane_policing_policy.go @@ -0,0 +1,249 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &QosDppPolDataSource{} + +func NewQosDppPolDataSource() datasource.DataSource { + return &QosDppPolDataSource{} +} + +// QosDppPolDataSource defines the data source implementation. +type QosDppPolDataSource struct { + client *client.Client +} + +func (d *QosDppPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_data_plane_policing_policy") + resp.TypeName = req.ProviderTypeName + "_data_plane_policing_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_data_plane_policing_policy") +} + +func (d *QosDppPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_data_plane_policing_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The data_plane_policing_policy datasource for the 'qosDppPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Data Plane Policing Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "admin_st": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The Administrative state of the policy.`, + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Data Plane Policing Policy object.`, + }, + "be": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Excessive burst size (2R3C policer only).`, + }, + "be_unit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Excessive Burst unit - none, Kilo, Mega, Giga, ms, us.`, + }, + "burst": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Committed burst size, number of packets to absorb during a burst.`, + }, + "burst_unit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Burst unit - byte, kbyte, mbyte etc.`, + }, + "conform_action": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Confirm action.`, + }, + "conform_mark_cos": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Conform Mark cos.`, + }, + "conform_mark_dscp": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Conform Mark Dscp.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Data Plane Policing Policy object.`, + }, + "exceed_action": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Exceed action.`, + }, + "exceed_mark_cos": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Exceed Mark cos.`, + }, + "exceed_mark_dscp": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Exceed Mark Dscp.`, + }, + "mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Policer mode - bytes or packet policer.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Data Plane Policing Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Data Plane Policing Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "pir": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Peak rate (pir) (2R3C policer only).`, + }, + "pir_unit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Peak Rate unit - none, Kilo, Mega, Giga.`, + }, + "rate": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Allowed rate, committed rate at which the packets are allowed into the system.`, + }, + "rate_unit": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Rate unit - bps, kbps, mbps, packets etc.`, + }, + "sharing_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Policer sharing mode.`, + }, + "type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Policer type.`, + }, + "violate_action": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Violate action.`, + }, + "violate_mark_cos": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Violate Mark cos.`, + }, + "violate_mark_dscp": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Violate Mark Dscp.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_data_plane_policing_policy") +} + +func (d *QosDppPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_data_plane_policing_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_data_plane_policing_policy") +} + +func (d *QosDppPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_data_plane_policing_policy") + var data *QosDppPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setQosDppPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetQosDppPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) + + getAndSetQosDppPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_data_plane_policing_policy data source", + fmt.Sprintf("The aci_data_plane_policing_policy 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_data_plane_policing_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_data_plane_policing_policy_test.go b/internal/provider/data_source_aci_data_plane_policing_policy_test.go new file mode 100644 index 000000000..f4b118048 --- /dev/null +++ b/internal/provider/data_source_aci_data_plane_policing_policy_test.go @@ -0,0 +1,75 @@ +// 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 TestAccDataSourceQosDppPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigQosDppPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("data.aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + ), + }, + { + Config: testConfigQosDppPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_data_plane_policing_policy data source"), + }, + }, + }) +} + +const testConfigQosDppPolDataSourceDependencyWithFvTenant = testConfigQosDppPolMinDependencyWithFvTenant + ` +data "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_data_plane_policing_policy.test] +} +` + +const testConfigQosDppPolNotExistingFvTenant = testConfigQosDppPolMinDependencyWithFvTenant + ` +data "aci_data_plane_policing_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" + depends_on = [aci_data_plane_policing_policy.test] +} +` diff --git a/internal/provider/data_source_aci_relation_to_domain.go b/internal/provider/data_source_aci_relation_to_domain.go new file mode 100644 index 000000000..660348cff --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_domain.go @@ -0,0 +1,245 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsDomAttDataSource{} + +func NewFvRsDomAttDataSource() datasource.DataSource { + return &FvRsDomAttDataSource{} +} + +// FvRsDomAttDataSource defines the data source implementation. +type FvRsDomAttDataSource struct { + client *client.Client +} + +func (d *FvRsDomAttDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_to_domain") + resp.TypeName = req.ProviderTypeName + "_relation_to_domain" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_to_domain") +} + +func (d *FvRsDomAttDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_to_domain") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_domain datasource for the 'fvRsDomAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Domain object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Domain object.`, + }, + "binding_type": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Binding type for ports.`, + }, + "class_preference": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `classPref.`, + }, + "custom_epg_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `User-configured port-group display name.`, + }, + "delimiter": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `delimiter.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The port encapsulation.`, + }, + "encapsulation_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `encapMode.`, + }, + "epg_cos": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents Epg Cos for AVS.`, + }, + "epg_cos_pref": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used to enable/disable Epg Cos Policy.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM.`, + }, + "ipam_dhcp_override": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamDhcpOverride.`, + }, + "ipam_enabled": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamEnabled.`, + }, + "ipam_gateway": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `ipamGateway.`, + }, + "lag_policy_name": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `LAG Policy Name.`, + }, + "netflow_direction": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents NetFlow monitoring direction.`, + }, + "enable_netflow": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents parameter used to enable/disable Netflow Policy.`, + }, + "number_of_ports": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Number of ports for binding type.`, + }, + "port_allocation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Port allocation for ports.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "primary_encapsulation_inner": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `primaryEncapInner.`, + }, + "resolve_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Specifies if policies are to be resolved immmediately or when needed.`, + }, + "secondary_encapsulation_inner": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `secondaryEncapInner.`, + }, + "switching_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `switchingMode.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Physical Domain Profile.`, + }, + "untagged": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `untagged.`, + }, + "vnet_only": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `vnetOnly.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_to_domain") +} + +func (d *FvRsDomAttDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_to_domain") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_to_domain") +} + +func (d *FvRsDomAttDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_to_domain") + var data *FvRsDomAttResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsDomAttId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsDomAttAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_to_domain with id '%s'", data.Id.ValueString())) + + getAndSetFvRsDomAttAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_to_domain data source", + fmt.Sprintf("The aci_relation_to_domain 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_relation_to_domain with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_to_domain_test.go b/internal/provider/data_source_aci_relation_to_domain_test.go new file mode 100644 index 000000000..2b560ee53 --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_domain_test.go @@ -0,0 +1,74 @@ +// 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 TestAccDataSourceFvRsDomAttWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsDomAttDataSourceDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("data.aci_relation_to_domain.test", "vnet_only", "false"), + ), + }, + { + Config: testConfigFvRsDomAttNotExistingFvAEPg, + ExpectError: regexp.MustCompile("Failed to read aci_relation_to_domain data source"), + }, + }, + }) +} + +const testConfigFvRsDomAttDataSourceDependencyWithFvAEPg = testConfigFvRsDomAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + depends_on = [aci_relation_to_domain.test] +} +` + +const testConfigFvRsDomAttNotExistingFvAEPg = testConfigFvRsDomAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_domain" "test_non_existing" { + parent_dn = aci_application_epg.test.id + target_dn = "uni/vmmp-VMware/dom-domain_1_not_existing" + depends_on = [aci_relation_to_domain.test] +} +` diff --git a/internal/provider/data_source_aci_relation_to_fibre_channel_path.go b/internal/provider/data_source_aci_relation_to_fibre_channel_path.go new file mode 100644 index 000000000..04dedc94e --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_fibre_channel_path.go @@ -0,0 +1,161 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsFcPathAttDataSource{} + +func NewFvRsFcPathAttDataSource() datasource.DataSource { + return &FvRsFcPathAttDataSource{} +} + +// FvRsFcPathAttDataSource defines the data source implementation. +type FvRsFcPathAttDataSource struct { + client *client.Client +} + +func (d *FvRsFcPathAttDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_to_fibre_channel_path") + resp.TypeName = req.ProviderTypeName + "_relation_to_fibre_channel_path" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_to_fibre_channel_path") +} + +func (d *FvRsFcPathAttDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_to_fibre_channel_path") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_fibre_channel_path datasource for the 'fvRsFcPathAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Fibre Channel Path object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Fibre Channel Path object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Fibre Channel Path object.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The distinguished name of the target.`, + }, + "vsan": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `port vsan.`, + }, + "vsan_mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `vsanMode.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_to_fibre_channel_path") +} + +func (d *FvRsFcPathAttDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_to_fibre_channel_path") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_to_fibre_channel_path") +} + +func (d *FvRsFcPathAttDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_to_fibre_channel_path") + var data *FvRsFcPathAttResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsFcPathAttId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsFcPathAttAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) + + getAndSetFvRsFcPathAttAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_to_fibre_channel_path data source", + fmt.Sprintf("The aci_relation_to_fibre_channel_path 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_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_to_fibre_channel_path_test.go b/internal/provider/data_source_aci_relation_to_fibre_channel_path_test.go new file mode 100644 index 000000000..fd53a86cf --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_fibre_channel_path_test.go @@ -0,0 +1,53 @@ +// 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 TestAccDataSourceFvRsFcPathAttWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsFcPathAttDataSourceDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("data.aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + ), + }, + { + Config: testConfigFvRsFcPathAttNotExistingFvAEPg, + ExpectError: regexp.MustCompile("Failed to read aci_relation_to_fibre_channel_path data source"), + }, + }, + }) +} + +const testConfigFvRsFcPathAttDataSourceDependencyWithFvAEPg = testConfigFvRsFcPathAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + depends_on = [aci_relation_to_fibre_channel_path.test] +} +` + +const testConfigFvRsFcPathAttNotExistingFvAEPg = testConfigFvRsFcPathAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_fibre_channel_path" "test_non_existing" { + parent_dn = aci_application_epg.test.id + target_dn = "non_existing_t_dn_not_existing" + depends_on = [aci_relation_to_fibre_channel_path.test] +} +` diff --git a/internal/provider/data_source_aci_relation_to_static_leaf.go b/internal/provider/data_source_aci_relation_to_static_leaf.go new file mode 100644 index 000000000..6eb83f9ab --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_static_leaf.go @@ -0,0 +1,165 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsNodeAttDataSource{} + +func NewFvRsNodeAttDataSource() datasource.DataSource { + return &FvRsNodeAttDataSource{} +} + +// FvRsNodeAttDataSource defines the data source implementation. +type FvRsNodeAttDataSource struct { + client *client.Client +} + +func (d *FvRsNodeAttDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_to_static_leaf") + resp.TypeName = req.ProviderTypeName + "_relation_to_static_leaf" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_to_static_leaf") +} + +func (d *FvRsNodeAttDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_to_static_leaf") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_static_leaf datasource for the 'fvRsNodeAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Static Leaf object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Static Leaf object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Static Leaf object.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The encapsulation method (VLAN) for the static binding.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `null.`, + }, + "mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The distinguished name of the target of this static binding.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_to_static_leaf") +} + +func (d *FvRsNodeAttDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_to_static_leaf") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_to_static_leaf") +} + +func (d *FvRsNodeAttDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_to_static_leaf") + var data *FvRsNodeAttResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsNodeAttId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsNodeAttAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) + + getAndSetFvRsNodeAttAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_to_static_leaf data source", + fmt.Sprintf("The aci_relation_to_static_leaf 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_relation_to_static_leaf with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_to_static_leaf_test.go b/internal/provider/data_source_aci_relation_to_static_leaf_test.go new file mode 100644 index 000000000..5e1cbe30b --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_static_leaf_test.go @@ -0,0 +1,54 @@ +// 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 TestAccDataSourceFvRsNodeAttWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsNodeAttDataSourceDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_static_leaf.test", "mode", "regular"), + ), + }, + { + Config: testConfigFvRsNodeAttNotExistingFvAEPg, + ExpectError: regexp.MustCompile("Failed to read aci_relation_to_static_leaf data source"), + }, + }, + }) +} + +const testConfigFvRsNodeAttDataSourceDependencyWithFvAEPg = testConfigFvRsNodeAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + depends_on = [aci_relation_to_static_leaf.test] +} +` + +const testConfigFvRsNodeAttNotExistingFvAEPg = testConfigFvRsNodeAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_static_leaf" "test_non_existing" { + parent_dn = aci_application_epg.test.id + target_dn = "topology/pod-1/node-101_not_existing" + depends_on = [aci_relation_to_static_leaf.test] +} +` diff --git a/internal/provider/data_source_aci_relation_to_static_path.go b/internal/provider/data_source_aci_relation_to_static_path.go new file mode 100644 index 000000000..3951f8ffe --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_static_path.go @@ -0,0 +1,169 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FvRsPathAttDataSource{} + +func NewFvRsPathAttDataSource() datasource.DataSource { + return &FvRsPathAttDataSource{} +} + +// FvRsPathAttDataSource defines the data source implementation. +type FvRsPathAttDataSource struct { + client *client.Client +} + +func (d *FvRsPathAttDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_relation_to_static_path") + resp.TypeName = req.ProviderTypeName + "_relation_to_static_path" + tflog.Debug(ctx, "End metadata of datasource: aci_relation_to_static_path") +} + +func (d *FvRsPathAttDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_relation_to_static_path") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_static_path datasource for the 'fvRsPathAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Static Path object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Relation To Static Path object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Relation To Static Path object.`, + }, + "encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The encapsulation method (VLAN) of the path.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The deployment immediacy preference of this path association.`, + }, + "mode": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: `null.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_relation_to_static_path") +} + +func (d *FvRsPathAttDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_relation_to_static_path") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_relation_to_static_path") +} + +func (d *FvRsPathAttDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_relation_to_static_path") + var data *FvRsPathAttResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsPathAttId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFvRsPathAttAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) + + getAndSetFvRsPathAttAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_relation_to_static_path data source", + fmt.Sprintf("The aci_relation_to_static_path 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_relation_to_static_path with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_relation_to_static_path_test.go b/internal/provider/data_source_aci_relation_to_static_path_test.go new file mode 100644 index 000000000..538203e89 --- /dev/null +++ b/internal/provider/data_source_aci_relation_to_static_path_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 TestAccDataSourceFvRsPathAttWithFvAEPg(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFvRsPathAttDataSourceDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("data.aci_relation_to_static_path.test", "primary_encapsulation", ""), + ), + }, + { + Config: testConfigFvRsPathAttNotExistingFvAEPg, + ExpectError: regexp.MustCompile("Failed to read aci_relation_to_static_path data source"), + }, + }, + }) +} + +const testConfigFvRsPathAttDataSourceDependencyWithFvAEPg = testConfigFvRsPathAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + depends_on = [aci_relation_to_static_path.test] +} +` + +const testConfigFvRsPathAttNotExistingFvAEPg = testConfigFvRsPathAttMinDependencyWithFvAEPg + ` +data "aci_relation_to_static_path" "test_non_existing" { + parent_dn = aci_application_epg.test.id + target_dn = "topology/pod-1/paths-101/pathep-[eth1/1]_not_existing" + depends_on = [aci_relation_to_static_path.test] +} +` diff --git a/internal/provider/data_source_aci_trust_control_policy.go b/internal/provider/data_source_aci_trust_control_policy.go new file mode 100644 index 000000000..d2b9b725d --- /dev/null +++ b/internal/provider/data_source_aci_trust_control_policy.go @@ -0,0 +1,189 @@ +// 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 ( + "context" + "fmt" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &FhsTrustCtrlPolDataSource{} + +func NewFhsTrustCtrlPolDataSource() datasource.DataSource { + return &FhsTrustCtrlPolDataSource{} +} + +// FhsTrustCtrlPolDataSource defines the data source implementation. +type FhsTrustCtrlPolDataSource struct { + client *client.Client +} + +func (d *FhsTrustCtrlPolDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of datasource: aci_trust_control_policy") + resp.TypeName = req.ProviderTypeName + "_trust_control_policy" + tflog.Debug(ctx, "End metadata of datasource: aci_trust_control_policy") +} + +func (d *FhsTrustCtrlPolDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of datasource: aci_trust_control_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The trust_control_policy datasource for the 'fhsTrustCtrlPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Trust Control Policy object.", + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + }, + "annotation": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The annotation of the Trust Control Policy object.`, + }, + "description": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The description of the Trust Control Policy object.`, + }, + "has_dhcpv4_server": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Contains DHCPv4 servers.`, + }, + "has_dhcpv6_server": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Contains DHCPv6 servers.`, + }, + "has_ipv6_router": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Contains IPv6 routers.`, + }, + "name": schema.StringAttribute{ + Required: true, + MarkdownDescription: `The name of the Trust Control Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The name alias of the Trust Control Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "trust_arp": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Trust ARP.`, + }, + "trust_nd": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Trust ND.`, + }, + "trust_ra": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `Trust router advertisement.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Computed: true, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of datasource: aci_trust_control_policy") +} + +func (d *FhsTrustCtrlPolDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of datasource: aci_trust_control_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client + tflog.Debug(ctx, "End configure of datasource: aci_trust_control_policy") +} + +func (d *FhsTrustCtrlPolDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + tflog.Debug(ctx, "Start read of datasource: aci_trust_control_policy") + var data *FhsTrustCtrlPolResourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFhsTrustCtrlPolId(ctx, data) + + // Create a copy of the Id for when not found during getAndSetFhsTrustCtrlPolAttributes + cachedId := data.Id.ValueString() + + tflog.Debug(ctx, fmt.Sprintf("Read of datasource aci_trust_control_policy with id '%s'", data.Id.ValueString())) + + getAndSetFhsTrustCtrlPolAttributes(ctx, &resp.Diagnostics, d.client, data) + + if data.Id.IsNull() { + resp.Diagnostics.AddError( + "Failed to read aci_trust_control_policy data source", + fmt.Sprintf("The aci_trust_control_policy 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_trust_control_policy with id '%s'", data.Id.ValueString())) +} diff --git a/internal/provider/data_source_aci_trust_control_policy_test.go b/internal/provider/data_source_aci_trust_control_policy_test.go new file mode 100644 index 000000000..4be72e3d0 --- /dev/null +++ b/internal/provider/data_source_aci_trust_control_policy_test.go @@ -0,0 +1,60 @@ +// 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 TestAccDataSourceFhsTrustCtrlPolWithFvTenant(t *testing.T) { + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + ProtoV6ProviderFactories: testAccProtoV6ProviderFactories, + Steps: []resource.TestStep{ + { + Config: testConfigFhsTrustCtrlPolDataSourceDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("data.aci_trust_control_policy.test", "trust_ra", "false"), + ), + }, + { + Config: testConfigFhsTrustCtrlPolNotExistingFvTenant, + ExpectError: regexp.MustCompile("Failed to read aci_trust_control_policy data source"), + }, + }, + }) +} + +const testConfigFhsTrustCtrlPolDataSourceDependencyWithFvTenant = testConfigFhsTrustCtrlPolMinDependencyWithFvTenant + ` +data "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + depends_on = [aci_trust_control_policy.test] +} +` + +const testConfigFhsTrustCtrlPolNotExistingFvTenant = testConfigFhsTrustCtrlPolMinDependencyWithFvTenant + ` +data "aci_trust_control_policy" "test_non_existing" { + parent_dn = aci_tenant.test.id + name = "non_existing_name" + depends_on = [aci_trust_control_policy.test] +} +` diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 5b53aedb9..01907266e 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -197,6 +197,8 @@ func (p *AciProvider) Configure(ctx context.Context, req provider.ConfigureReque func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource { return []func() resource.Resource{ + NewFhsTrustCtrlPolResource, + NewFvAEPgResource, NewFvESgResource, NewFvEpIpTagResource, NewFvEpMacTagResource, @@ -205,7 +207,11 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource NewFvFBRouteResource, NewFvRsConsResource, NewFvRsConsIfResource, + NewFvRsDomAttResource, + NewFvRsFcPathAttResource, NewFvRsIntraEpgResource, + NewFvRsNodeAttResource, + NewFvRsPathAttResource, NewFvRsProtByResource, NewFvRsProvResource, NewFvRsSecInheritedResource, @@ -222,6 +228,8 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource NewNetflowRsMonitorToExporterResource, NewPimRouteMapEntryResource, NewPimRouteMapPolResource, + NewQosCustomPolResource, + NewQosDppPolResource, NewTagAnnotationResource, NewTagTagResource, NewVzOOBBrCPResource, @@ -231,6 +239,8 @@ func (p *AciProvider) Resources(ctx context.Context) []func() resource.Resource func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ + NewFhsTrustCtrlPolDataSource, + NewFvAEPgDataSource, NewFvESgDataSource, NewFvEpIpTagDataSource, NewFvEpMacTagDataSource, @@ -239,7 +249,11 @@ func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataS NewFvFBRouteDataSource, NewFvRsConsDataSource, NewFvRsConsIfDataSource, + NewFvRsDomAttDataSource, + NewFvRsFcPathAttDataSource, NewFvRsIntraEpgDataSource, + NewFvRsNodeAttDataSource, + NewFvRsPathAttDataSource, NewFvRsProtByDataSource, NewFvRsProvDataSource, NewFvRsSecInheritedDataSource, @@ -256,6 +270,8 @@ func (p *AciProvider) DataSources(ctx context.Context) []func() datasource.DataS NewNetflowRsMonitorToExporterDataSource, NewPimRouteMapEntryDataSource, NewPimRouteMapPolDataSource, + NewQosCustomPolDataSource, + NewQosDppPolDataSource, NewTagAnnotationDataSource, NewTagTagDataSource, NewVzOOBBrCPDataSource, diff --git a/internal/provider/resource_aci_application_epg.go b/internal/provider/resource_aci_application_epg.go new file mode 100644 index 000000000..ae1017285 --- /dev/null +++ b/internal/provider/resource_aci_application_epg.go @@ -0,0 +1,4890 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvAEPgResource{} +var _ resource.ResourceWithImportState = &FvAEPgResource{} + +func NewFvAEPgResource() resource.Resource { + return &FvAEPgResource{} +} + +// FvAEPgResource defines the resource implementation. +type FvAEPgResource struct { + client *client.Client +} + +// FvAEPgResourceModel describes the resource data model. +type FvAEPgResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + ExceptionTag types.String `tfsdk:"exception_tag"` + FloodOnEncap types.String `tfsdk:"flood_on_encap"` + FwdCtrl types.String `tfsdk:"forwarding_control"` + HasMcastSource types.String `tfsdk:"has_multicast_source"` + IsAttrBasedEPg types.String `tfsdk:"useg_epg"` + MatchT types.String `tfsdk:"match_criteria"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + PcEnfPref types.String `tfsdk:"intra_epg_isolation"` + PrefGrMemb types.String `tfsdk:"preferred_group_member"` + Prio types.String `tfsdk:"priority"` + Shutdown types.String `tfsdk:"admin_state"` + FvRsAEPgMonPol types.Set `tfsdk:"relation_to_application_epg_monitoring_policy"` + FvRsBd types.Set `tfsdk:"relation_to_bridge_domain"` + FvRsCons types.Set `tfsdk:"relation_to_consumed_contracts"` + FvRsConsIf types.Set `tfsdk:"relation_to_imported_contracts"` + FvRsCustQosPol types.Set `tfsdk:"relation_to_custom_qos_policy"` + FvRsDomAtt types.Set `tfsdk:"relation_to_domains"` + FvRsDppPol types.Set `tfsdk:"relation_to_data_plane_policing_policy"` + FvRsFcPathAtt types.Set `tfsdk:"relation_to_fibre_channel_paths"` + FvRsIntraEpg types.Set `tfsdk:"relation_to_intra_epg_contracts"` + FvRsNodeAtt types.Set `tfsdk:"relation_to_static_leafs"` + FvRsPathAtt types.Set `tfsdk:"relation_to_static_paths"` + FvRsProtBy types.Set `tfsdk:"relation_to_taboo_contracts"` + FvRsProv types.Set `tfsdk:"relation_to_provided_contracts"` + FvRsSecInherited types.Set `tfsdk:"relation_to_contract_masters"` + FvRsTrustCtrl types.Set `tfsdk:"relation_to_trust_control_policy"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` + DeprecatedFwdCtrl types.String `tfsdk:"fwd_ctrl"` + DeprecatedHasMcastSource types.String `tfsdk:"has_mcast_source"` + DeprecatedIsAttrBasedEPg types.String `tfsdk:"is_attr_based_epg"` + DeprecatedMatchT types.String `tfsdk:"match_t"` + DeprecatedParentDn types.String `tfsdk:"application_profile_dn"` + DeprecatedPcEnfPref types.String `tfsdk:"pc_enf_pref"` + DeprecatedPrefGrMemb types.String `tfsdk:"pref_gr_memb"` + DeprecatedPrio types.String `tfsdk:"prio"` + DeprecatedShutdown types.String `tfsdk:"shutdown"` + DeprecatedFvRsAEPgMonPol types.String `tfsdk:"relation_fv_rs_aepg_mon_pol"` + DeprecatedFvRsBd types.String `tfsdk:"relation_fv_rs_bd"` + DeprecatedFvRsCons types.Set `tfsdk:"relation_fv_rs_cons"` + DeprecatedFvRsSecInherited types.Set `tfsdk:"relation_fv_rs_sec_inherited"` + DeprecatedFvRsCustQosPol types.String `tfsdk:"relation_fv_rs_cust_qos_pol"` + DeprecatedFvRsDppPol types.String `tfsdk:"relation_fv_rs_dpp_pol"` + DeprecatedFvRsFcPathAtt types.Set `tfsdk:"relation_fv_rs_fc_path_att"` + DeprecatedFvRsConsIf types.Set `tfsdk:"relation_fv_rs_cons_if"` + DeprecatedFvRsIntraEpg types.Set `tfsdk:"relation_fv_rs_intra_epg"` + DeprecatedFvRsProv types.Set `tfsdk:"relation_fv_rs_prov"` + DeprecatedFvRsPathAtt types.Set `tfsdk:"relation_fv_rs_path_att"` + DeprecatedFvRsProtBy types.Set `tfsdk:"relation_fv_rs_prot_by"` + DeprecatedFvRsTrustCtrl types.String `tfsdk:"relation_fv_rs_trust_ctrl"` + DeprecatedFvRsNodeAtt types.Set `tfsdk:"relation_fv_rs_node_att"` +} + +// FvRsAEPgMonPolFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsAEPgMonPolFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnMonEPGPolName types.String `tfsdk:"monitoring_policy_name"` +} + +// FvRsBdFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsBdFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnFvBDName types.String `tfsdk:"bridge_domain_name"` +} + +// FvRsConsFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsConsFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Prio types.String `tfsdk:"priority"` + TnVzBrCPName types.String `tfsdk:"contract_name"` +} + +// FvRsConsIfFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsConsIfFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Prio types.String `tfsdk:"priority"` + TnVzCPIfName types.String `tfsdk:"imported_contract_name"` +} + +// FvRsCustQosPolFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsCustQosPolFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnQosCustomPolName types.String `tfsdk:"custom_qos_policy_name"` +} + +// FvRsDomAttFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsDomAttFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + BindingType types.String `tfsdk:"binding_type"` + ClassPref types.String `tfsdk:"class_preference"` + CustomEpgName types.String `tfsdk:"custom_epg_name"` + Delimiter types.String `tfsdk:"delimiter"` + Encap types.String `tfsdk:"encapsulation"` + EncapMode types.String `tfsdk:"encapsulation_mode"` + EpgCos types.String `tfsdk:"epg_cos"` + EpgCosPref types.String `tfsdk:"epg_cos_pref"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + IpamDhcpOverride types.String `tfsdk:"ipam_dhcp_override"` + IpamEnabled types.String `tfsdk:"ipam_enabled"` + IpamGateway types.String `tfsdk:"ipam_gateway"` + LagPolicyName types.String `tfsdk:"lag_policy_name"` + NetflowDir types.String `tfsdk:"netflow_direction"` + NetflowPref types.String `tfsdk:"enable_netflow"` + NumPorts types.String `tfsdk:"number_of_ports"` + PortAllocation types.String `tfsdk:"port_allocation"` + PrimaryEncap types.String `tfsdk:"primary_encapsulation"` + PrimaryEncapInner types.String `tfsdk:"primary_encapsulation_inner"` + ResImedcy types.String `tfsdk:"resolve_immediacy"` + SecondaryEncapInner types.String `tfsdk:"secondary_encapsulation_inner"` + SwitchingMode types.String `tfsdk:"switching_mode"` + TDn types.String `tfsdk:"target_dn"` + Untagged types.String `tfsdk:"untagged"` + VnetOnly types.String `tfsdk:"vnet_only"` +} + +// FvRsDppPolFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsDppPolFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnQosDppPolName types.String `tfsdk:"data_plane_policing_policy_name"` +} + +// FvRsFcPathAttFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsFcPathAttFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + TDn types.String `tfsdk:"target_dn"` + Vsan types.String `tfsdk:"vsan"` + VsanMode types.String `tfsdk:"vsan_mode"` +} + +// FvRsIntraEpgFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsIntraEpgFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnVzBrCPName types.String `tfsdk:"contract_name"` +} + +// FvRsNodeAttFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsNodeAttFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encapsulation"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + Mode types.String `tfsdk:"mode"` + TDn types.String `tfsdk:"target_dn"` +} + +// FvRsPathAttFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsPathAttFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encapsulation"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + Mode types.String `tfsdk:"mode"` + PrimaryEncap types.String `tfsdk:"primary_encapsulation"` + TDn types.String `tfsdk:"target_dn"` +} + +// FvRsProtByFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsProtByFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnVzTabooName types.String `tfsdk:"taboo_contract_name"` +} + +// FvRsProvFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsProvFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + MatchT types.String `tfsdk:"match_criteria"` + Prio types.String `tfsdk:"priority"` + TnVzBrCPName types.String `tfsdk:"contract_name"` +} + +// FvRsSecInheritedFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsSecInheritedFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TDn types.String `tfsdk:"target_dn"` +} + +// FvRsTrustCtrlFvAEPgResourceModel describes the resource data model for the children without relation ships. +type FvRsTrustCtrlFvAEPgResourceModel struct { + Annotation types.String `tfsdk:"annotation"` + TnFhsTrustCtrlPolName types.String `tfsdk:"trust_control_policy_name"` +} + +// TagAnnotationFvAEPgResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvAEPgResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvAEPgResourceModel describes the resource data model for the children without relation ships. +type TagTagFvAEPgResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvAEPgIdentifier struct { + Name types.String +} + +var deprecatedFvRsNodeAttType = types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "deployment_immediacy": basetypes.StringType{}, + "description": basetypes.StringType{}, + "encap": basetypes.StringType{}, + "mode": basetypes.StringType{}, + "node_dn": basetypes.StringType{}, + }, +} + +type FvAEPgResourceModelV1 struct { + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + ExceptionTag types.String `tfsdk:"exception_tag"` + FloodOnEncap types.String `tfsdk:"flood_on_encap"` + FwdCtrl types.String `tfsdk:"fwd_ctrl"` + HasMcastSource types.String `tfsdk:"has_mcast_source"` + Id types.String `tfsdk:"id"` + IsAttrBasedEPg types.String `tfsdk:"is_attr_based_epg"` + MatchT types.String `tfsdk:"match_t"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + ParentDn types.String `tfsdk:"application_profile_dn"` + PcEnfPref types.String `tfsdk:"pc_enf_pref"` + PrefGrMemb types.String `tfsdk:"pref_gr_memb"` + Prio types.String `tfsdk:"prio"` + Shutdown types.String `tfsdk:"shutdown"` + Deprecated_relation_fv_rs_prov_def types.Set `tfsdk:"relation_fv_rs_prov_def"` + FvRsAEPgMonPol types.String `tfsdk:"relation_fv_rs_aepg_mon_pol"` + FvRsBd types.String `tfsdk:"relation_fv_rs_bd"` + FvRsCons types.Set `tfsdk:"relation_fv_rs_cons"` + FvRsSecInherited types.Set `tfsdk:"relation_fv_rs_sec_inherited"` + FvRsCustQosPol types.String `tfsdk:"relation_fv_rs_cust_qos_pol"` + FvRsDppPol types.String `tfsdk:"relation_fv_rs_dpp_pol"` + FvRsFcPathAtt types.Set `tfsdk:"relation_fv_rs_fc_path_att"` + FvRsConsIf types.Set `tfsdk:"relation_fv_rs_cons_if"` + FvRsIntraEpg types.Set `tfsdk:"relation_fv_rs_intra_epg"` + FvRsProv types.Set `tfsdk:"relation_fv_rs_prov"` + FvRsPathAtt types.Set `tfsdk:"relation_fv_rs_path_att"` + FvRsProtBy types.Set `tfsdk:"relation_fv_rs_prot_by"` + FvRsTrustCtrl types.String `tfsdk:"relation_fv_rs_trust_ctrl"` + FvRsNodeAtt types.Set `tfsdk:"relation_fv_rs_node_att"` +} + +type FvRsNodeAttFvAEPgResourceModelV1 struct { + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encap"` + Mode types.String `tfsdk:"mode"` + TDn types.String `tfsdk:"node_dn"` +} + +func (r *FvAEPgResource) UpgradeState(ctx context.Context) map[int64]resource.StateUpgrader { + return map[int64]resource.StateUpgrader{ + 1: { + PriorSchema: &schema.Schema{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "description": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "exception_tag": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "flood_on_encap": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "fwd_ctrl": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "has_mcast_source": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "id": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "is_attr_based_epg": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "match_t": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "name": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "name_alias": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "application_profile_dn": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "pc_enf_pref": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "pref_gr_memb": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "prio": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "shutdown": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_prov_def": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_aepg_mon_pol": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_bd": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_cons": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_sec_inherited": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_cust_qos_pol": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "relation_fv_rs_dpp_pol": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "relation_fv_rs_fc_path_att": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_cons_if": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_intra_epg": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_prov": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_path_att": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_prot_by": schema.SetAttribute{ + Required: false, + Optional: true, + Computed: false, + ElementType: types.StringType, + }, + "relation_fv_rs_trust_ctrl": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_node_att": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "deployment_immediacy": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "description": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: true, + }, + "encap": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + "mode": schema.StringAttribute{ + Required: false, + Optional: true, + Computed: false, + }, + "node_dn": schema.StringAttribute{ + Required: true, + Optional: false, + Computed: false, + }, + }, + }, + }, + }, + }, + StateUpgrader: func(ctx context.Context, req resource.UpgradeStateRequest, resp *resource.UpgradeStateResponse) { + var priorStateData FvAEPgResourceModelV1 + + resp.Diagnostics.Append(req.State.Get(ctx, &priorStateData)...) + + if resp.Diagnostics.HasError() { + return + } + + upgradedStateData := FvAEPgResourceModel{ + Id: priorStateData.Id, + ParentDn: priorStateData.ParentDn, + Annotation: priorStateData.Annotation, + Descr: priorStateData.Descr, + ExceptionTag: priorStateData.ExceptionTag, + FloodOnEncap: priorStateData.FloodOnEncap, + FwdCtrl: priorStateData.FwdCtrl, + HasMcastSource: priorStateData.HasMcastSource, + IsAttrBasedEPg: priorStateData.IsAttrBasedEPg, + MatchT: priorStateData.MatchT, + Name: priorStateData.Name, + NameAlias: priorStateData.NameAlias, + PcEnfPref: priorStateData.PcEnfPref, + PrefGrMemb: priorStateData.PrefGrMemb, + Prio: priorStateData.Prio, + Shutdown: priorStateData.Shutdown, + DeprecatedFwdCtrl: priorStateData.FwdCtrl, + DeprecatedHasMcastSource: priorStateData.HasMcastSource, + DeprecatedIsAttrBasedEPg: priorStateData.IsAttrBasedEPg, + DeprecatedMatchT: priorStateData.MatchT, + DeprecatedParentDn: priorStateData.ParentDn, + DeprecatedPcEnfPref: priorStateData.PcEnfPref, + DeprecatedPrefGrMemb: priorStateData.PrefGrMemb, + DeprecatedPrio: priorStateData.Prio, + DeprecatedShutdown: priorStateData.Shutdown, + DeprecatedFvRsAEPgMonPol: priorStateData.FvRsAEPgMonPol, + DeprecatedFvRsBd: priorStateData.FvRsBd, + DeprecatedFvRsCustQosPol: priorStateData.FvRsCustQosPol, + DeprecatedFvRsDppPol: priorStateData.FvRsDppPol, + DeprecatedFvRsTrustCtrl: priorStateData.FvRsTrustCtrl, + } + + FvRsAEPgMonPolList := make([]FvRsAEPgMonPolFvAEPgResourceModel, 0) + FvRsAEPgMonPol := FvRsAEPgMonPolFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnMonEPGPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsAEPgMonPol.ValueString())), + } + FvRsAEPgMonPolList = append(FvRsAEPgMonPolList, FvRsAEPgMonPol) + FvRsAEPgMonPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "monitoring_policy_name": basetypes.StringType{}, + }, + } + FvRsAEPgMonPolSet, _ := types.SetValueFrom(ctx, FvRsAEPgMonPolType, FvRsAEPgMonPolList) + upgradedStateData.FvRsAEPgMonPol = FvRsAEPgMonPolSet + + FvRsBdList := make([]FvRsBdFvAEPgResourceModel, 0) + FvRsBd := FvRsBdFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFvBDName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsBd.ValueString())), + } + FvRsBdList = append(FvRsBdList, FvRsBd) + FvRsBdType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "bridge_domain_name": basetypes.StringType{}, + }, + } + FvRsBdSet, _ := types.SetValueFrom(ctx, FvRsBdType, FvRsBdList) + upgradedStateData.FvRsBd = FvRsBdSet + + FvRsConsList := make([]FvRsConsFvAEPgResourceModel, 0) + var priorStateDataFvRsConsList []string + priorStateData.FvRsCons.ElementsAs(ctx, &priorStateDataFvRsConsList, false) + for _, priorStateDataFvRsCons := range priorStateDataFvRsConsList { + FvRsCons := FvRsConsFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnVzBrCPName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsCons)), + } + FvRsConsList = append(FvRsConsList, FvRsCons) + } + FvRsConsType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsConsSet, _ := types.SetValueFrom(ctx, FvRsConsType, FvRsConsList) + upgradedStateData.FvRsCons = FvRsConsSet + + FvRsConsIfList := make([]FvRsConsIfFvAEPgResourceModel, 0) + var priorStateDataFvRsConsIfList []string + priorStateData.FvRsConsIf.ElementsAs(ctx, &priorStateDataFvRsConsIfList, false) + for _, priorStateDataFvRsConsIf := range priorStateDataFvRsConsIfList { + FvRsConsIf := FvRsConsIfFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnVzCPIfName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsConsIf)), + } + FvRsConsIfList = append(FvRsConsIfList, FvRsConsIf) + } + FvRsConsIfType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "imported_contract_name": basetypes.StringType{}, + }, + } + FvRsConsIfSet, _ := types.SetValueFrom(ctx, FvRsConsIfType, FvRsConsIfList) + upgradedStateData.FvRsConsIf = FvRsConsIfSet + + FvRsCustQosPolList := make([]FvRsCustQosPolFvAEPgResourceModel, 0) + FvRsCustQosPol := FvRsCustQosPolFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnQosCustomPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsCustQosPol.ValueString())), + } + FvRsCustQosPolList = append(FvRsCustQosPolList, FvRsCustQosPol) + FvRsCustQosPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "custom_qos_policy_name": basetypes.StringType{}, + }, + } + FvRsCustQosPolSet, _ := types.SetValueFrom(ctx, FvRsCustQosPolType, FvRsCustQosPolList) + upgradedStateData.FvRsCustQosPol = FvRsCustQosPolSet + + upgradedStateData.FvRsDomAtt = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "binding_type": basetypes.StringType{}, + "class_preference": basetypes.StringType{}, + "custom_epg_name": basetypes.StringType{}, + "delimiter": basetypes.StringType{}, + "encapsulation": basetypes.StringType{}, + "encapsulation_mode": basetypes.StringType{}, + "epg_cos": basetypes.StringType{}, + "epg_cos_pref": basetypes.StringType{}, + "deployment_immediacy": basetypes.StringType{}, + "ipam_dhcp_override": basetypes.StringType{}, + "ipam_enabled": basetypes.StringType{}, + "ipam_gateway": basetypes.StringType{}, + "lag_policy_name": basetypes.StringType{}, + "netflow_direction": basetypes.StringType{}, + "enable_netflow": basetypes.StringType{}, + "number_of_ports": basetypes.StringType{}, + "port_allocation": basetypes.StringType{}, + "primary_encapsulation": basetypes.StringType{}, + "primary_encapsulation_inner": basetypes.StringType{}, + "resolve_immediacy": basetypes.StringType{}, + "secondary_encapsulation_inner": basetypes.StringType{}, + "switching_mode": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + "untagged": basetypes.StringType{}, + "vnet_only": basetypes.StringType{}, + }, + }, + ) + + FvRsDppPolList := make([]FvRsDppPolFvAEPgResourceModel, 0) + FvRsDppPol := FvRsDppPolFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnQosDppPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsDppPol.ValueString())), + } + FvRsDppPolList = append(FvRsDppPolList, FvRsDppPol) + FvRsDppPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "data_plane_policing_policy_name": basetypes.StringType{}, + }, + } + FvRsDppPolSet, _ := types.SetValueFrom(ctx, FvRsDppPolType, FvRsDppPolList) + upgradedStateData.FvRsDppPol = FvRsDppPolSet + + FvRsFcPathAttList := make([]FvRsFcPathAttFvAEPgResourceModel, 0) + var priorStateDataFvRsFcPathAttList []string + priorStateData.FvRsFcPathAtt.ElementsAs(ctx, &priorStateDataFvRsFcPathAttList, false) + for _, priorStateDataFvRsFcPathAtt := range priorStateDataFvRsFcPathAttList { + FvRsFcPathAtt := FvRsFcPathAttFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + TDn: basetypes.NewStringValue(priorStateDataFvRsFcPathAtt), + Vsan: basetypes.NewStringNull(), + VsanMode: basetypes.NewStringNull(), + } + FvRsFcPathAttList = append(FvRsFcPathAttList, FvRsFcPathAtt) + } + FvRsFcPathAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + "vsan": basetypes.StringType{}, + "vsan_mode": basetypes.StringType{}, + }, + } + FvRsFcPathAttSet, _ := types.SetValueFrom(ctx, FvRsFcPathAttType, FvRsFcPathAttList) + upgradedStateData.FvRsFcPathAtt = FvRsFcPathAttSet + + FvRsIntraEpgList := make([]FvRsIntraEpgFvAEPgResourceModel, 0) + var priorStateDataFvRsIntraEpgList []string + priorStateData.FvRsIntraEpg.ElementsAs(ctx, &priorStateDataFvRsIntraEpgList, false) + for _, priorStateDataFvRsIntraEpg := range priorStateDataFvRsIntraEpgList { + FvRsIntraEpg := FvRsIntraEpgFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnVzBrCPName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsIntraEpg)), + } + FvRsIntraEpgList = append(FvRsIntraEpgList, FvRsIntraEpg) + } + FvRsIntraEpgType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsIntraEpgSet, _ := types.SetValueFrom(ctx, FvRsIntraEpgType, FvRsIntraEpgList) + upgradedStateData.FvRsIntraEpg = FvRsIntraEpgSet + + FvRsNodeAttList := make([]FvRsNodeAttFvAEPgResourceModel, 0) + var priorStateDataFvRsNodeAttList []FvRsNodeAttFvAEPgResourceModelV1 + priorStateData.FvRsNodeAtt.ElementsAs(ctx, &priorStateDataFvRsNodeAttList, false) + for _, priorStateDataFvRsNodeAtt := range priorStateDataFvRsNodeAttList { + FvRsNodeAtt := FvRsNodeAttFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: priorStateDataFvRsNodeAtt.Descr, + Encap: priorStateDataFvRsNodeAtt.Encap, + InstrImedcy: priorStateDataFvRsNodeAtt.InstrImedcy, + Mode: priorStateDataFvRsNodeAtt.Mode, + TDn: priorStateDataFvRsNodeAtt.TDn, + } + FvRsNodeAttList = append(FvRsNodeAttList, FvRsNodeAtt) + } + FvRsNodeAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "encapsulation": basetypes.StringType{}, + "deployment_immediacy": basetypes.StringType{}, + "mode": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsNodeAttSet, _ := types.SetValueFrom(ctx, FvRsNodeAttType, FvRsNodeAttList) + upgradedStateData.FvRsNodeAtt = FvRsNodeAttSet + + FvRsPathAttList := make([]FvRsPathAttFvAEPgResourceModel, 0) + var priorStateDataFvRsPathAttList []string + priorStateData.FvRsPathAtt.ElementsAs(ctx, &priorStateDataFvRsPathAttList, false) + for _, priorStateDataFvRsPathAtt := range priorStateDataFvRsPathAttList { + FvRsPathAtt := FvRsPathAttFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + Descr: basetypes.NewStringNull(), + Encap: basetypes.NewStringNull(), + InstrImedcy: basetypes.NewStringNull(), + Mode: basetypes.NewStringNull(), + PrimaryEncap: basetypes.NewStringNull(), + TDn: basetypes.NewStringValue(priorStateDataFvRsPathAtt), + } + FvRsPathAttList = append(FvRsPathAttList, FvRsPathAtt) + } + FvRsPathAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "encapsulation": basetypes.StringType{}, + "deployment_immediacy": basetypes.StringType{}, + "mode": basetypes.StringType{}, + "primary_encapsulation": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsPathAttSet, _ := types.SetValueFrom(ctx, FvRsPathAttType, FvRsPathAttList) + upgradedStateData.FvRsPathAtt = FvRsPathAttSet + + FvRsProtByList := make([]FvRsProtByFvAEPgResourceModel, 0) + var priorStateDataFvRsProtByList []string + priorStateData.FvRsProtBy.ElementsAs(ctx, &priorStateDataFvRsProtByList, false) + for _, priorStateDataFvRsProtBy := range priorStateDataFvRsProtByList { + FvRsProtBy := FvRsProtByFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnVzTabooName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsProtBy)), + } + FvRsProtByList = append(FvRsProtByList, FvRsProtBy) + } + FvRsProtByType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "taboo_contract_name": basetypes.StringType{}, + }, + } + FvRsProtBySet, _ := types.SetValueFrom(ctx, FvRsProtByType, FvRsProtByList) + upgradedStateData.FvRsProtBy = FvRsProtBySet + + FvRsProvList := make([]FvRsProvFvAEPgResourceModel, 0) + var priorStateDataFvRsProvList []string + priorStateData.FvRsProv.ElementsAs(ctx, &priorStateDataFvRsProvList, false) + for _, priorStateDataFvRsProv := range priorStateDataFvRsProvList { + FvRsProv := FvRsProvFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnVzBrCPName: basetypes.NewStringValue(GetMOName(priorStateDataFvRsProv)), + } + FvRsProvList = append(FvRsProvList, FvRsProv) + } + FvRsProvType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "match_criteria": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsProvSet, _ := types.SetValueFrom(ctx, FvRsProvType, FvRsProvList) + upgradedStateData.FvRsProv = FvRsProvSet + + FvRsSecInheritedList := make([]FvRsSecInheritedFvAEPgResourceModel, 0) + var priorStateDataFvRsSecInheritedList []string + priorStateData.FvRsSecInherited.ElementsAs(ctx, &priorStateDataFvRsSecInheritedList, false) + for _, priorStateDataFvRsSecInherited := range priorStateDataFvRsSecInheritedList { + FvRsSecInherited := FvRsSecInheritedFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TDn: basetypes.NewStringValue(priorStateDataFvRsSecInherited), + } + FvRsSecInheritedList = append(FvRsSecInheritedList, FvRsSecInherited) + } + FvRsSecInheritedType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsSecInheritedSet, _ := types.SetValueFrom(ctx, FvRsSecInheritedType, FvRsSecInheritedList) + upgradedStateData.FvRsSecInherited = FvRsSecInheritedSet + + FvRsTrustCtrlList := make([]FvRsTrustCtrlFvAEPgResourceModel, 0) + FvRsTrustCtrl := FvRsTrustCtrlFvAEPgResourceModel{ + Annotation: basetypes.NewStringNull(), + TnFhsTrustCtrlPolName: basetypes.NewStringValue(GetMOName(priorStateData.FvRsTrustCtrl.ValueString())), + } + FvRsTrustCtrlList = append(FvRsTrustCtrlList, FvRsTrustCtrl) + FvRsTrustCtrlType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "trust_control_policy_name": basetypes.StringType{}, + }, + } + FvRsTrustCtrlSet, _ := types.SetValueFrom(ctx, FvRsTrustCtrlType, FvRsTrustCtrlList) + upgradedStateData.FvRsTrustCtrl = FvRsTrustCtrlSet + + upgradedStateData.TagAnnotation = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": basetypes.StringType{}, + "value": basetypes.StringType{}, + }, + }, + ) + + upgradedStateData.TagTag = types.SetNull( + types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "key": basetypes.StringType{}, + "value": basetypes.StringType{}, + }, + }, + ) + + var deprecatedFvRsConsList []string + priorStateData.FvRsCons.ElementsAs(ctx, &deprecatedFvRsConsList, false) + DeprecatedFvRsConsSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsConsList) + upgradedStateData.DeprecatedFvRsCons = DeprecatedFvRsConsSet + + var deprecatedFvRsSecInheritedList []string + priorStateData.FvRsSecInherited.ElementsAs(ctx, &deprecatedFvRsSecInheritedList, false) + DeprecatedFvRsSecInheritedSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsSecInheritedList) + upgradedStateData.DeprecatedFvRsSecInherited = DeprecatedFvRsSecInheritedSet + + var deprecatedFvRsFcPathAttList []string + priorStateData.FvRsFcPathAtt.ElementsAs(ctx, &deprecatedFvRsFcPathAttList, false) + DeprecatedFvRsFcPathAttSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsFcPathAttList) + upgradedStateData.DeprecatedFvRsFcPathAtt = DeprecatedFvRsFcPathAttSet + + var deprecatedFvRsConsIfList []string + priorStateData.FvRsConsIf.ElementsAs(ctx, &deprecatedFvRsConsIfList, false) + DeprecatedFvRsConsIfSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsConsIfList) + upgradedStateData.DeprecatedFvRsConsIf = DeprecatedFvRsConsIfSet + + var deprecatedFvRsIntraEpgList []string + priorStateData.FvRsIntraEpg.ElementsAs(ctx, &deprecatedFvRsIntraEpgList, false) + DeprecatedFvRsIntraEpgSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsIntraEpgList) + upgradedStateData.DeprecatedFvRsIntraEpg = DeprecatedFvRsIntraEpgSet + + var deprecatedFvRsProvList []string + priorStateData.FvRsProv.ElementsAs(ctx, &deprecatedFvRsProvList, false) + DeprecatedFvRsProvSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsProvList) + upgradedStateData.DeprecatedFvRsProv = DeprecatedFvRsProvSet + + var deprecatedFvRsPathAttList []string + priorStateData.FvRsPathAtt.ElementsAs(ctx, &deprecatedFvRsPathAttList, false) + DeprecatedFvRsPathAttSet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsPathAttList) + upgradedStateData.DeprecatedFvRsPathAtt = DeprecatedFvRsPathAttSet + + var deprecatedFvRsProtByList []string + priorStateData.FvRsProtBy.ElementsAs(ctx, &deprecatedFvRsProtByList, false) + DeprecatedFvRsProtBySet, _ := types.SetValueFrom(ctx, types.StringType, deprecatedFvRsProtByList) + upgradedStateData.DeprecatedFvRsProtBy = DeprecatedFvRsProtBySet + + var FvRsNodeAttV1List []FvRsNodeAttFvAEPgResourceModelV1 + priorStateData.FvRsNodeAtt.ElementsAs(ctx, &FvRsNodeAttV1List, false) + FvRsNodeAttV1Set, _ := types.SetValueFrom(ctx, deprecatedFvRsNodeAttType, FvRsNodeAttV1List) + upgradedStateData.DeprecatedFvRsNodeAtt = FvRsNodeAttV1Set + + resp.Diagnostics.Append(resp.State.Set(ctx, upgradedStateData)...) + }, + }, + } +} + +func setFvAEPgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, classReadInfo []interface{}) { + data.DeprecatedParentDn = data.ParentDn + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "fwdCtrl" { + data.DeprecatedFwdCtrl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hasMcastSource" { + data.DeprecatedHasMcastSource = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "isAttrBasedEPg" { + data.DeprecatedIsAttrBasedEPg = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "matchT" { + data.DeprecatedMatchT = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "pcEnfPref" { + data.DeprecatedPcEnfPref = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "prefGrMemb" { + data.DeprecatedPrefGrMemb = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "prio" { + data.DeprecatedPrio = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "shutdown" { + data.DeprecatedShutdown = basetypes.NewStringValue(attributeValue.(string)) + } + } + data.DeprecatedFvRsAEPgMonPol = basetypes.NewStringNull() + data.DeprecatedFvRsBd = basetypes.NewStringNull() + DeprecatedFvRsConsFvAEPgList := make([]string, 0) + DeprecatedFvRsConsIfFvAEPgList := make([]string, 0) + data.DeprecatedFvRsCustQosPol = basetypes.NewStringNull() + data.DeprecatedFvRsDppPol = basetypes.NewStringNull() + DeprecatedFvRsFcPathAttFvAEPgList := make([]string, 0) + DeprecatedFvRsIntraEpgFvAEPgList := make([]string, 0) + DeprecatedFvRsPathAttFvAEPgList := make([]string, 0) + DeprecatedFvRsProtByFvAEPgList := make([]string, 0) + DeprecatedFvRsProvFvAEPgList := make([]string, 0) + DeprecatedFvRsSecInheritedFvAEPgList := make([]string, 0) + data.DeprecatedFvRsTrustCtrl = basetypes.NewStringNull() + + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "fvRsAEPgMonPol" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsAEPgMonPol = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsBd" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsBd = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsCons" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsConsFvAEPgList = append(DeprecatedFvRsConsFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsConsIf" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsConsIfFvAEPgList = append(DeprecatedFvRsConsIfFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsCustQosPol" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsCustQosPol = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsDppPol" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsDppPol = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsFcPathAtt" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsFcPathAttFvAEPgList = append(DeprecatedFvRsFcPathAttFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsIntraEpg" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsIntraEpgFvAEPgList = append(DeprecatedFvRsIntraEpgFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsPathAtt" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsPathAttFvAEPgList = append(DeprecatedFvRsPathAttFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsProtBy" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsProtByFvAEPgList = append(DeprecatedFvRsProtByFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsProv" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsProvFvAEPgList = append(DeprecatedFvRsProvFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsSecInherited" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" && childAttributeValue != "" { + DeprecatedFvRsSecInheritedFvAEPgList = append(DeprecatedFvRsSecInheritedFvAEPgList, childAttributeValue.(string)) + } + } + } + if childClassName == "fvRsTrustCtrl" { + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "tDn" { + data.DeprecatedFvRsTrustCtrl = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + } + } + } + fvRsConsSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsCons.ElementType(ctx), DeprecatedFvRsConsFvAEPgList) + data.DeprecatedFvRsCons = fvRsConsSet + fvRsConsIfSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsConsIf.ElementType(ctx), DeprecatedFvRsConsIfFvAEPgList) + data.DeprecatedFvRsConsIf = fvRsConsIfSet + fvRsFcPathAttSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsFcPathAtt.ElementType(ctx), DeprecatedFvRsFcPathAttFvAEPgList) + data.DeprecatedFvRsFcPathAtt = fvRsFcPathAttSet + fvRsIntraEpgSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsIntraEpg.ElementType(ctx), DeprecatedFvRsIntraEpgFvAEPgList) + data.DeprecatedFvRsIntraEpg = fvRsIntraEpgSet + data.DeprecatedFvRsNodeAtt = types.SetNull(deprecatedFvRsNodeAttType) + fvRsPathAttSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsPathAtt.ElementType(ctx), DeprecatedFvRsPathAttFvAEPgList) + data.DeprecatedFvRsPathAtt = fvRsPathAttSet + fvRsProtBySet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsProtBy.ElementType(ctx), DeprecatedFvRsProtByFvAEPgList) + data.DeprecatedFvRsProtBy = fvRsProtBySet + fvRsProvSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsProv.ElementType(ctx), DeprecatedFvRsProvFvAEPgList) + data.DeprecatedFvRsProv = fvRsProvSet + fvRsSecInheritedSet, _ := types.SetValueFrom(ctx, data.DeprecatedFvRsSecInherited.ElementType(ctx), DeprecatedFvRsSecInheritedFvAEPgList) + data.DeprecatedFvRsSecInherited = fvRsSecInheritedSet + } +} + +func (r *FvAEPgResource) ModifyPlan(ctx context.Context, req resource.ModifyPlanRequest, resp *resource.ModifyPlanResponse) { + if !req.Plan.Raw.IsNull() { + var planData, stateData, configData *FvAEPgResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &planData)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + resp.Diagnostics.Append(req.Config.Get(ctx, &configData)...) + + if resp.Diagnostics.HasError() { + return + } + + if !configData.FwdCtrl.IsNull() { + planData.DeprecatedFwdCtrl = configData.FwdCtrl + } else if !configData.DeprecatedFwdCtrl.IsNull() { + planData.FwdCtrl = configData.DeprecatedFwdCtrl + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFwdCtrl = stateData.DeprecatedFwdCtrl + } + + if !configData.HasMcastSource.IsNull() { + planData.DeprecatedHasMcastSource = configData.HasMcastSource + } else if !configData.DeprecatedHasMcastSource.IsNull() { + planData.HasMcastSource = configData.DeprecatedHasMcastSource + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedHasMcastSource = stateData.DeprecatedHasMcastSource + } + + if !configData.IsAttrBasedEPg.IsNull() { + planData.DeprecatedIsAttrBasedEPg = configData.IsAttrBasedEPg + } else if !configData.DeprecatedIsAttrBasedEPg.IsNull() { + planData.IsAttrBasedEPg = configData.DeprecatedIsAttrBasedEPg + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedIsAttrBasedEPg = stateData.DeprecatedIsAttrBasedEPg + } + + if !configData.MatchT.IsNull() { + planData.DeprecatedMatchT = configData.MatchT + } else if !configData.DeprecatedMatchT.IsNull() { + planData.MatchT = configData.DeprecatedMatchT + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedMatchT = stateData.DeprecatedMatchT + } + + if !configData.ParentDn.IsNull() { + planData.DeprecatedParentDn = configData.ParentDn + } else if !configData.DeprecatedParentDn.IsNull() { + planData.ParentDn = configData.DeprecatedParentDn + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedParentDn = stateData.DeprecatedParentDn + } + + if !configData.PcEnfPref.IsNull() { + planData.DeprecatedPcEnfPref = configData.PcEnfPref + } else if !configData.DeprecatedPcEnfPref.IsNull() { + planData.PcEnfPref = configData.DeprecatedPcEnfPref + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedPcEnfPref = stateData.DeprecatedPcEnfPref + } + + if !configData.PrefGrMemb.IsNull() { + planData.DeprecatedPrefGrMemb = configData.PrefGrMemb + } else if !configData.DeprecatedPrefGrMemb.IsNull() { + planData.PrefGrMemb = configData.DeprecatedPrefGrMemb + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedPrefGrMemb = stateData.DeprecatedPrefGrMemb + } + + if !configData.Prio.IsNull() { + planData.DeprecatedPrio = configData.Prio + } else if !configData.DeprecatedPrio.IsNull() { + planData.Prio = configData.DeprecatedPrio + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedPrio = stateData.DeprecatedPrio + } + + if !configData.Shutdown.IsNull() { + planData.DeprecatedShutdown = configData.Shutdown + } else if !configData.DeprecatedShutdown.IsNull() { + planData.Shutdown = configData.DeprecatedShutdown + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedShutdown = stateData.DeprecatedShutdown + } + + if !configData.FvRsAEPgMonPol.IsNull() && stateData != nil { + var attributeValues []FvRsAEPgMonPolFvAEPgResourceModel + configData.FvRsAEPgMonPol.ElementsAs(ctx, &attributeValues, false) + for _, attributeValue := range attributeValues { + if GetMOName(stateData.DeprecatedFvRsAEPgMonPol.ValueString()) == attributeValue.TnMonEPGPolName.ValueString() { + planData.DeprecatedFvRsAEPgMonPol = stateData.DeprecatedFvRsAEPgMonPol + } + } + } else if !configData.DeprecatedFvRsAEPgMonPol.IsNull() { + FvRsAEPgMonPolList := make([]FvRsAEPgMonPolFvAEPgResourceModel, 0) + FvRsAEPgMonPol := FvRsAEPgMonPolFvAEPgResourceModel{ + Annotation: planData.Annotation, + TnMonEPGPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsAEPgMonPol.ValueString())), + } + FvRsAEPgMonPolList = append(FvRsAEPgMonPolList, FvRsAEPgMonPol) + FvRsAEPgMonPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "monitoring_policy_name": basetypes.StringType{}, + }, + } + FvRsAEPgMonPolSet, _ := types.SetValueFrom(ctx, FvRsAEPgMonPolType, FvRsAEPgMonPolList) + planData.FvRsAEPgMonPol = FvRsAEPgMonPolSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsAEPgMonPol = stateData.DeprecatedFvRsAEPgMonPol + } + + if !configData.FvRsBd.IsNull() && stateData != nil { + var attributeValues []FvRsBdFvAEPgResourceModel + configData.FvRsBd.ElementsAs(ctx, &attributeValues, false) + for _, attributeValue := range attributeValues { + if GetMOName(stateData.DeprecatedFvRsBd.ValueString()) == attributeValue.TnFvBDName.ValueString() { + planData.DeprecatedFvRsBd = stateData.DeprecatedFvRsBd + } + } + } else if !configData.DeprecatedFvRsBd.IsNull() { + FvRsBdList := make([]FvRsBdFvAEPgResourceModel, 0) + FvRsBd := FvRsBdFvAEPgResourceModel{ + Annotation: planData.Annotation, + TnFvBDName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsBd.ValueString())), + } + FvRsBdList = append(FvRsBdList, FvRsBd) + FvRsBdType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "bridge_domain_name": basetypes.StringType{}, + }, + } + FvRsBdSet, _ := types.SetValueFrom(ctx, FvRsBdType, FvRsBdList) + planData.FvRsBd = FvRsBdSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsBd = stateData.DeprecatedFvRsBd + } + + // HasNamedProperties true + if !configData.FvRsCons.IsNull() && stateData != nil { + var attributeValues []FvRsConsFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsCons.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsCons.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnVzBrCPName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsConsSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsCons = FvRsConsSet + } + } + } else if !configData.DeprecatedFvRsCons.IsNull() { + FvRsConsList := make([]FvRsConsFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsConsFvAEPgResourceModel + configData.DeprecatedFvRsCons.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsCons.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsConsValue := FvRsConsFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnVzBrCPName.ValueString() == GetMOName(attributeValue) { + FvRsConsValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsCons := FvRsConsFvAEPgResourceModel{ + TnVzBrCPName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsCons.Annotation = FvRsConsValue.Annotation + FvRsCons.Prio = FvRsConsValue.Prio + } else { + FvRsCons.Annotation = planData.Annotation + FvRsCons.Prio = basetypes.NewStringValue("unspecified") // Default to default value from meta when not found + } + FvRsConsList = append(FvRsConsList, FvRsCons) + } + FvRsConsType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsConsSet, _ := types.SetValueFrom(ctx, FvRsConsType, FvRsConsList) + planData.FvRsCons = FvRsConsSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsCons = stateData.DeprecatedFvRsCons + } + + // HasNamedProperties false + if !configData.FvRsSecInherited.IsNull() && stateData != nil { + var attributeValues []FvRsSecInheritedFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsSecInherited.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsSecInherited.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TDn.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsSecInheritedSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsSecInherited = FvRsSecInheritedSet + } + } + } else if !configData.DeprecatedFvRsSecInherited.IsNull() { + FvRsSecInheritedList := make([]FvRsSecInheritedFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsSecInheritedFvAEPgResourceModel + configData.DeprecatedFvRsSecInherited.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsSecInherited.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsSecInheritedValue := FvRsSecInheritedFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TDn.ValueString() == attributeValue { + FvRsSecInheritedValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsSecInherited := FvRsSecInheritedFvAEPgResourceModel{ + TDn: basetypes.NewStringValue(attributeValue), + } + + if foundAttributeValue { + FvRsSecInherited.Annotation = FvRsSecInheritedValue.Annotation + } else { + FvRsSecInherited.Annotation = planData.Annotation + } + FvRsSecInheritedList = append(FvRsSecInheritedList, FvRsSecInherited) + } + FvRsSecInheritedType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsSecInheritedSet, _ := types.SetValueFrom(ctx, FvRsSecInheritedType, FvRsSecInheritedList) + planData.FvRsSecInherited = FvRsSecInheritedSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsSecInherited = stateData.DeprecatedFvRsSecInherited + } + + if !configData.FvRsCustQosPol.IsNull() && stateData != nil { + var attributeValues []FvRsCustQosPolFvAEPgResourceModel + configData.FvRsCustQosPol.ElementsAs(ctx, &attributeValues, false) + for _, attributeValue := range attributeValues { + if GetMOName(stateData.DeprecatedFvRsCustQosPol.ValueString()) == attributeValue.TnQosCustomPolName.ValueString() { + planData.DeprecatedFvRsCustQosPol = stateData.DeprecatedFvRsCustQosPol + } + } + } else if !configData.DeprecatedFvRsCustQosPol.IsNull() { + FvRsCustQosPolList := make([]FvRsCustQosPolFvAEPgResourceModel, 0) + FvRsCustQosPol := FvRsCustQosPolFvAEPgResourceModel{ + Annotation: planData.Annotation, + TnQosCustomPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsCustQosPol.ValueString())), + } + FvRsCustQosPolList = append(FvRsCustQosPolList, FvRsCustQosPol) + FvRsCustQosPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "custom_qos_policy_name": basetypes.StringType{}, + }, + } + FvRsCustQosPolSet, _ := types.SetValueFrom(ctx, FvRsCustQosPolType, FvRsCustQosPolList) + planData.FvRsCustQosPol = FvRsCustQosPolSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsCustQosPol = stateData.DeprecatedFvRsCustQosPol + } + + if !configData.FvRsDppPol.IsNull() && stateData != nil { + var attributeValues []FvRsDppPolFvAEPgResourceModel + configData.FvRsDppPol.ElementsAs(ctx, &attributeValues, false) + for _, attributeValue := range attributeValues { + if GetMOName(stateData.DeprecatedFvRsDppPol.ValueString()) == attributeValue.TnQosDppPolName.ValueString() { + planData.DeprecatedFvRsDppPol = stateData.DeprecatedFvRsDppPol + } + } + } else if !configData.DeprecatedFvRsDppPol.IsNull() { + FvRsDppPolList := make([]FvRsDppPolFvAEPgResourceModel, 0) + FvRsDppPol := FvRsDppPolFvAEPgResourceModel{ + Annotation: planData.Annotation, + TnQosDppPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsDppPol.ValueString())), + } + FvRsDppPolList = append(FvRsDppPolList, FvRsDppPol) + FvRsDppPolType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "data_plane_policing_policy_name": basetypes.StringType{}, + }, + } + FvRsDppPolSet, _ := types.SetValueFrom(ctx, FvRsDppPolType, FvRsDppPolList) + planData.FvRsDppPol = FvRsDppPolSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsDppPol = stateData.DeprecatedFvRsDppPol + } + + // HasNamedProperties false + if !configData.FvRsFcPathAtt.IsNull() && stateData != nil { + var attributeValues []FvRsFcPathAttFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsFcPathAtt.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsFcPathAtt.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TDn.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsFcPathAttSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsFcPathAtt = FvRsFcPathAttSet + } + } + } else if !configData.DeprecatedFvRsFcPathAtt.IsNull() { + FvRsFcPathAttList := make([]FvRsFcPathAttFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsFcPathAttFvAEPgResourceModel + configData.DeprecatedFvRsFcPathAtt.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsFcPathAtt.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsFcPathAttValue := FvRsFcPathAttFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TDn.ValueString() == attributeValue { + FvRsFcPathAttValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsFcPathAtt := FvRsFcPathAttFvAEPgResourceModel{ + TDn: basetypes.NewStringValue(attributeValue), + } + + if foundAttributeValue { + FvRsFcPathAtt.Annotation = FvRsFcPathAttValue.Annotation + FvRsFcPathAtt.Descr = FvRsFcPathAttValue.Descr + FvRsFcPathAtt.Vsan = FvRsFcPathAttValue.Vsan + FvRsFcPathAtt.VsanMode = FvRsFcPathAttValue.VsanMode + } else { + FvRsFcPathAtt.Annotation = planData.Annotation + FvRsFcPathAtt.VsanMode = basetypes.NewStringValue("regular") // Default to default value from meta when not found + } + FvRsFcPathAttList = append(FvRsFcPathAttList, FvRsFcPathAtt) + } + FvRsFcPathAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + "vsan": basetypes.StringType{}, + "vsan_mode": basetypes.StringType{}, + }, + } + FvRsFcPathAttSet, _ := types.SetValueFrom(ctx, FvRsFcPathAttType, FvRsFcPathAttList) + planData.FvRsFcPathAtt = FvRsFcPathAttSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsFcPathAtt = stateData.DeprecatedFvRsFcPathAtt + } + + // HasNamedProperties true + if !configData.FvRsConsIf.IsNull() && stateData != nil { + var attributeValues []FvRsConsIfFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsConsIf.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsConsIf.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnVzCPIfName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsConsIfSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsConsIf = FvRsConsIfSet + } + } + } else if !configData.DeprecatedFvRsConsIf.IsNull() { + FvRsConsIfList := make([]FvRsConsIfFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsConsIfFvAEPgResourceModel + configData.DeprecatedFvRsConsIf.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsConsIf.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsConsIfValue := FvRsConsIfFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnVzCPIfName.ValueString() == GetMOName(attributeValue) { + FvRsConsIfValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsConsIf := FvRsConsIfFvAEPgResourceModel{ + TnVzCPIfName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsConsIf.Annotation = FvRsConsIfValue.Annotation + FvRsConsIf.Prio = FvRsConsIfValue.Prio + } else { + FvRsConsIf.Annotation = planData.Annotation + FvRsConsIf.Prio = basetypes.NewStringValue("unspecified") // Default to default value from meta when not found + } + FvRsConsIfList = append(FvRsConsIfList, FvRsConsIf) + } + FvRsConsIfType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "imported_contract_name": basetypes.StringType{}, + }, + } + FvRsConsIfSet, _ := types.SetValueFrom(ctx, FvRsConsIfType, FvRsConsIfList) + planData.FvRsConsIf = FvRsConsIfSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsConsIf = stateData.DeprecatedFvRsConsIf + } + + // HasNamedProperties true + if !configData.FvRsIntraEpg.IsNull() && stateData != nil { + var attributeValues []FvRsIntraEpgFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsIntraEpg.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsIntraEpg.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnVzBrCPName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsIntraEpgSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsIntraEpg = FvRsIntraEpgSet + } + } + } else if !configData.DeprecatedFvRsIntraEpg.IsNull() { + FvRsIntraEpgList := make([]FvRsIntraEpgFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsIntraEpgFvAEPgResourceModel + configData.DeprecatedFvRsIntraEpg.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsIntraEpg.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsIntraEpgValue := FvRsIntraEpgFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnVzBrCPName.ValueString() == GetMOName(attributeValue) { + FvRsIntraEpgValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsIntraEpg := FvRsIntraEpgFvAEPgResourceModel{ + TnVzBrCPName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsIntraEpg.Annotation = FvRsIntraEpgValue.Annotation + } else { + FvRsIntraEpg.Annotation = planData.Annotation + } + FvRsIntraEpgList = append(FvRsIntraEpgList, FvRsIntraEpg) + } + FvRsIntraEpgType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsIntraEpgSet, _ := types.SetValueFrom(ctx, FvRsIntraEpgType, FvRsIntraEpgList) + planData.FvRsIntraEpg = FvRsIntraEpgSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsIntraEpg = stateData.DeprecatedFvRsIntraEpg + } + + // HasNamedProperties true + if !configData.FvRsProv.IsNull() && stateData != nil { + var attributeValues []FvRsProvFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsProv.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsProv.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnVzBrCPName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsProvSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsProv = FvRsProvSet + } + } + } else if !configData.DeprecatedFvRsProv.IsNull() { + FvRsProvList := make([]FvRsProvFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsProvFvAEPgResourceModel + configData.DeprecatedFvRsProv.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsProv.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsProvValue := FvRsProvFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnVzBrCPName.ValueString() == GetMOName(attributeValue) { + FvRsProvValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsProv := FvRsProvFvAEPgResourceModel{ + TnVzBrCPName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsProv.Annotation = FvRsProvValue.Annotation + FvRsProv.MatchT = FvRsProvValue.MatchT + FvRsProv.Prio = FvRsProvValue.Prio + } else { + FvRsProv.Annotation = planData.Annotation + FvRsProv.MatchT = basetypes.NewStringValue("AtleastOne") // Default to default value from meta when not found + FvRsProv.Prio = basetypes.NewStringValue("unspecified") // Default to default value from meta when not found + } + FvRsProvList = append(FvRsProvList, FvRsProv) + } + FvRsProvType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "match_criteria": basetypes.StringType{}, + "priority": basetypes.StringType{}, + "contract_name": basetypes.StringType{}, + }, + } + FvRsProvSet, _ := types.SetValueFrom(ctx, FvRsProvType, FvRsProvList) + planData.FvRsProv = FvRsProvSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsProv = stateData.DeprecatedFvRsProv + } + + // HasNamedProperties false + if !configData.FvRsPathAtt.IsNull() && stateData != nil { + var attributeValues []FvRsPathAttFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsPathAtt.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsPathAtt.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TDn.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsPathAttSet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsPathAtt = FvRsPathAttSet + } + } + } else if !configData.DeprecatedFvRsPathAtt.IsNull() { + FvRsPathAttList := make([]FvRsPathAttFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsPathAttFvAEPgResourceModel + configData.DeprecatedFvRsPathAtt.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsPathAtt.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsPathAttValue := FvRsPathAttFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TDn.ValueString() == attributeValue { + FvRsPathAttValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsPathAtt := FvRsPathAttFvAEPgResourceModel{ + TDn: basetypes.NewStringValue(attributeValue), + } + + if foundAttributeValue { + FvRsPathAtt.Annotation = FvRsPathAttValue.Annotation + FvRsPathAtt.Descr = FvRsPathAttValue.Descr + FvRsPathAtt.Encap = FvRsPathAttValue.Encap + FvRsPathAtt.InstrImedcy = FvRsPathAttValue.InstrImedcy + FvRsPathAtt.Mode = FvRsPathAttValue.Mode + FvRsPathAtt.PrimaryEncap = FvRsPathAttValue.PrimaryEncap + } else { + FvRsPathAtt.Annotation = planData.Annotation + FvRsPathAtt.InstrImedcy = basetypes.NewStringValue("lazy") // Default to default value from meta when not found + FvRsPathAtt.Mode = basetypes.NewStringValue("regular") // Default to default value from meta when not found + } + FvRsPathAttList = append(FvRsPathAttList, FvRsPathAtt) + } + FvRsPathAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "encapsulation": basetypes.StringType{}, + "deployment_immediacy": basetypes.StringType{}, + "mode": basetypes.StringType{}, + "primary_encapsulation": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsPathAttSet, _ := types.SetValueFrom(ctx, FvRsPathAttType, FvRsPathAttList) + planData.FvRsPathAtt = FvRsPathAttSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsPathAtt = stateData.DeprecatedFvRsPathAtt + } + + // HasNamedProperties true + if !configData.FvRsProtBy.IsNull() && stateData != nil { + var attributeValues []FvRsProtByFvAEPgResourceModel + var newAttributeValues, stateAttributeValues []string + configData.FvRsProtBy.ElementsAs(ctx, &attributeValues, false) + stateData.DeprecatedFvRsProtBy.ElementsAs(ctx, &stateAttributeValues, false) + for _, attributeValue := range attributeValues { + newAttributeValues = append(newAttributeValues, attributeValue.TnVzTabooName.ValueString()) + } + + if len(newAttributeValues) == len(stateAttributeValues) { + allMatchState := true + for _, stateAttributeValue := range stateAttributeValues { + if !ContainsString(newAttributeValues, GetMOName(stateAttributeValue)) { + allMatchState = false + break + } + } + if allMatchState { + FvRsProtBySet, _ := types.SetValueFrom(ctx, basetypes.StringType{}, stateAttributeValues) + planData.DeprecatedFvRsProtBy = FvRsProtBySet + } + } + } else if !configData.DeprecatedFvRsProtBy.IsNull() { + FvRsProtByList := make([]FvRsProtByFvAEPgResourceModel, 0) + var attributeValues []string + var newAttributeValues []FvRsProtByFvAEPgResourceModel + configData.DeprecatedFvRsProtBy.ElementsAs(ctx, &attributeValues, false) + if stateData != nil { + stateData.FvRsProtBy.ElementsAs(ctx, &newAttributeValues, false) + } + for _, attributeValue := range attributeValues { + FvRsProtByValue := FvRsProtByFvAEPgResourceModel{} + foundAttributeValue := false + for _, newAttributeValue := range newAttributeValues { + if newAttributeValue.TnVzTabooName.ValueString() == GetMOName(attributeValue) { + FvRsProtByValue = newAttributeValue + foundAttributeValue = true + break + } + } + FvRsProtBy := FvRsProtByFvAEPgResourceModel{ + TnVzTabooName: basetypes.NewStringValue(GetMOName(attributeValue)), + } + + if foundAttributeValue { + FvRsProtBy.Annotation = FvRsProtByValue.Annotation + } else { + FvRsProtBy.Annotation = planData.Annotation + } + FvRsProtByList = append(FvRsProtByList, FvRsProtBy) + } + FvRsProtByType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "taboo_contract_name": basetypes.StringType{}, + }, + } + FvRsProtBySet, _ := types.SetValueFrom(ctx, FvRsProtByType, FvRsProtByList) + planData.FvRsProtBy = FvRsProtBySet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsProtBy = stateData.DeprecatedFvRsProtBy + } + + if !configData.FvRsTrustCtrl.IsNull() && stateData != nil { + var attributeValues []FvRsTrustCtrlFvAEPgResourceModel + configData.FvRsTrustCtrl.ElementsAs(ctx, &attributeValues, false) + for _, attributeValue := range attributeValues { + if GetMOName(stateData.DeprecatedFvRsTrustCtrl.ValueString()) == attributeValue.TnFhsTrustCtrlPolName.ValueString() { + planData.DeprecatedFvRsTrustCtrl = stateData.DeprecatedFvRsTrustCtrl + } + } + } else if !configData.DeprecatedFvRsTrustCtrl.IsNull() { + FvRsTrustCtrlList := make([]FvRsTrustCtrlFvAEPgResourceModel, 0) + FvRsTrustCtrl := FvRsTrustCtrlFvAEPgResourceModel{ + Annotation: planData.Annotation, + TnFhsTrustCtrlPolName: basetypes.NewStringValue(GetMOName(configData.DeprecatedFvRsTrustCtrl.ValueString())), + } + FvRsTrustCtrlList = append(FvRsTrustCtrlList, FvRsTrustCtrl) + FvRsTrustCtrlType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "trust_control_policy_name": basetypes.StringType{}, + }, + } + FvRsTrustCtrlSet, _ := types.SetValueFrom(ctx, FvRsTrustCtrlType, FvRsTrustCtrlList) + planData.FvRsTrustCtrl = FvRsTrustCtrlSet + } else if stateData != nil { // used to replace use state for unknown + planData.DeprecatedFvRsTrustCtrl = stateData.DeprecatedFvRsTrustCtrl + } + + planData.DeprecatedFvRsNodeAtt = types.SetNull(deprecatedFvRsNodeAttType) + if !configData.DeprecatedFvRsNodeAtt.IsNull() && stateData != nil { + FvRsNodeAttList := make([]FvRsNodeAttFvAEPgResourceModel, 0) + var attributeValues []FvRsNodeAttFvAEPgResourceModelV1 + var newAttributeValues []FvRsNodeAttFvAEPgResourceModel + configData.DeprecatedFvRsNodeAtt.ElementsAs(ctx, &attributeValues, false) + stateData.FvRsNodeAtt.ElementsAs(ctx, &newAttributeValues, false) + for _, attributeValue := range attributeValues { + + FvRsNodeAtt := FvRsNodeAttFvAEPgResourceModel{ + Annotation: planData.Annotation, + Descr: attributeValue.Descr, + Encap: attributeValue.Encap, + InstrImedcy: attributeValue.InstrImedcy, + Mode: attributeValue.Mode, + TDn: attributeValue.TDn, + } + + FvRsNodeAttList = append(FvRsNodeAttList, FvRsNodeAtt) + } + + FvRsNodeAttType := types.ObjectType{ + AttrTypes: map[string]attr.Type{ + "annotation": basetypes.StringType{}, + "description": basetypes.StringType{}, + "encapsulation": basetypes.StringType{}, + "deployment_immediacy": basetypes.StringType{}, + "mode": basetypes.StringType{}, + "target_dn": basetypes.StringType{}, + }, + } + FvRsNodeAttSet, _ := types.SetValueFrom(ctx, FvRsNodeAttType, FvRsNodeAttList) + planData.FvRsNodeAtt = FvRsNodeAttSet + } + + resp.Diagnostics.Append(resp.Plan.Set(ctx, &planData)...) + } +} + +func (r *FvAEPgResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_application_epg") + resp.TypeName = req.ProviderTypeName + "_application_epg" + tflog.Debug(ctx, "End metadata of resource: aci_application_epg") +} + +func (r *FvAEPgResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_application_epg") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The application_epg resource for the 'fvAEPg' class", + Version: 2, + + Attributes: map[string]schema.Attribute{ + // Deprecated attributes + "fwd_ctrl": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'fwd_ctrl' will be deprecated soon, please use 'forwarding_control' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("forwarding_control"), + }...), + }, + }, + "has_mcast_source": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'has_mcast_source' will be deprecated soon, please use 'has_multicast_source' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("has_multicast_source"), + }...), + }, + }, + "is_attr_based_epg": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'is_attr_based_epg' will be deprecated soon, please use 'useg_epg' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("useg_epg"), + }...), + }, + }, + "match_t": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'match_t' will be deprecated soon, please use 'match_criteria' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("match_criteria"), + }...), + }, + }, + "application_profile_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'application_profile_dn' will be deprecated soon, please use 'parent_dn' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("parent_dn"), + }...), + }, + }, + "pc_enf_pref": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'pc_enf_pref' will be deprecated soon, please use 'intra_epg_isolation' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("intra_epg_isolation"), + }...), + }, + }, + "pref_gr_memb": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'pref_gr_memb' will be deprecated soon, please use 'preferred_group_member' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("preferred_group_member"), + }...), + }, + }, + "prio": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'prio' will be deprecated soon, please use 'priority' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("priority"), + }...), + }, + }, + "shutdown": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'shutdown' will be deprecated soon, please use 'admin_state' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("admin_state"), + }...), + }, + }, + "relation_fv_rs_aepg_mon_pol": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_aepg_mon_pol' will be deprecated soon, please use 'relation_to_application_epg_monitoring_policy.monitoring_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_application_epg_monitoring_policy"), + }...), + }, + }, + "relation_fv_rs_bd": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_bd' will be deprecated soon, please use 'relation_to_bridge_domain.bridge_domain_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_bridge_domain"), + }...), + }, + }, + "relation_fv_rs_cons": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_cons' will be deprecated soon, please use 'relation_to_consumed_contracts.contract_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_consumed_contracts"), + }...), + }, + }, + "relation_fv_rs_sec_inherited": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_sec_inherited' will be deprecated soon, please use 'relation_to_contract_masters.target_dn' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_contract_masters"), + }...), + }, + }, + "relation_fv_rs_cust_qos_pol": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_cust_qos_pol' will be deprecated soon, please use 'relation_to_custom_qos_policy.custom_qos_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_custom_qos_policy"), + }...), + }, + }, + "relation_fv_rs_dpp_pol": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_dpp_pol' will be deprecated soon, please use 'relation_to_data_plane_policing_policy.data_plane_policing_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_data_plane_policing_policy"), + }...), + }, + }, + "relation_fv_rs_fc_path_att": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_fc_path_att' will be deprecated soon, please use 'relation_to_fibre_channel_paths.fibre_channel_path_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_fibre_channel_paths"), + }...), + }, + }, + "relation_fv_rs_cons_if": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_cons_if' will be deprecated soon, please use 'relation_to_imported_contracts.imported_contract_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_imported_contracts"), + }...), + }, + }, + "relation_fv_rs_intra_epg": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_intra_epg' will be deprecated soon, please use 'relation_to_intra_epg_contracts.contract_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_intra_epg_contracts"), + }...), + }, + }, + "relation_fv_rs_prov": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_prov' will be deprecated soon, please use 'relation_to_provided_contracts.contract_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_provided_contracts"), + }...), + }, + }, + "relation_fv_rs_path_att": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_path_att' will be deprecated soon, please use 'relation_to_static_paths.target_dn' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_paths"), + }...), + }, + }, + "relation_fv_rs_prot_by": schema.SetAttribute{ + Optional: true, + Computed: true, + ElementType: types.StringType, + DeprecationMessage: "Attribute 'relation_fv_rs_prot_by' will be deprecated soon, please use 'relation_to_taboo_contracts.taboo_contract_name' instead", + Validators: []validator.Set{ + setvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_taboo_contracts"), + }...), + }, + }, + "relation_fv_rs_trust_ctrl": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'relation_fv_rs_trust_ctrl' will be deprecated soon, please use 'relation_to_trust_control_policy.trust_control_policy_name' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_trust_control_policy"), + }...), + }, + }, + // End of deprecated attributes + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Application Epg object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + Validators: []validator.String{ + stringvalidator.AtLeastOneOf(path.Expressions{ + path.MatchRoot("application_profile_dn"), + }...), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Application Epg object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Application Epg object.`, + }, + "exception_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Contract Exception Tag.`, + }, + "flood_on_encap": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Control at EPG level if the traffic L2 Multicast/Broadcast and Link Local Layer should be flooded only on ENCAP or based on bridg-domain settings.`, + }, + "forwarding_control": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("none", "proxy-arp"), + }, + MarkdownDescription: `Forwarding Control.`, + }, + "has_multicast_source": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `EPg with Multisite Mcast Source.`, + }, + "useg_epg": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Attribute Based EPG.`, + }, + "match_criteria": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("All", "AtleastOne", "AtmostOne", "None"), + }, + MarkdownDescription: `The provider label match criteria.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Application Epg object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Application Epg object.`, + }, + "intra_epg_isolation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("enforced", "unenforced"), + }, + MarkdownDescription: `Represents parameter used by the node (i.e. Leaf) to enforce filter rules in this EPG.`, + }, + "preferred_group_member": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("exclude", "include"), + }, + MarkdownDescription: `Represents parameter used to determine if EPg is part of a group that does not a contract for communication.`, + }, + "priority": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"), + }, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "admin_state": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Withdraw AEPg Configuration from all Nodes in the Fabric.`, + }, + "relation_to_application_epg_monitoring_policy": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the monitoring policy model for the endpoint group semantic scope. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Application Epg Monitoring Policy object.`, + }, + "monitoring_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the monitoring policy.`, + }, + }, + }, + }, + "relation_to_bridge_domain": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to the bridge domain associated to this endpoint group. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Bridge Domain object.`, + }, + "bridge_domain_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the bridge domain associated with this EPG.`, + }, + }, + }, + }, + "relation_to_consumed_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `The Consumer contract profile information.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Consumed Contract object.`, + }, + "priority": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"), + }, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "contract_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The consumer contract name.`, + }, + }, + }, + }, + "relation_to_imported_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `A contract for which the EPG will be a consumer.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Imported Contract object.`, + }, + "priority": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"), + }, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "imported_contract_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The contract interface name.`, + }, + }, + }, + }, + "relation_to_custom_qos_policy": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to a custom QoS policy that enables different levels of service to be assigned to network traffic, including specifications for the Differentiated Services Code Point (DSCP) value(s) and the 802.1p Dot1p priority. This is an internal object.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Custom Qos Policy object.`, + }, + "custom_qos_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The Custom QoS traffic policy name.`, + }, + }, + }, + }, + "relation_to_domains": schema.SetNestedAttribute{ + MarkdownDescription: `An EPG can be linked to a domain profile via the Associated Domain Profiles. The domain profiles attached can be VMM, Physical, L2 External, or L3 External Domains.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Domain object.`, + }, + "binding_type": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("dynamicBinding", "ephemeral", "none", "staticBinding"), + }, + MarkdownDescription: `Binding type for ports.`, + }, + "class_preference": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("encap", "useg"), + }, + MarkdownDescription: `classPref.`, + }, + "custom_epg_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `User-configured port-group display name.`, + }, + "delimiter": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `delimiter.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The port encapsulation.`, + }, + "encapsulation_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("auto", "vlan", "vxlan"), + }, + MarkdownDescription: `encapMode.`, + }, + "epg_cos": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("Cos0", "Cos1", "Cos2", "Cos3", "Cos4", "Cos5", "Cos6", "Cos7"), + }, + MarkdownDescription: `Represents Epg Cos for AVS.`, + }, + "epg_cos_pref": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Represents parameter used to enable/disable Epg Cos Policy.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM.`, + }, + "ipam_dhcp_override": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `ipamDhcpOverride.`, + }, + "ipam_enabled": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `ipamEnabled.`, + }, + "ipam_gateway": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `ipamGateway.`, + }, + "lag_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `LAG Policy Name.`, + }, + "netflow_direction": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("both", "egress", "ingress"), + }, + MarkdownDescription: `Represents NetFlow monitoring direction.`, + }, + "enable_netflow": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Represents parameter used to enable/disable Netflow Policy.`, + }, + "number_of_ports": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Number of ports for binding type.`, + }, + "port_allocation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("elastic", "fixed", "none"), + }, + MarkdownDescription: `Port allocation for ports.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "primary_encapsulation_inner": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `primaryEncapInner.`, + }, + "resolve_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy", "pre-provision"), + }, + MarkdownDescription: `Specifies if policies are to be resolved immmediately or when needed.`, + }, + "secondary_encapsulation_inner": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `secondaryEncapInner.`, + }, + "switching_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("AVE", "native"), + }, + MarkdownDescription: `switchingMode.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name of the Physical Domain Profile.`, + }, + "untagged": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `untagged.`, + }, + "vnet_only": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `vnetOnly.`, + }, + }, + }, + }, + "relation_to_data_plane_policing_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relationship for Dpp QOS policy`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Data Plane Policing Policy object.`, + }, + "data_plane_policing_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Name.`, + }, + }, + }, + }, + "relation_to_fibre_channel_paths": schema.SetNestedAttribute{ + MarkdownDescription: `this object is used for creation of static association + with a Path for fcoe. Existence of this implies that the + corresponding set of policies will be resolved into the + node to which the relationship points.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Fibre Channel Path object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Fibre Channel Path object.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The distinguished name of the target.`, + }, + "vsan": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `port vsan.`, + }, + "vsan_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular"), + }, + MarkdownDescription: `vsanMode.`, + }, + }, + }, + }, + "relation_to_intra_epg_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `Intra EPg contract: + Represents that the EPg is moving from "allow all within epg" mode + to a "deny all within epg" mode. + The only type of traffic allowed between EPs in this EPg is the one + specified by contracts EPg associates to with this relation.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Intra Epg Contract object.`, + }, + "contract_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The contract name.`, + }, + }, + }, + }, + "relation_to_static_leafs": schema.SetNestedAttribute{ + MarkdownDescription: `The static association with an access group is a bundled or unbundled group of ports. The existence of this object implies that the corresponding set of policies will be resolved into the node to which the relationship points.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Static Leaf object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Static Leaf object.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The encapsulation method (VLAN) for the static binding.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `null.`, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular", "untagged"), + }, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The distinguished name of the target of this static binding.`, + }, + }, + }, + }, + "relation_to_static_paths": schema.SetNestedAttribute{ + MarkdownDescription: `A source relation to an abstraction of a path endpoint.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Static Path object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Static Path object.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The encapsulation method (VLAN) of the path.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `The deployment immediacy preference of this path association.`, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular", "untagged"), + }, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `null.`, + }, + }, + }, + }, + "relation_to_taboo_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `The taboo contract for which the EPG will be a provider and consumer.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Taboo Contract object.`, + }, + "taboo_contract_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A contract for denying specific classes of traffic. Taboo rules are applied in the hardware before applying the rules of regular contracts. Without a contract, the default forwarding policy is to not allow any communication between EPGs.`, + }, + }, + }, + }, + "relation_to_provided_contracts": schema.SetNestedAttribute{ + MarkdownDescription: `A contract for which the EPG will be a provider.`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Provided Contract object.`, + }, + "match_criteria": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("All", "AtleastOne", "AtmostOne", "None"), + }, + MarkdownDescription: `The provider label match criteria.`, + }, + "priority": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("level1", "level2", "level3", "level4", "level5", "level6", "unspecified"), + }, + MarkdownDescription: `The Quality of Service (QoS) priority class ID. QoS refers to the capability of a network to provide better service to selected network traffic over various technologies. The primary goal of QoS is to provide priority including dedicated bandwidth, controlled jitter and latency (required by some real-time and interactive traffic), and improved loss characteristics. You can configure the bandwidth of each QoS level using QoS profiles.`, + }, + "contract_name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The provider contract name.`, + }, + }, + }, + }, + "relation_to_contract_masters": schema.SetNestedAttribute{ + MarkdownDescription: `Represents that the EPg is inheriting security configuration from another EPg`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Contract Master object.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The distinguished name of the target.`, + }, + }, + }, + }, + "relation_to_trust_control_policy": schema.SetNestedAttribute{ + MarkdownDescription: `Relationship for FHS trust control`, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.Set{ + setvalidator.SizeAtMost(1), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The annotation of the Relation To Trust Control Policy object.`, + }, + "trust_control_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Name.`, + }, + }, + }, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + Blocks: map[string]schema.Block{ + "relation_fv_rs_node_att": schema.SetNestedBlock{ + NestedObject: schema.NestedBlockObject{ + Attributes: map[string]schema.Attribute{ + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'deployment_immediacy' will be deprecated soon, please use 'relation_to_static_leafs.deployment_immediacy' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_leafs"), + }...), + }, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'description' will be deprecated soon, please use 'relation_to_static_leafs.description' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_leafs"), + }...), + }, + }, + "encap": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'encap' will be deprecated soon, please use 'relation_to_static_leafs.encapsulation' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_leafs"), + }...), + }, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'mode' will be deprecated soon, please use 'relation_to_static_leafs.mode' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_leafs"), + }...), + }, + }, + "node_dn": schema.StringAttribute{ + Optional: true, + Computed: true, + DeprecationMessage: "Attribute 'node_dn' will be deprecated soon, please use 'relation_to_static_leafs.target_dn' instead", + Validators: []validator.String{ + stringvalidator.ConflictsWith(path.Expressions{ + path.MatchRoot("relation_to_static_leafs"), + }...), + }, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_application_epg") +} + +func (r *FvAEPgResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_application_epg") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_application_epg") +} + +func (r *FvAEPgResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_application_epg") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvAEPgResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvAEPgId(ctx, stateData) + getAndSetFvAEPgAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvAEPgResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvAEPgId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_application_epg with id '%s'", data.Id.ValueString())) + + var fvRsAEPgMonPolPlan, fvRsAEPgMonPolState []FvRsAEPgMonPolFvAEPgResourceModel + data.FvRsAEPgMonPol.ElementsAs(ctx, &fvRsAEPgMonPolPlan, false) + stateData.FvRsAEPgMonPol.ElementsAs(ctx, &fvRsAEPgMonPolState, false) + var fvRsBdPlan, fvRsBdState []FvRsBdFvAEPgResourceModel + data.FvRsBd.ElementsAs(ctx, &fvRsBdPlan, false) + stateData.FvRsBd.ElementsAs(ctx, &fvRsBdState, false) + var fvRsConsPlan, fvRsConsState []FvRsConsFvAEPgResourceModel + data.FvRsCons.ElementsAs(ctx, &fvRsConsPlan, false) + stateData.FvRsCons.ElementsAs(ctx, &fvRsConsState, false) + var fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfFvAEPgResourceModel + data.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfPlan, false) + stateData.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfState, false) + var fvRsCustQosPolPlan, fvRsCustQosPolState []FvRsCustQosPolFvAEPgResourceModel + data.FvRsCustQosPol.ElementsAs(ctx, &fvRsCustQosPolPlan, false) + stateData.FvRsCustQosPol.ElementsAs(ctx, &fvRsCustQosPolState, false) + var fvRsDomAttPlan, fvRsDomAttState []FvRsDomAttFvAEPgResourceModel + data.FvRsDomAtt.ElementsAs(ctx, &fvRsDomAttPlan, false) + stateData.FvRsDomAtt.ElementsAs(ctx, &fvRsDomAttState, false) + var fvRsDppPolPlan, fvRsDppPolState []FvRsDppPolFvAEPgResourceModel + data.FvRsDppPol.ElementsAs(ctx, &fvRsDppPolPlan, false) + stateData.FvRsDppPol.ElementsAs(ctx, &fvRsDppPolState, false) + var fvRsFcPathAttPlan, fvRsFcPathAttState []FvRsFcPathAttFvAEPgResourceModel + data.FvRsFcPathAtt.ElementsAs(ctx, &fvRsFcPathAttPlan, false) + stateData.FvRsFcPathAtt.ElementsAs(ctx, &fvRsFcPathAttState, false) + var fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgFvAEPgResourceModel + data.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgPlan, false) + stateData.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgState, false) + var fvRsNodeAttPlan, fvRsNodeAttState []FvRsNodeAttFvAEPgResourceModel + data.FvRsNodeAtt.ElementsAs(ctx, &fvRsNodeAttPlan, false) + stateData.FvRsNodeAtt.ElementsAs(ctx, &fvRsNodeAttState, false) + var fvRsPathAttPlan, fvRsPathAttState []FvRsPathAttFvAEPgResourceModel + data.FvRsPathAtt.ElementsAs(ctx, &fvRsPathAttPlan, false) + stateData.FvRsPathAtt.ElementsAs(ctx, &fvRsPathAttState, false) + var fvRsProtByPlan, fvRsProtByState []FvRsProtByFvAEPgResourceModel + data.FvRsProtBy.ElementsAs(ctx, &fvRsProtByPlan, false) + stateData.FvRsProtBy.ElementsAs(ctx, &fvRsProtByState, false) + var fvRsProvPlan, fvRsProvState []FvRsProvFvAEPgResourceModel + data.FvRsProv.ElementsAs(ctx, &fvRsProvPlan, false) + stateData.FvRsProv.ElementsAs(ctx, &fvRsProvState, false) + var fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedFvAEPgResourceModel + data.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedPlan, false) + stateData.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedState, false) + var fvRsTrustCtrlPlan, fvRsTrustCtrlState []FvRsTrustCtrlFvAEPgResourceModel + data.FvRsTrustCtrl.ElementsAs(ctx, &fvRsTrustCtrlPlan, false) + stateData.FvRsTrustCtrl.ElementsAs(ctx, &fvRsTrustCtrlState, false) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvAEPgResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvAEPgResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvAEPgCreateJsonPayload(ctx, &resp.Diagnostics, data, fvRsAEPgMonPolPlan, fvRsAEPgMonPolState, fvRsBdPlan, fvRsBdState, fvRsConsPlan, fvRsConsState, fvRsConsIfPlan, fvRsConsIfState, fvRsCustQosPolPlan, fvRsCustQosPolState, fvRsDomAttPlan, fvRsDomAttState, fvRsDppPolPlan, fvRsDppPolState, fvRsFcPathAttPlan, fvRsFcPathAttState, fvRsIntraEpgPlan, fvRsIntraEpgState, fvRsNodeAttPlan, fvRsNodeAttState, fvRsPathAttPlan, fvRsPathAttState, fvRsProtByPlan, fvRsProtByState, fvRsProvPlan, fvRsProvState, fvRsSecInheritedPlan, fvRsSecInheritedState, fvRsTrustCtrlPlan, fvRsTrustCtrlState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvAEPgAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_application_epg with id '%s'", data.Id.ValueString())) +} + +func (r *FvAEPgResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_application_epg") + var data *FvAEPgResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_application_epg with id '%s'", data.Id.ValueString())) + + getAndSetFvAEPgAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvAEPgResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_application_epg with id '%s'", data.Id.ValueString())) +} + +func (r *FvAEPgResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_application_epg") + var data *FvAEPgResourceModel + var stateData *FvAEPgResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_application_epg with id '%s'", data.Id.ValueString())) + + var fvRsAEPgMonPolPlan, fvRsAEPgMonPolState []FvRsAEPgMonPolFvAEPgResourceModel + data.FvRsAEPgMonPol.ElementsAs(ctx, &fvRsAEPgMonPolPlan, false) + stateData.FvRsAEPgMonPol.ElementsAs(ctx, &fvRsAEPgMonPolState, false) + var fvRsBdPlan, fvRsBdState []FvRsBdFvAEPgResourceModel + data.FvRsBd.ElementsAs(ctx, &fvRsBdPlan, false) + stateData.FvRsBd.ElementsAs(ctx, &fvRsBdState, false) + var fvRsConsPlan, fvRsConsState []FvRsConsFvAEPgResourceModel + data.FvRsCons.ElementsAs(ctx, &fvRsConsPlan, false) + stateData.FvRsCons.ElementsAs(ctx, &fvRsConsState, false) + var fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfFvAEPgResourceModel + data.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfPlan, false) + stateData.FvRsConsIf.ElementsAs(ctx, &fvRsConsIfState, false) + var fvRsCustQosPolPlan, fvRsCustQosPolState []FvRsCustQosPolFvAEPgResourceModel + data.FvRsCustQosPol.ElementsAs(ctx, &fvRsCustQosPolPlan, false) + stateData.FvRsCustQosPol.ElementsAs(ctx, &fvRsCustQosPolState, false) + var fvRsDomAttPlan, fvRsDomAttState []FvRsDomAttFvAEPgResourceModel + data.FvRsDomAtt.ElementsAs(ctx, &fvRsDomAttPlan, false) + stateData.FvRsDomAtt.ElementsAs(ctx, &fvRsDomAttState, false) + var fvRsDppPolPlan, fvRsDppPolState []FvRsDppPolFvAEPgResourceModel + data.FvRsDppPol.ElementsAs(ctx, &fvRsDppPolPlan, false) + stateData.FvRsDppPol.ElementsAs(ctx, &fvRsDppPolState, false) + var fvRsFcPathAttPlan, fvRsFcPathAttState []FvRsFcPathAttFvAEPgResourceModel + data.FvRsFcPathAtt.ElementsAs(ctx, &fvRsFcPathAttPlan, false) + stateData.FvRsFcPathAtt.ElementsAs(ctx, &fvRsFcPathAttState, false) + var fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgFvAEPgResourceModel + data.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgPlan, false) + stateData.FvRsIntraEpg.ElementsAs(ctx, &fvRsIntraEpgState, false) + var fvRsNodeAttPlan, fvRsNodeAttState []FvRsNodeAttFvAEPgResourceModel + data.FvRsNodeAtt.ElementsAs(ctx, &fvRsNodeAttPlan, false) + stateData.FvRsNodeAtt.ElementsAs(ctx, &fvRsNodeAttState, false) + var fvRsPathAttPlan, fvRsPathAttState []FvRsPathAttFvAEPgResourceModel + data.FvRsPathAtt.ElementsAs(ctx, &fvRsPathAttPlan, false) + stateData.FvRsPathAtt.ElementsAs(ctx, &fvRsPathAttState, false) + var fvRsProtByPlan, fvRsProtByState []FvRsProtByFvAEPgResourceModel + data.FvRsProtBy.ElementsAs(ctx, &fvRsProtByPlan, false) + stateData.FvRsProtBy.ElementsAs(ctx, &fvRsProtByState, false) + var fvRsProvPlan, fvRsProvState []FvRsProvFvAEPgResourceModel + data.FvRsProv.ElementsAs(ctx, &fvRsProvPlan, false) + stateData.FvRsProv.ElementsAs(ctx, &fvRsProvState, false) + var fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedFvAEPgResourceModel + data.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedPlan, false) + stateData.FvRsSecInherited.ElementsAs(ctx, &fvRsSecInheritedState, false) + var fvRsTrustCtrlPlan, fvRsTrustCtrlState []FvRsTrustCtrlFvAEPgResourceModel + data.FvRsTrustCtrl.ElementsAs(ctx, &fvRsTrustCtrlPlan, false) + stateData.FvRsTrustCtrl.ElementsAs(ctx, &fvRsTrustCtrlState, false) + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvAEPgResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvAEPgResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvAEPgCreateJsonPayload(ctx, &resp.Diagnostics, data, fvRsAEPgMonPolPlan, fvRsAEPgMonPolState, fvRsBdPlan, fvRsBdState, fvRsConsPlan, fvRsConsState, fvRsConsIfPlan, fvRsConsIfState, fvRsCustQosPolPlan, fvRsCustQosPolState, fvRsDomAttPlan, fvRsDomAttState, fvRsDppPolPlan, fvRsDppPolState, fvRsFcPathAttPlan, fvRsFcPathAttState, fvRsIntraEpgPlan, fvRsIntraEpgState, fvRsNodeAttPlan, fvRsNodeAttState, fvRsPathAttPlan, fvRsPathAttState, fvRsProtByPlan, fvRsProtByState, fvRsProvPlan, fvRsProvState, fvRsSecInheritedPlan, fvRsSecInheritedState, fvRsTrustCtrlPlan, fvRsTrustCtrlState, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvAEPgAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_application_epg with id '%s'", data.Id.ValueString())) +} + +func (r *FvAEPgResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_application_epg") + var data *FvAEPgResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_application_epg with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvAEPg", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_application_epg with id '%s'", data.Id.ValueString())) +} + +func (r *FvAEPgResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_application_epg") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvAEPgResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_application_epg with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_application_epg") +} + +func getAndSetFvAEPgAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvAEPgResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvAEPg,fvRsAEPgMonPol,fvRsBd,fvRsCons,fvRsConsIf,fvRsCustQosPol,fvRsDomAtt,fvRsDppPol,fvRsFcPathAtt,fvRsIntraEpg,fvRsNodeAtt,fvRsPathAtt,fvRsProtBy,fvRsProv,fvRsSecInherited,fvRsTrustCtrl,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvAEPg").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvAEPg").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvAEPgParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "exceptionTag" { + data.ExceptionTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "floodOnEncap" { + data.FloodOnEncap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "fwdCtrl" && attributeValue.(string) == "" { + data.FwdCtrl = basetypes.NewStringValue("none") + } else if attributeName == "fwdCtrl" { + data.FwdCtrl = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hasMcastSource" { + data.HasMcastSource = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "isAttrBasedEPg" { + data.IsAttrBasedEPg = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "matchT" { + data.MatchT = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "pcEnfPref" { + data.PcEnfPref = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "prefGrMemb" { + data.PrefGrMemb = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "prio" { + data.Prio = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "shutdown" { + data.Shutdown = basetypes.NewStringValue(attributeValue.(string)) + } + } + FvRsAEPgMonPolFvAEPgList := make([]FvRsAEPgMonPolFvAEPgResourceModel, 1) + FvRsBdFvAEPgList := make([]FvRsBdFvAEPgResourceModel, 1) + FvRsConsFvAEPgList := make([]FvRsConsFvAEPgResourceModel, 0) + FvRsConsIfFvAEPgList := make([]FvRsConsIfFvAEPgResourceModel, 0) + FvRsCustQosPolFvAEPgList := make([]FvRsCustQosPolFvAEPgResourceModel, 1) + FvRsDomAttFvAEPgList := make([]FvRsDomAttFvAEPgResourceModel, 0) + FvRsDppPolFvAEPgList := make([]FvRsDppPolFvAEPgResourceModel, 1) + FvRsFcPathAttFvAEPgList := make([]FvRsFcPathAttFvAEPgResourceModel, 0) + FvRsIntraEpgFvAEPgList := make([]FvRsIntraEpgFvAEPgResourceModel, 0) + FvRsNodeAttFvAEPgList := make([]FvRsNodeAttFvAEPgResourceModel, 0) + FvRsPathAttFvAEPgList := make([]FvRsPathAttFvAEPgResourceModel, 0) + FvRsProtByFvAEPgList := make([]FvRsProtByFvAEPgResourceModel, 0) + FvRsProvFvAEPgList := make([]FvRsProvFvAEPgResourceModel, 0) + FvRsSecInheritedFvAEPgList := make([]FvRsSecInheritedFvAEPgResourceModel, 0) + FvRsTrustCtrlFvAEPgList := make([]FvRsTrustCtrlFvAEPgResourceModel, 1) + TagAnnotationFvAEPgList := make([]TagAnnotationFvAEPgResourceModel, 0) + TagTagFvAEPgList := make([]TagTagFvAEPgResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "fvRsAEPgMonPol" { + FvRsAEPgMonPolFvAEPg := FvRsAEPgMonPolFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsAEPgMonPolFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnMonEPGPolName" { + FvRsAEPgMonPolFvAEPg.TnMonEPGPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsAEPgMonPolFvAEPgList[0] = FvRsAEPgMonPolFvAEPg + } + if childClassName == "fvRsBd" { + FvRsBdFvAEPg := FvRsBdFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsBdFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnFvBDName" { + FvRsBdFvAEPg.TnFvBDName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsBdFvAEPgList[0] = FvRsBdFvAEPg + } + if childClassName == "fvRsCons" { + FvRsConsFvAEPg := FvRsConsFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsConsFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "prio" { + FvRsConsFvAEPg.Prio = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnVzBrCPName" { + FvRsConsFvAEPg.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsConsFvAEPgList = append(FvRsConsFvAEPgList, FvRsConsFvAEPg) + } + if childClassName == "fvRsConsIf" { + FvRsConsIfFvAEPg := FvRsConsIfFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsConsIfFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "prio" { + FvRsConsIfFvAEPg.Prio = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnVzCPIfName" { + FvRsConsIfFvAEPg.TnVzCPIfName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsConsIfFvAEPgList = append(FvRsConsIfFvAEPgList, FvRsConsIfFvAEPg) + } + if childClassName == "fvRsCustQosPol" { + FvRsCustQosPolFvAEPg := FvRsCustQosPolFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsCustQosPolFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnQosCustomPolName" { + FvRsCustQosPolFvAEPg.TnQosCustomPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsCustQosPolFvAEPgList[0] = FvRsCustQosPolFvAEPg + } + if childClassName == "fvRsDomAtt" { + FvRsDomAttFvAEPg := FvRsDomAttFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsDomAttFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "bindingType" && childAttributeValue.(string) == "" { + FvRsDomAttFvAEPg.BindingType = basetypes.NewStringValue("none") + } else if childAttributeName == "bindingType" { + FvRsDomAttFvAEPg.BindingType = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "classPref" { + FvRsDomAttFvAEPg.ClassPref = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "customEpgName" { + FvRsDomAttFvAEPg.CustomEpgName = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "delimiter" { + FvRsDomAttFvAEPg.Delimiter = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "encap" { + FvRsDomAttFvAEPg.Encap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "encapMode" { + FvRsDomAttFvAEPg.EncapMode = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "epgCos" { + FvRsDomAttFvAEPg.EpgCos = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "epgCosPref" { + FvRsDomAttFvAEPg.EpgCosPref = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "instrImedcy" { + FvRsDomAttFvAEPg.InstrImedcy = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ipamDhcpOverride" { + FvRsDomAttFvAEPg.IpamDhcpOverride = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ipamEnabled" { + FvRsDomAttFvAEPg.IpamEnabled = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "ipamGateway" { + FvRsDomAttFvAEPg.IpamGateway = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "lagPolicyName" { + FvRsDomAttFvAEPg.LagPolicyName = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "netflowDir" { + FvRsDomAttFvAEPg.NetflowDir = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "netflowPref" { + FvRsDomAttFvAEPg.NetflowPref = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "numPorts" { + FvRsDomAttFvAEPg.NumPorts = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "portAllocation" && childAttributeValue.(string) == "" { + FvRsDomAttFvAEPg.PortAllocation = basetypes.NewStringValue("none") + } else if childAttributeName == "portAllocation" { + FvRsDomAttFvAEPg.PortAllocation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "primaryEncap" { + FvRsDomAttFvAEPg.PrimaryEncap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "primaryEncapInner" { + FvRsDomAttFvAEPg.PrimaryEncapInner = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "resImedcy" { + FvRsDomAttFvAEPg.ResImedcy = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "secondaryEncapInner" { + FvRsDomAttFvAEPg.SecondaryEncapInner = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "switchingMode" { + FvRsDomAttFvAEPg.SwitchingMode = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tDn" { + FvRsDomAttFvAEPg.TDn = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "untagged" { + FvRsDomAttFvAEPg.Untagged = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "vnetOnly" { + FvRsDomAttFvAEPg.VnetOnly = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsDomAttFvAEPgList = append(FvRsDomAttFvAEPgList, FvRsDomAttFvAEPg) + } + if childClassName == "fvRsDppPol" { + FvRsDppPolFvAEPg := FvRsDppPolFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsDppPolFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnQosDppPolName" { + FvRsDppPolFvAEPg.TnQosDppPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsDppPolFvAEPgList[0] = FvRsDppPolFvAEPg + } + if childClassName == "fvRsFcPathAtt" { + FvRsFcPathAttFvAEPg := FvRsFcPathAttFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsFcPathAttFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FvRsFcPathAttFvAEPg.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tDn" { + FvRsFcPathAttFvAEPg.TDn = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "vsan" { + FvRsFcPathAttFvAEPg.Vsan = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "vsanMode" { + FvRsFcPathAttFvAEPg.VsanMode = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsFcPathAttFvAEPgList = append(FvRsFcPathAttFvAEPgList, FvRsFcPathAttFvAEPg) + } + if childClassName == "fvRsIntraEpg" { + FvRsIntraEpgFvAEPg := FvRsIntraEpgFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsIntraEpgFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnVzBrCPName" { + FvRsIntraEpgFvAEPg.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsIntraEpgFvAEPgList = append(FvRsIntraEpgFvAEPgList, FvRsIntraEpgFvAEPg) + } + if childClassName == "fvRsNodeAtt" { + FvRsNodeAttFvAEPg := FvRsNodeAttFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsNodeAttFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FvRsNodeAttFvAEPg.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "encap" { + FvRsNodeAttFvAEPg.Encap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "instrImedcy" { + FvRsNodeAttFvAEPg.InstrImedcy = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "mode" { + FvRsNodeAttFvAEPg.Mode = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tDn" { + FvRsNodeAttFvAEPg.TDn = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsNodeAttFvAEPgList = append(FvRsNodeAttFvAEPgList, FvRsNodeAttFvAEPg) + } + if childClassName == "fvRsPathAtt" { + FvRsPathAttFvAEPg := FvRsPathAttFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsPathAttFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "descr" { + FvRsPathAttFvAEPg.Descr = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "encap" { + FvRsPathAttFvAEPg.Encap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "instrImedcy" { + FvRsPathAttFvAEPg.InstrImedcy = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "mode" { + FvRsPathAttFvAEPg.Mode = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "primaryEncap" { + FvRsPathAttFvAEPg.PrimaryEncap = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tDn" { + FvRsPathAttFvAEPg.TDn = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsPathAttFvAEPgList = append(FvRsPathAttFvAEPgList, FvRsPathAttFvAEPg) + } + if childClassName == "fvRsProtBy" { + FvRsProtByFvAEPg := FvRsProtByFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsProtByFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnVzTabooName" { + FvRsProtByFvAEPg.TnVzTabooName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsProtByFvAEPgList = append(FvRsProtByFvAEPgList, FvRsProtByFvAEPg) + } + if childClassName == "fvRsProv" { + FvRsProvFvAEPg := FvRsProvFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsProvFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "matchT" { + FvRsProvFvAEPg.MatchT = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "prio" { + FvRsProvFvAEPg.Prio = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnVzBrCPName" { + FvRsProvFvAEPg.TnVzBrCPName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsProvFvAEPgList = append(FvRsProvFvAEPgList, FvRsProvFvAEPg) + } + if childClassName == "fvRsSecInherited" { + FvRsSecInheritedFvAEPg := FvRsSecInheritedFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsSecInheritedFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tDn" { + FvRsSecInheritedFvAEPg.TDn = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsSecInheritedFvAEPgList = append(FvRsSecInheritedFvAEPgList, FvRsSecInheritedFvAEPg) + } + if childClassName == "fvRsTrustCtrl" { + FvRsTrustCtrlFvAEPg := FvRsTrustCtrlFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "annotation" { + FvRsTrustCtrlFvAEPg.Annotation = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "tnFhsTrustCtrlPolName" { + FvRsTrustCtrlFvAEPg.TnFhsTrustCtrlPolName = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + FvRsTrustCtrlFvAEPgList[0] = FvRsTrustCtrlFvAEPg + } + if childClassName == "tagAnnotation" { + TagAnnotationFvAEPg := TagAnnotationFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvAEPg.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvAEPg.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvAEPgList = append(TagAnnotationFvAEPgList, TagAnnotationFvAEPg) + } + if childClassName == "tagTag" { + TagTagFvAEPg := TagTagFvAEPgResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvAEPg.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvAEPg.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvAEPgList = append(TagTagFvAEPgList, TagTagFvAEPg) + } + } + } + } + fvRsAEPgMonPolSet, _ := types.SetValueFrom(ctx, data.FvRsAEPgMonPol.ElementType(ctx), FvRsAEPgMonPolFvAEPgList) + data.FvRsAEPgMonPol = fvRsAEPgMonPolSet + fvRsBdSet, _ := types.SetValueFrom(ctx, data.FvRsBd.ElementType(ctx), FvRsBdFvAEPgList) + data.FvRsBd = fvRsBdSet + fvRsConsSet, _ := types.SetValueFrom(ctx, data.FvRsCons.ElementType(ctx), FvRsConsFvAEPgList) + data.FvRsCons = fvRsConsSet + fvRsConsIfSet, _ := types.SetValueFrom(ctx, data.FvRsConsIf.ElementType(ctx), FvRsConsIfFvAEPgList) + data.FvRsConsIf = fvRsConsIfSet + fvRsCustQosPolSet, _ := types.SetValueFrom(ctx, data.FvRsCustQosPol.ElementType(ctx), FvRsCustQosPolFvAEPgList) + data.FvRsCustQosPol = fvRsCustQosPolSet + fvRsDomAttSet, _ := types.SetValueFrom(ctx, data.FvRsDomAtt.ElementType(ctx), FvRsDomAttFvAEPgList) + data.FvRsDomAtt = fvRsDomAttSet + fvRsDppPolSet, _ := types.SetValueFrom(ctx, data.FvRsDppPol.ElementType(ctx), FvRsDppPolFvAEPgList) + data.FvRsDppPol = fvRsDppPolSet + fvRsFcPathAttSet, _ := types.SetValueFrom(ctx, data.FvRsFcPathAtt.ElementType(ctx), FvRsFcPathAttFvAEPgList) + data.FvRsFcPathAtt = fvRsFcPathAttSet + fvRsIntraEpgSet, _ := types.SetValueFrom(ctx, data.FvRsIntraEpg.ElementType(ctx), FvRsIntraEpgFvAEPgList) + data.FvRsIntraEpg = fvRsIntraEpgSet + fvRsNodeAttSet, _ := types.SetValueFrom(ctx, data.FvRsNodeAtt.ElementType(ctx), FvRsNodeAttFvAEPgList) + data.FvRsNodeAtt = fvRsNodeAttSet + fvRsPathAttSet, _ := types.SetValueFrom(ctx, data.FvRsPathAtt.ElementType(ctx), FvRsPathAttFvAEPgList) + data.FvRsPathAtt = fvRsPathAttSet + fvRsProtBySet, _ := types.SetValueFrom(ctx, data.FvRsProtBy.ElementType(ctx), FvRsProtByFvAEPgList) + data.FvRsProtBy = fvRsProtBySet + fvRsProvSet, _ := types.SetValueFrom(ctx, data.FvRsProv.ElementType(ctx), FvRsProvFvAEPgList) + data.FvRsProv = fvRsProvSet + fvRsSecInheritedSet, _ := types.SetValueFrom(ctx, data.FvRsSecInherited.ElementType(ctx), FvRsSecInheritedFvAEPgList) + data.FvRsSecInherited = fvRsSecInheritedSet + fvRsTrustCtrlSet, _ := types.SetValueFrom(ctx, data.FvRsTrustCtrl.ElementType(ctx), FvRsTrustCtrlFvAEPgList) + data.FvRsTrustCtrl = fvRsTrustCtrlSet + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvAEPgList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvAEPgList) + data.TagTag = tagTagSet + setFvAEPgLegacyAttributes(ctx, diags, data, classReadInfo) + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvAEPg'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvAEPgRn(ctx context.Context, data *FvAEPgResourceModel) string { + rn := "epg-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvAEPgParentDn(ctx context.Context, dn string, data *FvAEPgResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvAEPgId(ctx context.Context, data *FvAEPgResourceModel) { + rn := getFvAEPgRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvAEPgFvRsAEPgMonPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsAEPgMonPolPlan, fvRsAEPgMonPolState []FvRsAEPgMonPolFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsAEPgMonPol.IsUnknown() { + for _, fvRsAEPgMonPol := range fvRsAEPgMonPolPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsAEPgMonPol.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsAEPgMonPol.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsAEPgMonPol.TnMonEPGPolName.IsUnknown() { + childMap["attributes"]["tnMonEPGPolName"] = fvRsAEPgMonPol.TnMonEPGPolName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsAEPgMonPol": childMap}) + } + if len(fvRsAEPgMonPolPlan) == 0 && len(fvRsAEPgMonPolState) == 1 { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childPayloads = append(childPayloads, map[string]interface{}{"fvRsAEPgMonPol": childMap}) + } + } else { + data.FvRsAEPgMonPol = types.SetNull(data.FvRsAEPgMonPol.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsBdChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsBdPlan, fvRsBdState []FvRsBdFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsBd.IsUnknown() { + for _, fvRsBd := range fvRsBdPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsBd.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsBd.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsBd.TnFvBDName.IsUnknown() { + childMap["attributes"]["tnFvBDName"] = fvRsBd.TnFvBDName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsBd": childMap}) + } + if len(fvRsBdPlan) == 0 && len(fvRsBdState) == 1 { + diags.AddError( + "FvRsBd object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + return nil + } + } else { + data.FvRsBd = types.SetNull(data.FvRsBd.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsConsChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsConsPlan, fvRsConsState []FvRsConsFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsCons.IsUnknown() { + fvRsConsIdentifiers := []FvRsConsIdentifier{} + for _, fvRsCons := range fvRsConsPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsCons.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsCons.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsCons.Prio.IsUnknown() { + childMap["attributes"]["prio"] = fvRsCons.Prio.ValueString() + } + if !fvRsCons.TnVzBrCPName.IsUnknown() { + childMap["attributes"]["tnVzBrCPName"] = fvRsCons.TnVzBrCPName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsCons": childMap}) + fvRsConsIdentifier := FvRsConsIdentifier{} + fvRsConsIdentifier.TnVzBrCPName = fvRsCons.TnVzBrCPName + fvRsConsIdentifiers = append(fvRsConsIdentifiers, fvRsConsIdentifier) + } + for _, fvRsCons := range fvRsConsState { + delete := true + for _, fvRsConsIdentifier := range fvRsConsIdentifiers { + if fvRsConsIdentifier.TnVzBrCPName == fvRsCons.TnVzBrCPName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnVzBrCPName"] = fvRsCons.TnVzBrCPName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsCons": childMap}) + } + } + } else { + data.FvRsCons = types.SetNull(data.FvRsCons.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsConsIfChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsConsIf.IsUnknown() { + fvRsConsIfIdentifiers := []FvRsConsIfIdentifier{} + for _, fvRsConsIf := range fvRsConsIfPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsConsIf.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsConsIf.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsConsIf.Prio.IsUnknown() { + childMap["attributes"]["prio"] = fvRsConsIf.Prio.ValueString() + } + if !fvRsConsIf.TnVzCPIfName.IsUnknown() { + childMap["attributes"]["tnVzCPIfName"] = fvRsConsIf.TnVzCPIfName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsConsIf": childMap}) + fvRsConsIfIdentifier := FvRsConsIfIdentifier{} + fvRsConsIfIdentifier.TnVzCPIfName = fvRsConsIf.TnVzCPIfName + fvRsConsIfIdentifiers = append(fvRsConsIfIdentifiers, fvRsConsIfIdentifier) + } + for _, fvRsConsIf := range fvRsConsIfState { + delete := true + for _, fvRsConsIfIdentifier := range fvRsConsIfIdentifiers { + if fvRsConsIfIdentifier.TnVzCPIfName == fvRsConsIf.TnVzCPIfName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnVzCPIfName"] = fvRsConsIf.TnVzCPIfName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsConsIf": childMap}) + } + } + } else { + data.FvRsConsIf = types.SetNull(data.FvRsConsIf.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsCustQosPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsCustQosPolPlan, fvRsCustQosPolState []FvRsCustQosPolFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsCustQosPol.IsUnknown() { + for _, fvRsCustQosPol := range fvRsCustQosPolPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsCustQosPol.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsCustQosPol.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsCustQosPol.TnQosCustomPolName.IsUnknown() { + childMap["attributes"]["tnQosCustomPolName"] = fvRsCustQosPol.TnQosCustomPolName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsCustQosPol": childMap}) + } + if len(fvRsCustQosPolPlan) == 0 && len(fvRsCustQosPolState) == 1 { + diags.AddError( + "FvRsCustQosPol object cannot be deleted", + "deletion of child is only possible upon deletion of the parent", + ) + return nil + } + } else { + data.FvRsCustQosPol = types.SetNull(data.FvRsCustQosPol.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsDomAttChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsDomAttPlan, fvRsDomAttState []FvRsDomAttFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsDomAtt.IsUnknown() { + fvRsDomAttIdentifiers := []FvRsDomAttIdentifier{} + for _, fvRsDomAtt := range fvRsDomAttPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsDomAtt.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsDomAtt.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsDomAtt.BindingType.IsUnknown() { + childMap["attributes"]["bindingType"] = fvRsDomAtt.BindingType.ValueString() + } + if !fvRsDomAtt.ClassPref.IsUnknown() { + childMap["attributes"]["classPref"] = fvRsDomAtt.ClassPref.ValueString() + } + if !fvRsDomAtt.CustomEpgName.IsUnknown() { + childMap["attributes"]["customEpgName"] = fvRsDomAtt.CustomEpgName.ValueString() + } + if !fvRsDomAtt.Delimiter.IsUnknown() { + childMap["attributes"]["delimiter"] = fvRsDomAtt.Delimiter.ValueString() + } + if !fvRsDomAtt.Encap.IsUnknown() { + childMap["attributes"]["encap"] = fvRsDomAtt.Encap.ValueString() + } + if !fvRsDomAtt.EncapMode.IsUnknown() { + childMap["attributes"]["encapMode"] = fvRsDomAtt.EncapMode.ValueString() + } + if !fvRsDomAtt.EpgCos.IsUnknown() { + childMap["attributes"]["epgCos"] = fvRsDomAtt.EpgCos.ValueString() + } + if !fvRsDomAtt.EpgCosPref.IsUnknown() { + childMap["attributes"]["epgCosPref"] = fvRsDomAtt.EpgCosPref.ValueString() + } + if !fvRsDomAtt.InstrImedcy.IsUnknown() { + childMap["attributes"]["instrImedcy"] = fvRsDomAtt.InstrImedcy.ValueString() + } + if !fvRsDomAtt.IpamDhcpOverride.IsUnknown() { + childMap["attributes"]["ipamDhcpOverride"] = fvRsDomAtt.IpamDhcpOverride.ValueString() + } + if !fvRsDomAtt.IpamEnabled.IsUnknown() { + childMap["attributes"]["ipamEnabled"] = fvRsDomAtt.IpamEnabled.ValueString() + } + if !fvRsDomAtt.IpamGateway.IsUnknown() { + childMap["attributes"]["ipamGateway"] = fvRsDomAtt.IpamGateway.ValueString() + } + if !fvRsDomAtt.LagPolicyName.IsUnknown() { + childMap["attributes"]["lagPolicyName"] = fvRsDomAtt.LagPolicyName.ValueString() + } + if !fvRsDomAtt.NetflowDir.IsUnknown() { + childMap["attributes"]["netflowDir"] = fvRsDomAtt.NetflowDir.ValueString() + } + if !fvRsDomAtt.NetflowPref.IsUnknown() { + childMap["attributes"]["netflowPref"] = fvRsDomAtt.NetflowPref.ValueString() + } + if !fvRsDomAtt.NumPorts.IsUnknown() { + childMap["attributes"]["numPorts"] = fvRsDomAtt.NumPorts.ValueString() + } + if !fvRsDomAtt.PortAllocation.IsUnknown() { + childMap["attributes"]["portAllocation"] = fvRsDomAtt.PortAllocation.ValueString() + } + if !fvRsDomAtt.PrimaryEncap.IsUnknown() { + childMap["attributes"]["primaryEncap"] = fvRsDomAtt.PrimaryEncap.ValueString() + } + if !fvRsDomAtt.PrimaryEncapInner.IsUnknown() { + childMap["attributes"]["primaryEncapInner"] = fvRsDomAtt.PrimaryEncapInner.ValueString() + } + if !fvRsDomAtt.ResImedcy.IsUnknown() { + childMap["attributes"]["resImedcy"] = fvRsDomAtt.ResImedcy.ValueString() + } + if !fvRsDomAtt.SecondaryEncapInner.IsUnknown() { + childMap["attributes"]["secondaryEncapInner"] = fvRsDomAtt.SecondaryEncapInner.ValueString() + } + if !fvRsDomAtt.SwitchingMode.IsUnknown() { + childMap["attributes"]["switchingMode"] = fvRsDomAtt.SwitchingMode.ValueString() + } + if !fvRsDomAtt.TDn.IsUnknown() { + childMap["attributes"]["tDn"] = fvRsDomAtt.TDn.ValueString() + } + if !fvRsDomAtt.Untagged.IsUnknown() { + childMap["attributes"]["untagged"] = fvRsDomAtt.Untagged.ValueString() + } + if !fvRsDomAtt.VnetOnly.IsUnknown() { + childMap["attributes"]["vnetOnly"] = fvRsDomAtt.VnetOnly.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsDomAtt": childMap}) + fvRsDomAttIdentifier := FvRsDomAttIdentifier{} + fvRsDomAttIdentifier.TDn = fvRsDomAtt.TDn + fvRsDomAttIdentifiers = append(fvRsDomAttIdentifiers, fvRsDomAttIdentifier) + } + for _, fvRsDomAtt := range fvRsDomAttState { + delete := true + for _, fvRsDomAttIdentifier := range fvRsDomAttIdentifiers { + if fvRsDomAttIdentifier.TDn == fvRsDomAtt.TDn { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tDn"] = fvRsDomAtt.TDn.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsDomAtt": childMap}) + } + } + } else { + data.FvRsDomAtt = types.SetNull(data.FvRsDomAtt.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsDppPolChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsDppPolPlan, fvRsDppPolState []FvRsDppPolFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsDppPol.IsUnknown() { + for _, fvRsDppPol := range fvRsDppPolPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsDppPol.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsDppPol.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsDppPol.TnQosDppPolName.IsUnknown() { + childMap["attributes"]["tnQosDppPolName"] = fvRsDppPol.TnQosDppPolName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsDppPol": childMap}) + } + if len(fvRsDppPolPlan) == 0 && len(fvRsDppPolState) == 1 { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childPayloads = append(childPayloads, map[string]interface{}{"fvRsDppPol": childMap}) + } + } else { + data.FvRsDppPol = types.SetNull(data.FvRsDppPol.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsFcPathAttChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsFcPathAttPlan, fvRsFcPathAttState []FvRsFcPathAttFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsFcPathAtt.IsUnknown() { + fvRsFcPathAttIdentifiers := []FvRsFcPathAttIdentifier{} + for _, fvRsFcPathAtt := range fvRsFcPathAttPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsFcPathAtt.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsFcPathAtt.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsFcPathAtt.Descr.IsUnknown() { + childMap["attributes"]["descr"] = fvRsFcPathAtt.Descr.ValueString() + } + if !fvRsFcPathAtt.TDn.IsUnknown() { + childMap["attributes"]["tDn"] = fvRsFcPathAtt.TDn.ValueString() + } + if !fvRsFcPathAtt.Vsan.IsUnknown() { + childMap["attributes"]["vsan"] = fvRsFcPathAtt.Vsan.ValueString() + } + if !fvRsFcPathAtt.VsanMode.IsUnknown() { + childMap["attributes"]["vsanMode"] = fvRsFcPathAtt.VsanMode.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsFcPathAtt": childMap}) + fvRsFcPathAttIdentifier := FvRsFcPathAttIdentifier{} + fvRsFcPathAttIdentifier.TDn = fvRsFcPathAtt.TDn + fvRsFcPathAttIdentifiers = append(fvRsFcPathAttIdentifiers, fvRsFcPathAttIdentifier) + } + for _, fvRsFcPathAtt := range fvRsFcPathAttState { + delete := true + for _, fvRsFcPathAttIdentifier := range fvRsFcPathAttIdentifiers { + if fvRsFcPathAttIdentifier.TDn == fvRsFcPathAtt.TDn { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tDn"] = fvRsFcPathAtt.TDn.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsFcPathAtt": childMap}) + } + } + } else { + data.FvRsFcPathAtt = types.SetNull(data.FvRsFcPathAtt.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsIntraEpgChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsIntraEpg.IsUnknown() { + fvRsIntraEpgIdentifiers := []FvRsIntraEpgIdentifier{} + for _, fvRsIntraEpg := range fvRsIntraEpgPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsIntraEpg.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsIntraEpg.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsIntraEpg.TnVzBrCPName.IsUnknown() { + childMap["attributes"]["tnVzBrCPName"] = fvRsIntraEpg.TnVzBrCPName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsIntraEpg": childMap}) + fvRsIntraEpgIdentifier := FvRsIntraEpgIdentifier{} + fvRsIntraEpgIdentifier.TnVzBrCPName = fvRsIntraEpg.TnVzBrCPName + fvRsIntraEpgIdentifiers = append(fvRsIntraEpgIdentifiers, fvRsIntraEpgIdentifier) + } + for _, fvRsIntraEpg := range fvRsIntraEpgState { + delete := true + for _, fvRsIntraEpgIdentifier := range fvRsIntraEpgIdentifiers { + if fvRsIntraEpgIdentifier.TnVzBrCPName == fvRsIntraEpg.TnVzBrCPName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnVzBrCPName"] = fvRsIntraEpg.TnVzBrCPName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsIntraEpg": childMap}) + } + } + } else { + data.FvRsIntraEpg = types.SetNull(data.FvRsIntraEpg.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsNodeAttChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsNodeAttPlan, fvRsNodeAttState []FvRsNodeAttFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsNodeAtt.IsUnknown() { + fvRsNodeAttIdentifiers := []FvRsNodeAttIdentifier{} + for _, fvRsNodeAtt := range fvRsNodeAttPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsNodeAtt.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsNodeAtt.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsNodeAtt.Descr.IsUnknown() { + childMap["attributes"]["descr"] = fvRsNodeAtt.Descr.ValueString() + } + if !fvRsNodeAtt.Encap.IsUnknown() { + childMap["attributes"]["encap"] = fvRsNodeAtt.Encap.ValueString() + } + if !fvRsNodeAtt.InstrImedcy.IsUnknown() { + childMap["attributes"]["instrImedcy"] = fvRsNodeAtt.InstrImedcy.ValueString() + } + if !fvRsNodeAtt.Mode.IsUnknown() { + childMap["attributes"]["mode"] = fvRsNodeAtt.Mode.ValueString() + } + if !fvRsNodeAtt.TDn.IsUnknown() { + childMap["attributes"]["tDn"] = fvRsNodeAtt.TDn.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsNodeAtt": childMap}) + fvRsNodeAttIdentifier := FvRsNodeAttIdentifier{} + fvRsNodeAttIdentifier.TDn = fvRsNodeAtt.TDn + fvRsNodeAttIdentifiers = append(fvRsNodeAttIdentifiers, fvRsNodeAttIdentifier) + } + for _, fvRsNodeAtt := range fvRsNodeAttState { + delete := true + for _, fvRsNodeAttIdentifier := range fvRsNodeAttIdentifiers { + if fvRsNodeAttIdentifier.TDn == fvRsNodeAtt.TDn { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tDn"] = fvRsNodeAtt.TDn.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsNodeAtt": childMap}) + } + } + } else { + data.FvRsNodeAtt = types.SetNull(data.FvRsNodeAtt.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsPathAttChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsPathAttPlan, fvRsPathAttState []FvRsPathAttFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsPathAtt.IsUnknown() { + fvRsPathAttIdentifiers := []FvRsPathAttIdentifier{} + for _, fvRsPathAtt := range fvRsPathAttPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsPathAtt.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsPathAtt.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsPathAtt.Descr.IsUnknown() { + childMap["attributes"]["descr"] = fvRsPathAtt.Descr.ValueString() + } + if !fvRsPathAtt.Encap.IsUnknown() { + childMap["attributes"]["encap"] = fvRsPathAtt.Encap.ValueString() + } + if !fvRsPathAtt.InstrImedcy.IsUnknown() { + childMap["attributes"]["instrImedcy"] = fvRsPathAtt.InstrImedcy.ValueString() + } + if !fvRsPathAtt.Mode.IsUnknown() { + childMap["attributes"]["mode"] = fvRsPathAtt.Mode.ValueString() + } + if !fvRsPathAtt.PrimaryEncap.IsUnknown() { + childMap["attributes"]["primaryEncap"] = fvRsPathAtt.PrimaryEncap.ValueString() + } + if !fvRsPathAtt.TDn.IsUnknown() { + childMap["attributes"]["tDn"] = fvRsPathAtt.TDn.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsPathAtt": childMap}) + fvRsPathAttIdentifier := FvRsPathAttIdentifier{} + fvRsPathAttIdentifier.TDn = fvRsPathAtt.TDn + fvRsPathAttIdentifiers = append(fvRsPathAttIdentifiers, fvRsPathAttIdentifier) + } + for _, fvRsPathAtt := range fvRsPathAttState { + delete := true + for _, fvRsPathAttIdentifier := range fvRsPathAttIdentifiers { + if fvRsPathAttIdentifier.TDn == fvRsPathAtt.TDn { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tDn"] = fvRsPathAtt.TDn.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsPathAtt": childMap}) + } + } + } else { + data.FvRsPathAtt = types.SetNull(data.FvRsPathAtt.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsProtByChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsProtByPlan, fvRsProtByState []FvRsProtByFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsProtBy.IsUnknown() { + fvRsProtByIdentifiers := []FvRsProtByIdentifier{} + for _, fvRsProtBy := range fvRsProtByPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsProtBy.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsProtBy.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsProtBy.TnVzTabooName.IsUnknown() { + childMap["attributes"]["tnVzTabooName"] = fvRsProtBy.TnVzTabooName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsProtBy": childMap}) + fvRsProtByIdentifier := FvRsProtByIdentifier{} + fvRsProtByIdentifier.TnVzTabooName = fvRsProtBy.TnVzTabooName + fvRsProtByIdentifiers = append(fvRsProtByIdentifiers, fvRsProtByIdentifier) + } + for _, fvRsProtBy := range fvRsProtByState { + delete := true + for _, fvRsProtByIdentifier := range fvRsProtByIdentifiers { + if fvRsProtByIdentifier.TnVzTabooName == fvRsProtBy.TnVzTabooName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnVzTabooName"] = fvRsProtBy.TnVzTabooName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsProtBy": childMap}) + } + } + } else { + data.FvRsProtBy = types.SetNull(data.FvRsProtBy.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsProvChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsProvPlan, fvRsProvState []FvRsProvFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsProv.IsUnknown() { + fvRsProvIdentifiers := []FvRsProvIdentifier{} + for _, fvRsProv := range fvRsProvPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsProv.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsProv.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsProv.MatchT.IsUnknown() { + childMap["attributes"]["matchT"] = fvRsProv.MatchT.ValueString() + } + if !fvRsProv.Prio.IsUnknown() { + childMap["attributes"]["prio"] = fvRsProv.Prio.ValueString() + } + if !fvRsProv.TnVzBrCPName.IsUnknown() { + childMap["attributes"]["tnVzBrCPName"] = fvRsProv.TnVzBrCPName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsProv": childMap}) + fvRsProvIdentifier := FvRsProvIdentifier{} + fvRsProvIdentifier.TnVzBrCPName = fvRsProv.TnVzBrCPName + fvRsProvIdentifiers = append(fvRsProvIdentifiers, fvRsProvIdentifier) + } + for _, fvRsProv := range fvRsProvState { + delete := true + for _, fvRsProvIdentifier := range fvRsProvIdentifiers { + if fvRsProvIdentifier.TnVzBrCPName == fvRsProv.TnVzBrCPName { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tnVzBrCPName"] = fvRsProv.TnVzBrCPName.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsProv": childMap}) + } + } + } else { + data.FvRsProv = types.SetNull(data.FvRsProv.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsSecInheritedChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsSecInherited.IsUnknown() { + fvRsSecInheritedIdentifiers := []FvRsSecInheritedIdentifier{} + for _, fvRsSecInherited := range fvRsSecInheritedPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsSecInherited.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsSecInherited.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsSecInherited.TDn.IsUnknown() { + childMap["attributes"]["tDn"] = fvRsSecInherited.TDn.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsSecInherited": childMap}) + fvRsSecInheritedIdentifier := FvRsSecInheritedIdentifier{} + fvRsSecInheritedIdentifier.TDn = fvRsSecInherited.TDn + fvRsSecInheritedIdentifiers = append(fvRsSecInheritedIdentifiers, fvRsSecInheritedIdentifier) + } + for _, fvRsSecInherited := range fvRsSecInheritedState { + delete := true + for _, fvRsSecInheritedIdentifier := range fvRsSecInheritedIdentifiers { + if fvRsSecInheritedIdentifier.TDn == fvRsSecInherited.TDn { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["tDn"] = fvRsSecInherited.TDn.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"fvRsSecInherited": childMap}) + } + } + } else { + data.FvRsSecInherited = types.SetNull(data.FvRsSecInherited.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgFvRsTrustCtrlChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsTrustCtrlPlan, fvRsTrustCtrlState []FvRsTrustCtrlFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.FvRsTrustCtrl.IsUnknown() { + for _, fvRsTrustCtrl := range fvRsTrustCtrlPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !fvRsTrustCtrl.Annotation.IsUnknown() { + childMap["attributes"]["annotation"] = fvRsTrustCtrl.Annotation.ValueString() + } else { + childMap["attributes"]["annotation"] = globalAnnotation + } + if !fvRsTrustCtrl.TnFhsTrustCtrlPolName.IsUnknown() { + childMap["attributes"]["tnFhsTrustCtrlPolName"] = fvRsTrustCtrl.TnFhsTrustCtrlPolName.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"fvRsTrustCtrl": childMap}) + } + if len(fvRsTrustCtrlPlan) == 0 && len(fvRsTrustCtrlState) == 1 { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childPayloads = append(childPayloads, map[string]interface{}{"fvRsTrustCtrl": childMap}) + } + } else { + data.FvRsTrustCtrl = types.SetNull(data.FvRsTrustCtrl.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvAEPgTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, tagTagPlan, tagTagState []TagTagFvAEPgResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvAEPgCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvAEPgResourceModel, fvRsAEPgMonPolPlan, fvRsAEPgMonPolState []FvRsAEPgMonPolFvAEPgResourceModel, fvRsBdPlan, fvRsBdState []FvRsBdFvAEPgResourceModel, fvRsConsPlan, fvRsConsState []FvRsConsFvAEPgResourceModel, fvRsConsIfPlan, fvRsConsIfState []FvRsConsIfFvAEPgResourceModel, fvRsCustQosPolPlan, fvRsCustQosPolState []FvRsCustQosPolFvAEPgResourceModel, fvRsDomAttPlan, fvRsDomAttState []FvRsDomAttFvAEPgResourceModel, fvRsDppPolPlan, fvRsDppPolState []FvRsDppPolFvAEPgResourceModel, fvRsFcPathAttPlan, fvRsFcPathAttState []FvRsFcPathAttFvAEPgResourceModel, fvRsIntraEpgPlan, fvRsIntraEpgState []FvRsIntraEpgFvAEPgResourceModel, fvRsNodeAttPlan, fvRsNodeAttState []FvRsNodeAttFvAEPgResourceModel, fvRsPathAttPlan, fvRsPathAttState []FvRsPathAttFvAEPgResourceModel, fvRsProtByPlan, fvRsProtByState []FvRsProtByFvAEPgResourceModel, fvRsProvPlan, fvRsProvState []FvRsProvFvAEPgResourceModel, fvRsSecInheritedPlan, fvRsSecInheritedState []FvRsSecInheritedFvAEPgResourceModel, fvRsTrustCtrlPlan, fvRsTrustCtrlState []FvRsTrustCtrlFvAEPgResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvAEPgResourceModel, tagTagPlan, tagTagState []TagTagFvAEPgResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + FvRsAEPgMonPolchildPayloads := getFvAEPgFvRsAEPgMonPolChildPayloads(ctx, diags, data, fvRsAEPgMonPolPlan, fvRsAEPgMonPolState) + if FvRsAEPgMonPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsAEPgMonPolchildPayloads...) + + FvRsBdchildPayloads := getFvAEPgFvRsBdChildPayloads(ctx, diags, data, fvRsBdPlan, fvRsBdState) + if FvRsBdchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsBdchildPayloads...) + + FvRsConschildPayloads := getFvAEPgFvRsConsChildPayloads(ctx, diags, data, fvRsConsPlan, fvRsConsState) + if FvRsConschildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsConschildPayloads...) + + FvRsConsIfchildPayloads := getFvAEPgFvRsConsIfChildPayloads(ctx, diags, data, fvRsConsIfPlan, fvRsConsIfState) + if FvRsConsIfchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsConsIfchildPayloads...) + + FvRsCustQosPolchildPayloads := getFvAEPgFvRsCustQosPolChildPayloads(ctx, diags, data, fvRsCustQosPolPlan, fvRsCustQosPolState) + if FvRsCustQosPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsCustQosPolchildPayloads...) + + FvRsDomAttchildPayloads := getFvAEPgFvRsDomAttChildPayloads(ctx, diags, data, fvRsDomAttPlan, fvRsDomAttState) + if FvRsDomAttchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsDomAttchildPayloads...) + + FvRsDppPolchildPayloads := getFvAEPgFvRsDppPolChildPayloads(ctx, diags, data, fvRsDppPolPlan, fvRsDppPolState) + if FvRsDppPolchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsDppPolchildPayloads...) + + FvRsFcPathAttchildPayloads := getFvAEPgFvRsFcPathAttChildPayloads(ctx, diags, data, fvRsFcPathAttPlan, fvRsFcPathAttState) + if FvRsFcPathAttchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsFcPathAttchildPayloads...) + + FvRsIntraEpgchildPayloads := getFvAEPgFvRsIntraEpgChildPayloads(ctx, diags, data, fvRsIntraEpgPlan, fvRsIntraEpgState) + if FvRsIntraEpgchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsIntraEpgchildPayloads...) + + FvRsNodeAttchildPayloads := getFvAEPgFvRsNodeAttChildPayloads(ctx, diags, data, fvRsNodeAttPlan, fvRsNodeAttState) + if FvRsNodeAttchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsNodeAttchildPayloads...) + + FvRsPathAttchildPayloads := getFvAEPgFvRsPathAttChildPayloads(ctx, diags, data, fvRsPathAttPlan, fvRsPathAttState) + if FvRsPathAttchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsPathAttchildPayloads...) + + FvRsProtBychildPayloads := getFvAEPgFvRsProtByChildPayloads(ctx, diags, data, fvRsProtByPlan, fvRsProtByState) + if FvRsProtBychildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsProtBychildPayloads...) + + FvRsProvchildPayloads := getFvAEPgFvRsProvChildPayloads(ctx, diags, data, fvRsProvPlan, fvRsProvState) + if FvRsProvchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsProvchildPayloads...) + + FvRsSecInheritedchildPayloads := getFvAEPgFvRsSecInheritedChildPayloads(ctx, diags, data, fvRsSecInheritedPlan, fvRsSecInheritedState) + if FvRsSecInheritedchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsSecInheritedchildPayloads...) + + FvRsTrustCtrlchildPayloads := getFvAEPgFvRsTrustCtrlChildPayloads(ctx, diags, data, fvRsTrustCtrlPlan, fvRsTrustCtrlState) + if FvRsTrustCtrlchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, FvRsTrustCtrlchildPayloads...) + + TagAnnotationchildPayloads := getFvAEPgTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvAEPgTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.ExceptionTag.IsNull() && !data.ExceptionTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["exceptionTag"] = data.ExceptionTag.ValueString() + } + if !data.FloodOnEncap.IsNull() && !data.FloodOnEncap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["floodOnEncap"] = data.FloodOnEncap.ValueString() + } + if !data.FwdCtrl.IsNull() && !data.FwdCtrl.IsUnknown() { + payloadMap["attributes"].(map[string]string)["fwdCtrl"] = data.FwdCtrl.ValueString() + } + if !data.HasMcastSource.IsNull() && !data.HasMcastSource.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hasMcastSource"] = data.HasMcastSource.ValueString() + } + if !data.IsAttrBasedEPg.IsNull() && !data.IsAttrBasedEPg.IsUnknown() { + payloadMap["attributes"].(map[string]string)["isAttrBasedEPg"] = data.IsAttrBasedEPg.ValueString() + } + if !data.MatchT.IsNull() && !data.MatchT.IsUnknown() { + payloadMap["attributes"].(map[string]string)["matchT"] = data.MatchT.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.PcEnfPref.IsNull() && !data.PcEnfPref.IsUnknown() { + payloadMap["attributes"].(map[string]string)["pcEnfPref"] = data.PcEnfPref.ValueString() + } + if !data.PrefGrMemb.IsNull() && !data.PrefGrMemb.IsUnknown() { + payloadMap["attributes"].(map[string]string)["prefGrMemb"] = data.PrefGrMemb.ValueString() + } + if !data.Prio.IsNull() && !data.Prio.IsUnknown() { + payloadMap["attributes"].(map[string]string)["prio"] = data.Prio.ValueString() + } + if !data.Shutdown.IsNull() && !data.Shutdown.IsUnknown() { + payloadMap["attributes"].(map[string]string)["shutdown"] = data.Shutdown.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvAEPg": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_application_epg_test.go b/internal/provider/resource_aci_application_epg_test.go new file mode 100644 index 000000000..3c4bc3154 --- /dev/null +++ b/internal/provider/resource_aci_application_epg_test.go @@ -0,0 +1,1184 @@ +// 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 TestAccResourceFvAEPgWithFvAp(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: testConfigFvAEPgMinDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "false"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvAEPgAllDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", "description"), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", "exception_tag"), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "proxy-arp"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "enforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "All"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "no"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvAEPgMinDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvAEPgResetDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "false"), + ), + }, + // Import testing + { + ResourceName: "aci_application_epg.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "false"), + ), + }, + // Update with children + { + Config: testConfigFvAEPgChildrenDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.bridge_domain_name", "bridge_domain_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_3"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.custom_qos_policy_name", "custom_qos_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.data_plane_policing_policy_name", "data_plane_policing_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.binding_type", "dynamicBinding"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.class_preference", "encap"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.custom_epg_name", "custom_epg_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.delimiter", "delimiter_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_dhcp_override", "ipam_dhcp_override_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_enabled", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_gateway", "ipam_gateway_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.lag_policy_name", "lag_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.number_of_ports", "number_of_ports_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.port_allocation", "elastic"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation_inner", "primary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.resolve_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.secondary_encapsulation_inner", "secondary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.switching_mode", "AVE"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.untagged", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.vnet_only", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.binding_type", "ephemeral"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.class_preference", "useg"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.custom_epg_name", "custom_epg_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.delimiter", "delimiter_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.enable_netflow", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation_mode", "vlan"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos", "Cos1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos_pref", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_dhcp_override", "ipam_dhcp_override_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_enabled", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_gateway", "ipam_gateway_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.lag_policy_name", "lag_policy_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.netflow_direction", "egress"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.number_of_ports", "number_of_ports_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.port_allocation", "fixed"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation_inner", "primary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.secondary_encapsulation_inner", "secondary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.switching_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.target_dn", "uni/vmmp-VMware/dom-domain_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.untagged", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.vnet_only", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan", "vsan_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan", "vsan_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.imported_contract_name", "imported_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.imported_contract_name", "imported_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.match_criteria", "All"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.target_dn", "topology/pod-1/node-102"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.taboo_contract_name", "taboo_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.taboo_contract_name", "taboo_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.trust_control_policy_name", "trust_control_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_application_epg.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_application_epg.test", "admin_state", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_application_epg.test", "description", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "exception_tag", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "flood_on_encap", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "forwarding_control", "none"), + resource.TestCheckResourceAttr("aci_application_epg.test", "has_multicast_source", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "intra_epg_isolation", "unenforced"), + resource.TestCheckResourceAttr("aci_application_epg.test", "match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_application_epg.test", "preferred_group_member", "exclude"), + resource.TestCheckResourceAttr("aci_application_epg.test", "priority", "unspecified"), + resource.TestCheckResourceAttr("aci_application_epg.test", "useg_epg", "false"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.bridge_domain_name", "bridge_domain_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_3"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.custom_qos_policy_name", "custom_qos_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.data_plane_policing_policy_name", "data_plane_policing_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.binding_type", "dynamicBinding"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.class_preference", "encap"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.custom_epg_name", "custom_epg_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.delimiter", "delimiter_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_dhcp_override", "ipam_dhcp_override_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_enabled", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_gateway", "ipam_gateway_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.lag_policy_name", "lag_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.number_of_ports", "number_of_ports_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.port_allocation", "elastic"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation_inner", "primary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.resolve_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.secondary_encapsulation_inner", "secondary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.switching_mode", "AVE"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.untagged", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.vnet_only", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.binding_type", "ephemeral"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.class_preference", "useg"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.custom_epg_name", "custom_epg_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.delimiter", "delimiter_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.enable_netflow", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation_mode", "vlan"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos", "Cos1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos_pref", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_dhcp_override", "ipam_dhcp_override_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_enabled", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_gateway", "ipam_gateway_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.lag_policy_name", "lag_policy_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.netflow_direction", "egress"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.number_of_ports", "number_of_ports_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.port_allocation", "fixed"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation_inner", "primary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.secondary_encapsulation_inner", "secondary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.switching_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.target_dn", "uni/vmmp-VMware/dom-domain_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.untagged", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.vnet_only", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan", "vsan_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan", "vsan_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.imported_contract_name", "imported_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.imported_contract_name", "imported_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.match_criteria", "All"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.target_dn", "topology/pod-1/node-102"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.taboo_contract_name", "taboo_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.taboo_contract_name", "taboo_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.trust_control_policy_name", "trust_control_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvAEPgChildrenRemoveFromConfigDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.0.monitoring_policy_name", "monitoring_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.bridge_domain_name", "bridge_domain_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.1.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_3"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.custom_qos_policy_name", "custom_qos_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.0.data_plane_policing_policy_name", "data_plane_policing_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.binding_type", "dynamicBinding"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.class_preference", "encap"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.custom_epg_name", "custom_epg_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.delimiter", "delimiter_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_dhcp_override", "ipam_dhcp_override_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_enabled", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_gateway", "ipam_gateway_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.lag_policy_name", "lag_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.number_of_ports", "number_of_ports_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.port_allocation", "elastic"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation_inner", "primary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.resolve_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.secondary_encapsulation_inner", "secondary_encapsulation_inner_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.switching_mode", "AVE"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.untagged", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.vnet_only", "no"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.binding_type", "ephemeral"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.class_preference", "useg"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.custom_epg_name", "custom_epg_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.delimiter", "delimiter_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.enable_netflow", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.encapsulation_mode", "vlan"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos", "Cos1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.epg_cos_pref", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_dhcp_override", "ipam_dhcp_override_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_enabled", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.ipam_gateway", "ipam_gateway_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.lag_policy_name", "lag_policy_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.netflow_direction", "egress"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.number_of_ports", "number_of_ports_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.port_allocation", "fixed"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.primary_encapsulation_inner", "primary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.secondary_encapsulation_inner", "secondary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.switching_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.target_dn", "uni/vmmp-VMware/dom-domain_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.untagged", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.1.vnet_only", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan", "vsan_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan", "vsan_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.1.vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.imported_contract_name", "imported_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.imported_contract_name", "imported_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.contract_name", "contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.match_criteria", "All"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.priority", "level1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.1.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.1.target_dn", "topology/pod-1/node-102"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.description", "description_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.encapsulation", "encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.primary_encapsulation", "primary_encapsulation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.1.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.taboo_contract_name", "taboo_contract_name_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.1.taboo_contract_name", "taboo_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.#", "2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.0.trust_control_policy_name", "trust_control_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvAEPgChildrenRemoveOneDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.bridge_domain_name", "bridge_domain_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.0.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.0.target_dn", "uni/tn-test_tenant/ap-test_ap/epg-epg_3"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.custom_qos_policy_name", "custom_qos_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.binding_type", "ephemeral"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.class_preference", "useg"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.custom_epg_name", "custom_epg_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.delimiter", "delimiter_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.enable_netflow", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.encapsulation_mode", "vlan"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos", "Cos1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.epg_cos_pref", "enabled"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_dhcp_override", "ipam_dhcp_override_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_enabled", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.ipam_gateway", "ipam_gateway_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.lag_policy_name", "lag_policy_name_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.netflow_direction", "egress"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.number_of_ports", "number_of_ports_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.port_allocation", "fixed"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.primary_encapsulation_inner", "primary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.secondary_encapsulation_inner", "secondary_encapsulation_inner_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.switching_mode", "native"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.target_dn", "uni/vmmp-VMware/dom-domain_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.untagged", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.0.vnet_only", "yes"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan", "vsan_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.0.vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.imported_contract_name", "imported_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.0.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.0.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.contract_name", "contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.match_criteria", "AtleastOne"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.0.priority", "level2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.0.target_dn", "topology/pod-1/node-102"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.description", "description_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.encapsulation", "encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.mode", "regular"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.primary_encapsulation", "primary_encapsulation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.0.target_dn", "topology/pod-1/paths-101/pathep-[eth1/2]"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.annotation", "annotation_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.0.taboo_contract_name", "taboo_contract_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvAEPgChildrenRemoveAllDependencyWithFvAp, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_application_epg.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_application_epg_monitoring_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.0.bridge_domain_name", "bridge_domain_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_bridge_domain.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_consumed_contracts.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_contract_masters.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.annotation", "annotation_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.0.custom_qos_policy_name", "custom_qos_policy_name_1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_custom_qos_policy.#", "1"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_data_plane_policing_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_domains.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_fibre_channel_paths.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_imported_contracts.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_intra_epg_contracts.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_provided_contracts.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_leafs.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_static_paths.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_taboo_contracts.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "relation_to_trust_control_policy.#", "0"), + resource.TestCheckResourceAttr("aci_application_epg.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testChildDependencyConfigFvAEPg = ` +resource "aci_" "test_0" { + = +} +resource "aci_" "test_1" { + = +} +resource "aci_" "test_2" { + = +} +resource "aci_" "test_3" { + = +} +resource "aci_" "test_4" { + = +} +resource "aci_" "test_5" { + = +} +resource "aci_" "test_6" { + = +} +resource "aci_" "test_7" { + = +} +resource "aci_application_epg" "test_8" { + application_profile_dn = aci_application_profile.test.id + name = "epg_2" +} +resource "aci_application_epg" "test_9" { + application_profile_dn = aci_application_profile.test.id + name = "epg_3" +} +` + +const testConfigFvAEPgMinDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" +} +` + +const testConfigFvAEPgAllDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + admin_state = "no" + annotation = "annotation" + description = "description" + exception_tag = "exception_tag" + flood_on_encap = "disabled" + forwarding_control = "proxy-arp" + has_multicast_source = "no" + intra_epg_isolation = "enforced" + match_criteria = "All" + name_alias = "name_alias" + preferred_group_member = "exclude" + priority = "level1" + useg_epg = "no" +} +` + +const testConfigFvAEPgResetDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + admin_state = "no" + annotation = "orchestrator:terraform" + description = "" + exception_tag = "" + flood_on_encap = "disabled" + forwarding_control = "none" + has_multicast_source = "false" + intra_epg_isolation = "unenforced" + match_criteria = "AtleastOne" + name_alias = "" + preferred_group_member = "exclude" + priority = "unspecified" + useg_epg = "false" +} +` +const testConfigFvAEPgChildrenDependencyWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + annotations = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] + relation_to_application_epg_monitoring_policy = [ + { + annotation = "annotation_1" + monitoring_policy_name = "monitoring_policy_name_1" + }, + ] + relation_to_bridge_domain = [ + { + annotation = "annotation_1" + bridge_domain_name = "bridge_domain_name_1" + }, + ] + relation_to_consumed_contracts = [ + { + annotation = "annotation_1" + contract_name = "contract_name_0" + priority = "level1" + }, + { + annotation = "annotation_2" + contract_name = "contract_name_1" + priority = "level2" + }, + ] + relation_to_contract_masters = [ + { + annotation = "annotation_1" + target_dn = aci_application_epg.test_2.id + }, + { + annotation = "annotation_2" + target_dn = aci_application_epg.test_3.id + }, + ] + relation_to_custom_qos_policy = [ + { + annotation = "annotation_1" + custom_qos_policy_name = "custom_qos_policy_name_1" + }, + ] + relation_to_data_plane_policing_policy = [ + { + annotation = "annotation_1" + data_plane_policing_policy_name = "data_plane_policing_policy_name_1" + }, + ] + relation_to_domains = [ + { + annotation = "annotation_1" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name_1" + delimiter = "delimiter_1" + deployment_immediacy = "immediate" + enable_netflow = "disabled" + encapsulation = "encapsulation_1" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + ipam_dhcp_override = "ipam_dhcp_override_1" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway_1" + lag_policy_name = "lag_policy_name_1" + netflow_direction = "both" + number_of_ports = "number_of_ports_1" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation_1" + primary_encapsulation_inner = "primary_encapsulation_inner_1" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner_1" + switching_mode = "AVE" + target_dn = uni/vmmp-VMware/dom-domain_1 + untagged = "no" + vnet_only = "no" + }, + { + annotation = "annotation_2" + binding_type = "ephemeral" + class_preference = "useg" + custom_epg_name = "custom_epg_name_2" + delimiter = "delimiter_2" + deployment_immediacy = "lazy" + enable_netflow = "enabled" + encapsulation = "encapsulation_2" + encapsulation_mode = "vlan" + epg_cos = "Cos1" + epg_cos_pref = "enabled" + ipam_dhcp_override = "ipam_dhcp_override_2" + ipam_enabled = "yes" + ipam_gateway = "ipam_gateway_2" + lag_policy_name = "lag_policy_name_2" + netflow_direction = "egress" + number_of_ports = "number_of_ports_2" + port_allocation = "fixed" + primary_encapsulation = "primary_encapsulation_2" + primary_encapsulation_inner = "primary_encapsulation_inner_2" + resolve_immediacy = "lazy" + secondary_encapsulation_inner = "secondary_encapsulation_inner_2" + switching_mode = "native" + target_dn = uni/vmmp-VMware/dom-domain_2 + untagged = "yes" + vnet_only = "yes" + }, + ] + relation_to_fibre_channel_paths = [ + { + annotation = "annotation_1" + description = "description_1" + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + vsan = "vsan_1" + vsan_mode = "native" + }, + { + annotation = "annotation_2" + description = "description_2" + target_dn = topology/pod-1/paths-101/pathep-[eth1/2] + vsan = "vsan_2" + vsan_mode = "regular" + }, + ] + relation_to_imported_contracts = [ + { + annotation = "annotation_1" + imported_contract_name = "imported_contract_name_0" + priority = "level1" + }, + { + annotation = "annotation_2" + imported_contract_name = "imported_contract_name_1" + priority = "level2" + }, + ] + relation_to_intra_epg_contracts = [ + { + annotation = "annotation_1" + contract_name = "contract_name_0" + }, + { + annotation = "annotation_2" + contract_name = "contract_name_1" + }, + ] + relation_to_provided_contracts = [ + { + annotation = "annotation_1" + contract_name = "contract_name_0" + match_criteria = "All" + priority = "level1" + }, + { + annotation = "annotation_2" + contract_name = "contract_name_1" + match_criteria = "AtleastOne" + priority = "level2" + }, + ] + relation_to_static_leafs = [ + { + annotation = "annotation_1" + deployment_immediacy = "immediate" + description = "description_1" + encapsulation = "encapsulation_1" + mode = "native" + target_dn = topology/pod-1/node-101 + }, + { + annotation = "annotation_2" + deployment_immediacy = "lazy" + description = "description_2" + encapsulation = "encapsulation_2" + mode = "regular" + target_dn = topology/pod-1/node-102 + }, + ] + relation_to_static_paths = [ + { + annotation = "annotation_1" + deployment_immediacy = "immediate" + description = "description_1" + encapsulation = "encapsulation_1" + mode = "native" + primary_encapsulation = "primary_encapsulation_1" + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + }, + { + annotation = "annotation_2" + deployment_immediacy = "lazy" + description = "description_2" + encapsulation = "encapsulation_2" + mode = "regular" + primary_encapsulation = "primary_encapsulation_2" + target_dn = topology/pod-1/paths-101/pathep-[eth1/2] + }, + ] + relation_to_taboo_contracts = [ + { + annotation = "annotation_1" + taboo_contract_name = "taboo_contract_name_0" + }, + { + annotation = "annotation_2" + taboo_contract_name = "taboo_contract_name_1" + }, + ] + relation_to_trust_control_policy = [ + { + annotation = "annotation_1" + trust_control_policy_name = "trust_control_policy_name_1" + }, + ] + tags = [ + { + key = "key_0" + value = "value_1" + }, + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvAEPgChildrenRemoveFromConfigDependencyWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" +} +` + +const testConfigFvAEPgChildrenRemoveOneDependencyWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + relation_to_application_epg_monitoring_policy = [] + relation_to_consumed_contracts = [ + { + annotation = "annotation_2" + contract_name = "contract_name_1" + priority = "level2" + }, + ] + relation_to_contract_masters = [ + { + annotation = "annotation_2" + target_dn = aci_application_epg.test_3.id + }, + ] + relation_to_data_plane_policing_policy = [] + relation_to_domains = [ + { + annotation = "annotation_2" + binding_type = "ephemeral" + class_preference = "useg" + custom_epg_name = "custom_epg_name_2" + delimiter = "delimiter_2" + deployment_immediacy = "lazy" + enable_netflow = "enabled" + encapsulation = "encapsulation_2" + encapsulation_mode = "vlan" + epg_cos = "Cos1" + epg_cos_pref = "enabled" + ipam_dhcp_override = "ipam_dhcp_override_2" + ipam_enabled = "yes" + ipam_gateway = "ipam_gateway_2" + lag_policy_name = "lag_policy_name_2" + netflow_direction = "egress" + number_of_ports = "number_of_ports_2" + port_allocation = "fixed" + primary_encapsulation = "primary_encapsulation_2" + primary_encapsulation_inner = "primary_encapsulation_inner_2" + resolve_immediacy = "lazy" + secondary_encapsulation_inner = "secondary_encapsulation_inner_2" + switching_mode = "native" + target_dn = uni/vmmp-VMware/dom-domain_2 + untagged = "yes" + vnet_only = "yes" + }, + ] + relation_to_fibre_channel_paths = [ + { + annotation = "annotation_2" + description = "description_2" + target_dn = topology/pod-1/paths-101/pathep-[eth1/2] + vsan = "vsan_2" + vsan_mode = "regular" + }, + ] + relation_to_imported_contracts = [ + { + annotation = "annotation_2" + imported_contract_name = "imported_contract_name_1" + priority = "level2" + }, + ] + relation_to_intra_epg_contracts = [ + { + annotation = "annotation_2" + contract_name = "contract_name_1" + }, + ] + relation_to_provided_contracts = [ + { + annotation = "annotation_2" + contract_name = "contract_name_1" + match_criteria = "AtleastOne" + priority = "level2" + }, + ] + relation_to_static_leafs = [ + { + annotation = "annotation_2" + deployment_immediacy = "lazy" + description = "description_2" + encapsulation = "encapsulation_2" + mode = "regular" + target_dn = topology/pod-1/node-102 + }, + ] + relation_to_static_paths = [ + { + annotation = "annotation_2" + deployment_immediacy = "lazy" + description = "description_2" + encapsulation = "encapsulation_2" + mode = "regular" + primary_encapsulation = "primary_encapsulation_2" + target_dn = topology/pod-1/paths-101/pathep-[eth1/2] + }, + ] + relation_to_taboo_contracts = [ + { + annotation = "annotation_2" + taboo_contract_name = "taboo_contract_name_1" + }, + ] + relation_to_trust_control_policy = [] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvAEPgChildrenRemoveAllDependencyWithFvAp = testChildDependencyConfigFvAEPg + testConfigFvApMinDependencyWithFvTenant + ` +resource "aci_application_epg" "test" { + parent_dn = aci_application_profile.test.id + name = "test_name" + annotations = [] + relation_to_application_epg_monitoring_policy = [] + relation_to_consumed_contracts = [] + relation_to_contract_masters = [] + relation_to_data_plane_policing_policy = [] + relation_to_domains = [] + relation_to_fibre_channel_paths = [] + relation_to_imported_contracts = [] + relation_to_intra_epg_contracts = [] + relation_to_provided_contracts = [] + relation_to_static_leafs = [] + relation_to_static_paths = [] + relation_to_taboo_contracts = [] + relation_to_trust_control_policy = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_custom_qos_policy.go b/internal/provider/resource_aci_custom_qos_policy.go new file mode 100644 index 000000000..917e716ac --- /dev/null +++ b/internal/provider/resource_aci_custom_qos_policy.go @@ -0,0 +1,623 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &QosCustomPolResource{} +var _ resource.ResourceWithImportState = &QosCustomPolResource{} + +func NewQosCustomPolResource() resource.Resource { + return &QosCustomPolResource{} +} + +// QosCustomPolResource defines the resource implementation. +type QosCustomPolResource struct { + client *client.Client +} + +// QosCustomPolResourceModel describes the resource data model. +type QosCustomPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationQosCustomPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationQosCustomPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagQosCustomPolResourceModel describes the resource data model for the children without relation ships. +type TagTagQosCustomPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type QosCustomPolIdentifier struct { + Name types.String +} + +func (r *QosCustomPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_custom_qos_policy") + resp.TypeName = req.ProviderTypeName + "_custom_qos_policy" + tflog.Debug(ctx, "End metadata of resource: aci_custom_qos_policy") +} + +func (r *QosCustomPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_custom_qos_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The custom_qos_policy resource for the 'qosCustomPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Custom Qos Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Custom Qos Policy object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Custom Qos Policy object.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Custom Qos Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Custom Qos Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_custom_qos_policy") +} + +func (r *QosCustomPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_custom_qos_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_custom_qos_policy") +} + +func (r *QosCustomPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_custom_qos_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *QosCustomPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setQosCustomPolId(ctx, stateData) + getAndSetQosCustomPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *QosCustomPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setQosCustomPolId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationQosCustomPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagQosCustomPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getQosCustomPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetQosCustomPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosCustomPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_custom_qos_policy") + var data *QosCustomPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) + + getAndSetQosCustomPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *QosCustomPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosCustomPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_custom_qos_policy") + var data *QosCustomPolResourceModel + var stateData *QosCustomPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationQosCustomPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagQosCustomPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getQosCustomPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetQosCustomPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosCustomPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_custom_qos_policy") + var data *QosCustomPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "qosCustomPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_custom_qos_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosCustomPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_custom_qos_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *QosCustomPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_custom_qos_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_custom_qos_policy") +} + +func getAndSetQosCustomPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *QosCustomPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "qosCustomPol,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("qosCustomPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("qosCustomPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setQosCustomPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationQosCustomPolList := make([]TagAnnotationQosCustomPolResourceModel, 0) + TagTagQosCustomPolList := make([]TagTagQosCustomPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationQosCustomPol := TagAnnotationQosCustomPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationQosCustomPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationQosCustomPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationQosCustomPolList = append(TagAnnotationQosCustomPolList, TagAnnotationQosCustomPol) + } + if childClassName == "tagTag" { + TagTagQosCustomPol := TagTagQosCustomPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagQosCustomPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagQosCustomPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagQosCustomPolList = append(TagTagQosCustomPolList, TagTagQosCustomPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationQosCustomPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagQosCustomPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'qosCustomPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getQosCustomPolRn(ctx context.Context, data *QosCustomPolResourceModel) string { + rn := "qoscustom-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setQosCustomPolParentDn(ctx context.Context, dn string, data *QosCustomPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setQosCustomPolId(ctx context.Context, data *QosCustomPolResourceModel) { + rn := getQosCustomPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getQosCustomPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *QosCustomPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationQosCustomPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getQosCustomPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *QosCustomPolResourceModel, tagTagPlan, tagTagState []TagTagQosCustomPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getQosCustomPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *QosCustomPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationQosCustomPolResourceModel, tagTagPlan, tagTagState []TagTagQosCustomPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getQosCustomPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getQosCustomPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"qosCustomPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_custom_qos_policy_test.go b/internal/provider/resource_aci_custom_qos_policy_test.go new file mode 100644 index 000000000..04365be2e --- /dev/null +++ b/internal/provider/resource_aci_custom_qos_policy_test.go @@ -0,0 +1,256 @@ +// 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 TestAccResourceQosCustomPolWithFvTenant(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: testConfigQosCustomPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigQosCustomPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", "description"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", "owner_tag"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigQosCustomPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigQosCustomPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", ""), + ), + }, + // Import testing + { + ResourceName: "aci_custom_qos_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", ""), + ), + }, + // Update with children + { + Config: testConfigQosCustomPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_custom_qos_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigQosCustomPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigQosCustomPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigQosCustomPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_custom_qos_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigQosCustomPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigQosCustomPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "annotation" + description = "description" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" +} +` + +const testConfigQosCustomPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "orchestrator:terraform" + description = "" + name_alias = "" + owner_key = "" + owner_tag = "" +} +` +const testConfigQosCustomPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + 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 testConfigQosCustomPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigQosCustomPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigQosCustomPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_custom_qos_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_data_plane_policing_policy.go b/internal/provider/resource_aci_data_plane_policing_policy.go new file mode 100644 index 000000000..d8fcefeb7 --- /dev/null +++ b/internal/provider/resource_aci_data_plane_policing_policy.go @@ -0,0 +1,997 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &QosDppPolResource{} +var _ resource.ResourceWithImportState = &QosDppPolResource{} + +func NewQosDppPolResource() resource.Resource { + return &QosDppPolResource{} +} + +// QosDppPolResource defines the resource implementation. +type QosDppPolResource struct { + client *client.Client +} + +// QosDppPolResourceModel describes the resource data model. +type QosDppPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + AdminSt types.String `tfsdk:"admin_st"` + Annotation types.String `tfsdk:"annotation"` + Be types.String `tfsdk:"be"` + BeUnit types.String `tfsdk:"be_unit"` + Burst types.String `tfsdk:"burst"` + BurstUnit types.String `tfsdk:"burst_unit"` + ConformAction types.String `tfsdk:"conform_action"` + ConformMarkCos types.String `tfsdk:"conform_mark_cos"` + ConformMarkDscp types.String `tfsdk:"conform_mark_dscp"` + Descr types.String `tfsdk:"description"` + ExceedAction types.String `tfsdk:"exceed_action"` + ExceedMarkCos types.String `tfsdk:"exceed_mark_cos"` + ExceedMarkDscp types.String `tfsdk:"exceed_mark_dscp"` + Mode types.String `tfsdk:"mode"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + Pir types.String `tfsdk:"pir"` + PirUnit types.String `tfsdk:"pir_unit"` + Rate types.String `tfsdk:"rate"` + RateUnit types.String `tfsdk:"rate_unit"` + SharingMode types.String `tfsdk:"sharing_mode"` + Type types.String `tfsdk:"type"` + ViolateAction types.String `tfsdk:"violate_action"` + ViolateMarkCos types.String `tfsdk:"violate_mark_cos"` + ViolateMarkDscp types.String `tfsdk:"violate_mark_dscp"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationQosDppPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationQosDppPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagQosDppPolResourceModel describes the resource data model for the children without relation ships. +type TagTagQosDppPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type QosDppPolIdentifier struct { + Name types.String +} + +func (r *QosDppPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_data_plane_policing_policy") + resp.TypeName = req.ProviderTypeName + "_data_plane_policing_policy" + tflog.Debug(ctx, "End metadata of resource: aci_data_plane_policing_policy") +} + +func (r *QosDppPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_data_plane_policing_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The data_plane_policing_policy resource for the 'qosDppPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Data Plane Policing Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "admin_st": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `The Administrative state of the policy.`, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Data Plane Policing Policy object.`, + }, + "be": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Excessive burst size (2R3C policer only).`, + }, + "be_unit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("giga", "kilo", "mega", "msec", "unspecified", "usec"), + }, + MarkdownDescription: `Excessive Burst unit - none, Kilo, Mega, Giga, ms, us.`, + }, + "burst": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Committed burst size, number of packets to absorb during a burst.`, + }, + "burst_unit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("giga", "kilo", "mega", "msec", "unspecified", "usec"), + }, + MarkdownDescription: `Burst unit - byte, kbyte, mbyte etc.`, + }, + "conform_action": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("drop", "mark", "transmit"), + }, + MarkdownDescription: `Confirm action.`, + }, + "conform_mark_cos": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Conform Mark cos.`, + }, + "conform_mark_dscp": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Conform Mark Dscp.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Data Plane Policing Policy object.`, + }, + "exceed_action": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("drop", "mark", "transmit"), + }, + MarkdownDescription: `Exceed action.`, + }, + "exceed_mark_cos": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Exceed Mark cos.`, + }, + "exceed_mark_dscp": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Exceed Mark Dscp.`, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("bit", "packet"), + }, + MarkdownDescription: `Policer mode - bytes or packet policer.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Data Plane Policing Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Data Plane Policing Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "pir": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Peak rate (pir) (2R3C policer only).`, + }, + "pir_unit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("giga", "kilo", "mega", "unspecified"), + }, + MarkdownDescription: `Peak Rate unit - none, Kilo, Mega, Giga.`, + }, + "rate": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Allowed rate, committed rate at which the packets are allowed into the system.`, + }, + "rate_unit": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("giga", "kilo", "mega", "unspecified"), + }, + MarkdownDescription: `Rate unit - bps, kbps, mbps, packets etc.`, + }, + "sharing_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("dedicated", "shared"), + }, + MarkdownDescription: `Policer sharing mode.`, + }, + "type": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("1R2C", "2R3C"), + }, + MarkdownDescription: `Policer type.`, + }, + "violate_action": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("drop", "mark", "transmit"), + }, + MarkdownDescription: `Violate action.`, + }, + "violate_mark_cos": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Violate Mark cos.`, + }, + "violate_mark_dscp": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("unspecified"), + }, + MarkdownDescription: `Violate Mark Dscp.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_data_plane_policing_policy") +} + +func (r *QosDppPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_data_plane_policing_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_data_plane_policing_policy") +} + +func (r *QosDppPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_data_plane_policing_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *QosDppPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setQosDppPolId(ctx, stateData) + getAndSetQosDppPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *QosDppPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setQosDppPolId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationQosDppPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagQosDppPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getQosDppPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetQosDppPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosDppPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_data_plane_policing_policy") + var data *QosDppPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) + + getAndSetQosDppPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *QosDppPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosDppPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_data_plane_policing_policy") + var data *QosDppPolResourceModel + var stateData *QosDppPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationQosDppPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagQosDppPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getQosDppPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetQosDppPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosDppPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_data_plane_policing_policy") + var data *QosDppPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "qosDppPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_data_plane_policing_policy with id '%s'", data.Id.ValueString())) +} + +func (r *QosDppPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_data_plane_policing_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *QosDppPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_data_plane_policing_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_data_plane_policing_policy") +} + +func getAndSetQosDppPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *QosDppPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "qosDppPol,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("qosDppPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("qosDppPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setQosDppPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "adminSt" { + data.AdminSt = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "be" { + data.Be = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "beUnit" { + data.BeUnit = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "burst" { + data.Burst = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "burstUnit" { + data.BurstUnit = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "conformAction" { + data.ConformAction = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "conformMarkCos" { + data.ConformMarkCos = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "conformMarkDscp" { + data.ConformMarkDscp = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "exceedAction" { + data.ExceedAction = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "exceedMarkCos" { + data.ExceedMarkCos = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "exceedMarkDscp" { + data.ExceedMarkDscp = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mode" { + data.Mode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "pir" { + data.Pir = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "pirUnit" { + data.PirUnit = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "rate" { + data.Rate = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "rateUnit" { + data.RateUnit = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "sharingMode" { + data.SharingMode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "type" { + data.Type = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "violateAction" { + data.ViolateAction = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "violateMarkCos" { + data.ViolateMarkCos = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "violateMarkDscp" { + data.ViolateMarkDscp = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationQosDppPolList := make([]TagAnnotationQosDppPolResourceModel, 0) + TagTagQosDppPolList := make([]TagTagQosDppPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationQosDppPol := TagAnnotationQosDppPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationQosDppPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationQosDppPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationQosDppPolList = append(TagAnnotationQosDppPolList, TagAnnotationQosDppPol) + } + if childClassName == "tagTag" { + TagTagQosDppPol := TagTagQosDppPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagQosDppPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagQosDppPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagQosDppPolList = append(TagTagQosDppPolList, TagTagQosDppPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationQosDppPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagQosDppPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'qosDppPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getQosDppPolRn(ctx context.Context, data *QosDppPolResourceModel) string { + rn := "qosdpppol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setQosDppPolParentDn(ctx context.Context, dn string, data *QosDppPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setQosDppPolId(ctx context.Context, data *QosDppPolResourceModel) { + rn := getQosDppPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getQosDppPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *QosDppPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationQosDppPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getQosDppPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *QosDppPolResourceModel, tagTagPlan, tagTagState []TagTagQosDppPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getQosDppPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *QosDppPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationQosDppPolResourceModel, tagTagPlan, tagTagState []TagTagQosDppPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getQosDppPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getQosDppPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.AdminSt.IsNull() && !data.AdminSt.IsUnknown() { + payloadMap["attributes"].(map[string]string)["adminSt"] = data.AdminSt.ValueString() + } + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Be.IsNull() && !data.Be.IsUnknown() { + payloadMap["attributes"].(map[string]string)["be"] = data.Be.ValueString() + } + if !data.BeUnit.IsNull() && !data.BeUnit.IsUnknown() { + payloadMap["attributes"].(map[string]string)["beUnit"] = data.BeUnit.ValueString() + } + if !data.Burst.IsNull() && !data.Burst.IsUnknown() { + payloadMap["attributes"].(map[string]string)["burst"] = data.Burst.ValueString() + } + if !data.BurstUnit.IsNull() && !data.BurstUnit.IsUnknown() { + payloadMap["attributes"].(map[string]string)["burstUnit"] = data.BurstUnit.ValueString() + } + if !data.ConformAction.IsNull() && !data.ConformAction.IsUnknown() { + payloadMap["attributes"].(map[string]string)["conformAction"] = data.ConformAction.ValueString() + } + if !data.ConformMarkCos.IsNull() && !data.ConformMarkCos.IsUnknown() { + payloadMap["attributes"].(map[string]string)["conformMarkCos"] = data.ConformMarkCos.ValueString() + } + if !data.ConformMarkDscp.IsNull() && !data.ConformMarkDscp.IsUnknown() { + payloadMap["attributes"].(map[string]string)["conformMarkDscp"] = data.ConformMarkDscp.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.ExceedAction.IsNull() && !data.ExceedAction.IsUnknown() { + payloadMap["attributes"].(map[string]string)["exceedAction"] = data.ExceedAction.ValueString() + } + if !data.ExceedMarkCos.IsNull() && !data.ExceedMarkCos.IsUnknown() { + payloadMap["attributes"].(map[string]string)["exceedMarkCos"] = data.ExceedMarkCos.ValueString() + } + if !data.ExceedMarkDscp.IsNull() && !data.ExceedMarkDscp.IsUnknown() { + payloadMap["attributes"].(map[string]string)["exceedMarkDscp"] = data.ExceedMarkDscp.ValueString() + } + if !data.Mode.IsNull() && !data.Mode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mode"] = data.Mode.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.Pir.IsNull() && !data.Pir.IsUnknown() { + payloadMap["attributes"].(map[string]string)["pir"] = data.Pir.ValueString() + } + if !data.PirUnit.IsNull() && !data.PirUnit.IsUnknown() { + payloadMap["attributes"].(map[string]string)["pirUnit"] = data.PirUnit.ValueString() + } + if !data.Rate.IsNull() && !data.Rate.IsUnknown() { + payloadMap["attributes"].(map[string]string)["rate"] = data.Rate.ValueString() + } + if !data.RateUnit.IsNull() && !data.RateUnit.IsUnknown() { + payloadMap["attributes"].(map[string]string)["rateUnit"] = data.RateUnit.ValueString() + } + if !data.SharingMode.IsNull() && !data.SharingMode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["sharingMode"] = data.SharingMode.ValueString() + } + if !data.Type.IsNull() && !data.Type.IsUnknown() { + payloadMap["attributes"].(map[string]string)["type"] = data.Type.ValueString() + } + if !data.ViolateAction.IsNull() && !data.ViolateAction.IsUnknown() { + payloadMap["attributes"].(map[string]string)["violateAction"] = data.ViolateAction.ValueString() + } + if !data.ViolateMarkCos.IsNull() && !data.ViolateMarkCos.IsUnknown() { + payloadMap["attributes"].(map[string]string)["violateMarkCos"] = data.ViolateMarkCos.ValueString() + } + if !data.ViolateMarkDscp.IsNull() && !data.ViolateMarkDscp.IsUnknown() { + payloadMap["attributes"].(map[string]string)["violateMarkDscp"] = data.ViolateMarkDscp.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"qosDppPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_data_plane_policing_policy_test.go b/internal/provider/resource_aci_data_plane_policing_policy_test.go new file mode 100644 index 000000000..05cc5a280 --- /dev/null +++ b/internal/provider/resource_aci_data_plane_policing_policy_test.go @@ -0,0 +1,424 @@ +// 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 TestAccResourceQosDppPolWithFvTenant(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: testConfigQosDppPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigQosDppPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "giga"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "giga"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", "description"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", "pir"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "giga"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", "rate"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "giga"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigQosDppPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigQosDppPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + ), + }, + // Import testing + { + ResourceName: "aci_data_plane_policing_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + ), + }, + // Update with children + { + Config: testConfigQosDppPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_data_plane_policing_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "admin_st", "disabled"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "be_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "burst_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_action", "transmit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "conform_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "exceed_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "mode", "bit"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "pir_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate", ""), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "rate_unit", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "sharing_mode", "dedicated"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "type", "1R2C"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_action", "drop"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_cos", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "violate_mark_dscp", "unspecified"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigQosDppPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigQosDppPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigQosDppPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_data_plane_policing_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigQosDppPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigQosDppPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_st = "disabled" + annotation = "annotation" + be = "unspecified" + be_unit = "giga" + burst = "unspecified" + burst_unit = "giga" + conform_action = "drop" + conform_mark_cos = "unspecified" + conform_mark_dscp = "unspecified" + description = "description" + exceed_action = "drop" + exceed_mark_cos = "unspecified" + exceed_mark_dscp = "unspecified" + mode = "bit" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + pir = "pir" + pir_unit = "giga" + rate = "rate" + rate_unit = "giga" + sharing_mode = "dedicated" + type = "1R2C" + violate_action = "drop" + violate_mark_cos = "unspecified" + violate_mark_dscp = "unspecified" +} +` + +const testConfigQosDppPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + admin_st = "disabled" + annotation = "orchestrator:terraform" + be = "unspecified" + be_unit = "unspecified" + burst = "unspecified" + burst_unit = "unspecified" + conform_action = "transmit" + conform_mark_cos = "unspecified" + conform_mark_dscp = "unspecified" + description = "" + exceed_action = "drop" + exceed_mark_cos = "unspecified" + exceed_mark_dscp = "unspecified" + mode = "bit" + name_alias = "" + owner_key = "" + owner_tag = "" + pir = "" + pir_unit = "unspecified" + rate = "" + rate_unit = "unspecified" + sharing_mode = "dedicated" + type = "1R2C" + violate_action = "drop" + violate_mark_cos = "unspecified" + violate_mark_dscp = "unspecified" +} +` +const testConfigQosDppPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + 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 testConfigQosDppPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigQosDppPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigQosDppPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_data_plane_policing_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_endpoint_security_group.go b/internal/provider/resource_aci_endpoint_security_group.go index 7fb3baf0c..ecb907439 100644 --- a/internal/provider/resource_aci_endpoint_security_group.go +++ b/internal/provider/resource_aci_endpoint_security_group.go @@ -535,6 +535,7 @@ func setFvESgLegacyAttributes(ctx context.Context, diags *diag.Diagnostics, data } } DeprecatedFvRsIntraEpgFvESgList := make([]string, 0) + data.DeprecatedFvRsScope = basetypes.NewStringNull() DeprecatedFvRsSecInheritedFvESgList := make([]string, 0) _, ok := classReadInfo[0].(map[string]interface{})["children"] diff --git a/internal/provider/resource_aci_relation_to_domain.go b/internal/provider/resource_aci_relation_to_domain.go new file mode 100644 index 000000000..8296519a0 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_domain.go @@ -0,0 +1,972 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsDomAttResource{} +var _ resource.ResourceWithImportState = &FvRsDomAttResource{} + +func NewFvRsDomAttResource() resource.Resource { + return &FvRsDomAttResource{} +} + +// FvRsDomAttResource defines the resource implementation. +type FvRsDomAttResource struct { + client *client.Client +} + +// FvRsDomAttResourceModel describes the resource data model. +type FvRsDomAttResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + BindingType types.String `tfsdk:"binding_type"` + ClassPref types.String `tfsdk:"class_preference"` + CustomEpgName types.String `tfsdk:"custom_epg_name"` + Delimiter types.String `tfsdk:"delimiter"` + Encap types.String `tfsdk:"encapsulation"` + EncapMode types.String `tfsdk:"encapsulation_mode"` + EpgCos types.String `tfsdk:"epg_cos"` + EpgCosPref types.String `tfsdk:"epg_cos_pref"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + IpamDhcpOverride types.String `tfsdk:"ipam_dhcp_override"` + IpamEnabled types.String `tfsdk:"ipam_enabled"` + IpamGateway types.String `tfsdk:"ipam_gateway"` + LagPolicyName types.String `tfsdk:"lag_policy_name"` + NetflowDir types.String `tfsdk:"netflow_direction"` + NetflowPref types.String `tfsdk:"enable_netflow"` + NumPorts types.String `tfsdk:"number_of_ports"` + PortAllocation types.String `tfsdk:"port_allocation"` + PrimaryEncap types.String `tfsdk:"primary_encapsulation"` + PrimaryEncapInner types.String `tfsdk:"primary_encapsulation_inner"` + ResImedcy types.String `tfsdk:"resolve_immediacy"` + SecondaryEncapInner types.String `tfsdk:"secondary_encapsulation_inner"` + SwitchingMode types.String `tfsdk:"switching_mode"` + TDn types.String `tfsdk:"target_dn"` + Untagged types.String `tfsdk:"untagged"` + VnetOnly types.String `tfsdk:"vnet_only"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvRsDomAttResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsDomAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvRsDomAttResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsDomAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvRsDomAttIdentifier struct { + TDn types.String +} + +func (r *FvRsDomAttResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_to_domain") + resp.TypeName = req.ProviderTypeName + "_relation_to_domain" + tflog.Debug(ctx, "End metadata of resource: aci_relation_to_domain") +} + +func (r *FvRsDomAttResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_to_domain") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_domain resource for the 'fvRsDomAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Domain object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation To Domain object.`, + }, + "binding_type": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("dynamicBinding", "ephemeral", "none", "staticBinding"), + }, + MarkdownDescription: `Binding type for ports.`, + }, + "class_preference": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("encap", "useg"), + }, + MarkdownDescription: `classPref.`, + }, + "custom_epg_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `User-configured port-group display name.`, + }, + "delimiter": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `delimiter.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The port encapsulation.`, + }, + "encapsulation_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("auto", "vlan", "vxlan"), + }, + MarkdownDescription: `encapMode.`, + }, + "epg_cos": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("Cos0", "Cos1", "Cos2", "Cos3", "Cos4", "Cos5", "Cos6", "Cos7"), + }, + MarkdownDescription: `Represents Epg Cos for AVS.`, + }, + "epg_cos_pref": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Represents parameter used to enable/disable Epg Cos Policy.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `Once policies are downloaded to the leaf software, deployment immediacy can specify when the policy is pushed into the hardware policy CAM.`, + }, + "ipam_dhcp_override": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `ipamDhcpOverride.`, + }, + "ipam_enabled": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `ipamEnabled.`, + }, + "ipam_gateway": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `ipamGateway.`, + }, + "lag_policy_name": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `LAG Policy Name.`, + }, + "netflow_direction": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("both", "egress", "ingress"), + }, + MarkdownDescription: `Represents NetFlow monitoring direction.`, + }, + "enable_netflow": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("disabled", "enabled"), + }, + MarkdownDescription: `Represents parameter used to enable/disable Netflow Policy.`, + }, + "number_of_ports": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Number of ports for binding type.`, + }, + "port_allocation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("elastic", "fixed", "none"), + }, + MarkdownDescription: `Port allocation for ports.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "primary_encapsulation_inner": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `primaryEncapInner.`, + }, + "resolve_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy", "pre-provision"), + }, + MarkdownDescription: `Specifies if policies are to be resolved immmediately or when needed.`, + }, + "secondary_encapsulation_inner": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `secondaryEncapInner.`, + }, + "switching_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("AVE", "native"), + }, + MarkdownDescription: `switchingMode.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Physical Domain Profile.`, + }, + "untagged": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `untagged.`, + }, + "vnet_only": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `vnetOnly.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_to_domain") +} + +func (r *FvRsDomAttResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_to_domain") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_to_domain") +} + +func (r *FvRsDomAttResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_to_domain") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsDomAttResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvRsDomAttId(ctx, stateData) + getAndSetFvRsDomAttAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvRsDomAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsDomAttId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsDomAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsDomAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsDomAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsDomAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsDomAttResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_to_domain") + var data *FvRsDomAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) + + getAndSetFvRsDomAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsDomAttResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsDomAttResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_to_domain") + var data *FvRsDomAttResourceModel + var stateData *FvRsDomAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsDomAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsDomAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsDomAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsDomAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsDomAttResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_to_domain") + var data *FvRsDomAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsDomAtt", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_to_domain with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsDomAttResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_to_domain") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsDomAttResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_to_domain with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_to_domain") +} + +func getAndSetFvRsDomAttAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsDomAttResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsDomAtt,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsDomAtt").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsDomAtt").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsDomAttParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "bindingType" && attributeValue.(string) == "" { + data.BindingType = basetypes.NewStringValue("none") + } else if attributeName == "bindingType" { + data.BindingType = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "classPref" { + data.ClassPref = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "customEpgName" { + data.CustomEpgName = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "delimiter" { + data.Delimiter = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "encap" { + data.Encap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "encapMode" { + data.EncapMode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epgCos" { + data.EpgCos = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "epgCosPref" { + data.EpgCosPref = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "instrImedcy" { + data.InstrImedcy = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipamDhcpOverride" { + data.IpamDhcpOverride = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipamEnabled" { + data.IpamEnabled = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ipamGateway" { + data.IpamGateway = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "lagPolicyName" { + data.LagPolicyName = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "netflowDir" { + data.NetflowDir = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "netflowPref" { + data.NetflowPref = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "numPorts" { + data.NumPorts = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "portAllocation" && attributeValue.(string) == "" { + data.PortAllocation = basetypes.NewStringValue("none") + } else if attributeName == "portAllocation" { + data.PortAllocation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "primaryEncap" { + data.PrimaryEncap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "primaryEncapInner" { + data.PrimaryEncapInner = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "resImedcy" { + data.ResImedcy = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "secondaryEncapInner" { + data.SecondaryEncapInner = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "switchingMode" { + data.SwitchingMode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tDn" { + data.TDn = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "untagged" { + data.Untagged = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "vnetOnly" { + data.VnetOnly = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsDomAttList := make([]TagAnnotationFvRsDomAttResourceModel, 0) + TagTagFvRsDomAttList := make([]TagTagFvRsDomAttResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsDomAtt := TagAnnotationFvRsDomAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsDomAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsDomAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsDomAttList = append(TagAnnotationFvRsDomAttList, TagAnnotationFvRsDomAtt) + } + if childClassName == "tagTag" { + TagTagFvRsDomAtt := TagTagFvRsDomAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsDomAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsDomAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsDomAttList = append(TagTagFvRsDomAttList, TagTagFvRsDomAtt) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsDomAttList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsDomAttList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsDomAtt'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsDomAttRn(ctx context.Context, data *FvRsDomAttResourceModel) string { + rn := "rsdomAtt-[{tDn}]" + for _, identifier := range []string{"tDn"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsDomAttParentDn(ctx context.Context, dn string, data *FvRsDomAttResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsDomAttId(ctx context.Context, data *FvRsDomAttResourceModel) { + rn := getFvRsDomAttRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsDomAttTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsDomAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsDomAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsDomAttTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsDomAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsDomAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsDomAttCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvRsDomAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsDomAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsDomAttResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsDomAttTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsDomAttTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.BindingType.IsNull() && !data.BindingType.IsUnknown() { + payloadMap["attributes"].(map[string]string)["bindingType"] = data.BindingType.ValueString() + } + if !data.ClassPref.IsNull() && !data.ClassPref.IsUnknown() { + payloadMap["attributes"].(map[string]string)["classPref"] = data.ClassPref.ValueString() + } + if !data.CustomEpgName.IsNull() && !data.CustomEpgName.IsUnknown() { + payloadMap["attributes"].(map[string]string)["customEpgName"] = data.CustomEpgName.ValueString() + } + if !data.Delimiter.IsNull() && !data.Delimiter.IsUnknown() { + payloadMap["attributes"].(map[string]string)["delimiter"] = data.Delimiter.ValueString() + } + if !data.Encap.IsNull() && !data.Encap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["encap"] = data.Encap.ValueString() + } + if !data.EncapMode.IsNull() && !data.EncapMode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["encapMode"] = data.EncapMode.ValueString() + } + if !data.EpgCos.IsNull() && !data.EpgCos.IsUnknown() { + payloadMap["attributes"].(map[string]string)["epgCos"] = data.EpgCos.ValueString() + } + if !data.EpgCosPref.IsNull() && !data.EpgCosPref.IsUnknown() { + payloadMap["attributes"].(map[string]string)["epgCosPref"] = data.EpgCosPref.ValueString() + } + if !data.InstrImedcy.IsNull() && !data.InstrImedcy.IsUnknown() { + payloadMap["attributes"].(map[string]string)["instrImedcy"] = data.InstrImedcy.ValueString() + } + if !data.IpamDhcpOverride.IsNull() && !data.IpamDhcpOverride.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipamDhcpOverride"] = data.IpamDhcpOverride.ValueString() + } + if !data.IpamEnabled.IsNull() && !data.IpamEnabled.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipamEnabled"] = data.IpamEnabled.ValueString() + } + if !data.IpamGateway.IsNull() && !data.IpamGateway.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ipamGateway"] = data.IpamGateway.ValueString() + } + if !data.LagPolicyName.IsNull() && !data.LagPolicyName.IsUnknown() { + payloadMap["attributes"].(map[string]string)["lagPolicyName"] = data.LagPolicyName.ValueString() + } + if !data.NetflowDir.IsNull() && !data.NetflowDir.IsUnknown() { + payloadMap["attributes"].(map[string]string)["netflowDir"] = data.NetflowDir.ValueString() + } + if !data.NetflowPref.IsNull() && !data.NetflowPref.IsUnknown() { + payloadMap["attributes"].(map[string]string)["netflowPref"] = data.NetflowPref.ValueString() + } + if !data.NumPorts.IsNull() && !data.NumPorts.IsUnknown() { + payloadMap["attributes"].(map[string]string)["numPorts"] = data.NumPorts.ValueString() + } + if !data.PortAllocation.IsNull() && !data.PortAllocation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["portAllocation"] = data.PortAllocation.ValueString() + } + if !data.PrimaryEncap.IsNull() && !data.PrimaryEncap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["primaryEncap"] = data.PrimaryEncap.ValueString() + } + if !data.PrimaryEncapInner.IsNull() && !data.PrimaryEncapInner.IsUnknown() { + payloadMap["attributes"].(map[string]string)["primaryEncapInner"] = data.PrimaryEncapInner.ValueString() + } + if !data.ResImedcy.IsNull() && !data.ResImedcy.IsUnknown() { + payloadMap["attributes"].(map[string]string)["resImedcy"] = data.ResImedcy.ValueString() + } + if !data.SecondaryEncapInner.IsNull() && !data.SecondaryEncapInner.IsUnknown() { + payloadMap["attributes"].(map[string]string)["secondaryEncapInner"] = data.SecondaryEncapInner.ValueString() + } + if !data.SwitchingMode.IsNull() && !data.SwitchingMode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["switchingMode"] = data.SwitchingMode.ValueString() + } + if !data.TDn.IsNull() && !data.TDn.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tDn"] = data.TDn.ValueString() + } + if !data.Untagged.IsNull() && !data.Untagged.IsUnknown() { + payloadMap["attributes"].(map[string]string)["untagged"] = data.Untagged.ValueString() + } + if !data.VnetOnly.IsNull() && !data.VnetOnly.IsUnknown() { + payloadMap["attributes"].(map[string]string)["vnetOnly"] = data.VnetOnly.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsDomAtt": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_to_domain_test.go b/internal/provider/resource_aci_relation_to_domain_test.go new file mode 100644 index 000000000..9281045b7 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_domain_test.go @@ -0,0 +1,419 @@ +// 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 TestAccResourceFvRsDomAttWithFvAEPg(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: testConfigFvRsDomAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "false"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsDomAttAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "dynamicBinding"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", "custom_epg_name"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", "delimiter"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", "encapsulation"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", "ipam_dhcp_override"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "no"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", "ipam_gateway"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", "lag_policy_name"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", "number_of_ports"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "elastic"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", "primary_encapsulation"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", "primary_encapsulation_inner"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", "secondary_encapsulation_inner"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "AVE"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "no"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "no"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsDomAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsDomAttResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "false"), + ), + }, + // Import testing + { + ResourceName: "aci_relation_to_domain.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "false"), + ), + }, + // Update with children + { + Config: testConfigFvRsDomAttChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_relation_to_domain.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "target_dn", "uni/vmmp-VMware/dom-domain_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "binding_type", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "class_preference", "encap"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "custom_epg_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "delimiter", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "enable_netflow", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "encapsulation_mode", "auto"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos", "Cos0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "epg_cos_pref", "disabled"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_dhcp_override", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_enabled", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "ipam_gateway", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "lag_policy_name", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "netflow_direction", "both"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "number_of_ports", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "port_allocation", "none"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "primary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "resolve_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "secondary_encapsulation_inner", ""), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "switching_mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "untagged", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "vnet_only", "false"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvRsDomAttChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsDomAttChildrenRemoveOneDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsDomAttChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_to_domain.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testDependencyConfigFvRsDomAtt = ` +` + +const testConfigFvRsDomAttMinDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 +} +` + +const testConfigFvRsDomAttAllDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + annotation = "annotation" + binding_type = "dynamicBinding" + class_preference = "encap" + custom_epg_name = "custom_epg_name" + delimiter = "delimiter" + deployment_immediacy = "immediate" + enable_netflow = "disabled" + encapsulation = "encapsulation" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + ipam_dhcp_override = "ipam_dhcp_override" + ipam_enabled = "no" + ipam_gateway = "ipam_gateway" + lag_policy_name = "lag_policy_name" + netflow_direction = "both" + number_of_ports = "number_of_ports" + port_allocation = "elastic" + primary_encapsulation = "primary_encapsulation" + primary_encapsulation_inner = "primary_encapsulation_inner" + resolve_immediacy = "immediate" + secondary_encapsulation_inner = "secondary_encapsulation_inner" + switching_mode = "AVE" + untagged = "no" + vnet_only = "no" +} +` + +const testConfigFvRsDomAttResetDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + annotation = "orchestrator:terraform" + binding_type = "none" + class_preference = "encap" + custom_epg_name = "" + delimiter = "" + deployment_immediacy = "lazy" + enable_netflow = "disabled" + encapsulation = "" + encapsulation_mode = "auto" + epg_cos = "Cos0" + epg_cos_pref = "disabled" + ipam_dhcp_override = "" + ipam_enabled = "false" + ipam_gateway = "" + lag_policy_name = "" + netflow_direction = "both" + number_of_ports = "" + port_allocation = "none" + primary_encapsulation = "" + primary_encapsulation_inner = "" + resolve_immediacy = "lazy" + secondary_encapsulation_inner = "" + switching_mode = "native" + untagged = "false" + vnet_only = "false" +} +` +const testConfigFvRsDomAttChildrenDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + 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 testConfigFvRsDomAttChildrenRemoveFromConfigDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 +} +` + +const testConfigFvRsDomAttChildrenRemoveOneDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvRsDomAttChildrenRemoveAllDependencyWithFvAEPg = testDependencyConfigFvRsDomAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_domain" "test" { + parent_dn = aci_application_epg.test.id + target_dn = uni/vmmp-VMware/dom-domain_1 + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_relation_to_fibre_channel_path.go b/internal/provider/resource_aci_relation_to_fibre_channel_path.go new file mode 100644 index 000000000..e5df51885 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_fibre_channel_path.go @@ -0,0 +1,613 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsFcPathAttResource{} +var _ resource.ResourceWithImportState = &FvRsFcPathAttResource{} + +func NewFvRsFcPathAttResource() resource.Resource { + return &FvRsFcPathAttResource{} +} + +// FvRsFcPathAttResource defines the resource implementation. +type FvRsFcPathAttResource struct { + client *client.Client +} + +// FvRsFcPathAttResourceModel describes the resource data model. +type FvRsFcPathAttResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + TDn types.String `tfsdk:"target_dn"` + Vsan types.String `tfsdk:"vsan"` + VsanMode types.String `tfsdk:"vsan_mode"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvRsFcPathAttResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsFcPathAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvRsFcPathAttResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsFcPathAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvRsFcPathAttIdentifier struct { + TDn types.String +} + +func (r *FvRsFcPathAttResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_to_fibre_channel_path") + resp.TypeName = req.ProviderTypeName + "_relation_to_fibre_channel_path" + tflog.Debug(ctx, "End metadata of resource: aci_relation_to_fibre_channel_path") +} + +func (r *FvRsFcPathAttResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_to_fibre_channel_path") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_fibre_channel_path resource for the 'fvRsFcPathAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Fibre Channel Path object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation To Fibre Channel Path object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Fibre Channel Path object.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The distinguished name of the target.`, + }, + "vsan": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `port vsan.`, + }, + "vsan_mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular"), + }, + MarkdownDescription: `vsanMode.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_to_fibre_channel_path") +} + +func (r *FvRsFcPathAttResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_to_fibre_channel_path") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_to_fibre_channel_path") +} + +func (r *FvRsFcPathAttResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_to_fibre_channel_path") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsFcPathAttResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvRsFcPathAttId(ctx, stateData) + getAndSetFvRsFcPathAttAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvRsFcPathAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsFcPathAttId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsFcPathAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsFcPathAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsFcPathAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsFcPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsFcPathAttResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_to_fibre_channel_path") + var data *FvRsFcPathAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) + + getAndSetFvRsFcPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsFcPathAttResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsFcPathAttResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_to_fibre_channel_path") + var data *FvRsFcPathAttResourceModel + var stateData *FvRsFcPathAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsFcPathAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsFcPathAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsFcPathAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsFcPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsFcPathAttResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_to_fibre_channel_path") + var data *FvRsFcPathAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsFcPathAtt", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_to_fibre_channel_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsFcPathAttResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_to_fibre_channel_path") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsFcPathAttResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_to_fibre_channel_path with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_to_fibre_channel_path") +} + +func getAndSetFvRsFcPathAttAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsFcPathAttResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsFcPathAtt,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsFcPathAtt").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsFcPathAtt").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsFcPathAttParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tDn" { + data.TDn = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "vsan" { + data.Vsan = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "vsanMode" { + data.VsanMode = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsFcPathAttList := make([]TagAnnotationFvRsFcPathAttResourceModel, 0) + TagTagFvRsFcPathAttList := make([]TagTagFvRsFcPathAttResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsFcPathAtt := TagAnnotationFvRsFcPathAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsFcPathAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsFcPathAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsFcPathAttList = append(TagAnnotationFvRsFcPathAttList, TagAnnotationFvRsFcPathAtt) + } + if childClassName == "tagTag" { + TagTagFvRsFcPathAtt := TagTagFvRsFcPathAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsFcPathAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsFcPathAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsFcPathAttList = append(TagTagFvRsFcPathAttList, TagTagFvRsFcPathAtt) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsFcPathAttList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsFcPathAttList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsFcPathAtt'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsFcPathAttRn(ctx context.Context, data *FvRsFcPathAttResourceModel) string { + rn := "rsfcPathAtt-[{tDn}]" + for _, identifier := range []string{"tDn"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsFcPathAttParentDn(ctx context.Context, dn string, data *FvRsFcPathAttResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsFcPathAttId(ctx context.Context, data *FvRsFcPathAttResourceModel) { + rn := getFvRsFcPathAttRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsFcPathAttTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsFcPathAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsFcPathAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsFcPathAttTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsFcPathAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsFcPathAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsFcPathAttCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvRsFcPathAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsFcPathAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsFcPathAttResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsFcPathAttTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsFcPathAttTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.TDn.IsNull() && !data.TDn.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tDn"] = data.TDn.ValueString() + } + if !data.Vsan.IsNull() && !data.Vsan.IsUnknown() { + payloadMap["attributes"].(map[string]string)["vsan"] = data.Vsan.ValueString() + } + if !data.VsanMode.IsNull() && !data.VsanMode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["vsanMode"] = data.VsanMode.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsFcPathAtt": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_to_fibre_channel_path_test.go b/internal/provider/resource_aci_relation_to_fibre_channel_path_test.go new file mode 100644 index 000000000..9d4aa8de3 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_fibre_channel_path_test.go @@ -0,0 +1,251 @@ +// 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 TestAccResourceFvRsFcPathAttWithFvAEPg(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: testConfigFvRsFcPathAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsFcPathAttAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", "description"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", "vsan"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "native"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsFcPathAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsFcPathAttResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + ), + }, + // Import testing + { + ResourceName: "aci_relation_to_fibre_channel_path.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + ), + }, + // Update with children + { + Config: testConfigFvRsFcPathAttChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_relation_to_fibre_channel_path.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "target_dn", "test_t_dn"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan", ""), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "vsan_mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvRsFcPathAttChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsFcPathAttChildrenRemoveOneDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsFcPathAttChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_to_fibre_channel_path.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testDependencyConfigFvRsFcPathAtt = ` +` + +const testConfigFvRsFcPathAttMinDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn +} +` + +const testConfigFvRsFcPathAttAllDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + annotation = "annotation" + description = "description" + vsan = "vsan" + vsan_mode = "native" +} +` + +const testConfigFvRsFcPathAttResetDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + annotation = "orchestrator:terraform" + description = "" + vsan = "" + vsan_mode = "regular" +} +` +const testConfigFvRsFcPathAttChildrenDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + 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 testConfigFvRsFcPathAttChildrenRemoveFromConfigDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn +} +` + +const testConfigFvRsFcPathAttChildrenRemoveOneDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvRsFcPathAttChildrenRemoveAllDependencyWithFvAEPg = testDependencyConfigFvRsFcPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_fibre_channel_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = test_t_dn + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_relation_to_static_leaf.go b/internal/provider/resource_aci_relation_to_static_leaf.go new file mode 100644 index 000000000..f991eb220 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_static_leaf.go @@ -0,0 +1,631 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsNodeAttResource{} +var _ resource.ResourceWithImportState = &FvRsNodeAttResource{} + +func NewFvRsNodeAttResource() resource.Resource { + return &FvRsNodeAttResource{} +} + +// FvRsNodeAttResource defines the resource implementation. +type FvRsNodeAttResource struct { + client *client.Client +} + +// FvRsNodeAttResourceModel describes the resource data model. +type FvRsNodeAttResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encapsulation"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + Mode types.String `tfsdk:"mode"` + TDn types.String `tfsdk:"target_dn"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvRsNodeAttResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsNodeAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvRsNodeAttResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsNodeAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvRsNodeAttIdentifier struct { + TDn types.String +} + +func (r *FvRsNodeAttResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_to_static_leaf") + resp.TypeName = req.ProviderTypeName + "_relation_to_static_leaf" + tflog.Debug(ctx, "End metadata of resource: aci_relation_to_static_leaf") +} + +func (r *FvRsNodeAttResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_to_static_leaf") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_static_leaf resource for the 'fvRsNodeAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Static Leaf object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation To Static Leaf object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Static Leaf object.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The encapsulation method (VLAN) for the static binding.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `null.`, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular", "untagged"), + }, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The distinguished name of the target of this static binding.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_to_static_leaf") +} + +func (r *FvRsNodeAttResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_to_static_leaf") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_to_static_leaf") +} + +func (r *FvRsNodeAttResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_to_static_leaf") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsNodeAttResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvRsNodeAttId(ctx, stateData) + getAndSetFvRsNodeAttAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvRsNodeAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsNodeAttId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsNodeAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsNodeAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsNodeAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsNodeAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsNodeAttResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_to_static_leaf") + var data *FvRsNodeAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) + + getAndSetFvRsNodeAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsNodeAttResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsNodeAttResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_to_static_leaf") + var data *FvRsNodeAttResourceModel + var stateData *FvRsNodeAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsNodeAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsNodeAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsNodeAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsNodeAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsNodeAttResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_to_static_leaf") + var data *FvRsNodeAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsNodeAtt", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_to_static_leaf with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsNodeAttResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_to_static_leaf") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsNodeAttResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_to_static_leaf with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_to_static_leaf") +} + +func getAndSetFvRsNodeAttAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsNodeAttResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsNodeAtt,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsNodeAtt").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsNodeAtt").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsNodeAttParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "encap" { + data.Encap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "instrImedcy" { + data.InstrImedcy = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mode" { + data.Mode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tDn" { + data.TDn = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsNodeAttList := make([]TagAnnotationFvRsNodeAttResourceModel, 0) + TagTagFvRsNodeAttList := make([]TagTagFvRsNodeAttResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsNodeAtt := TagAnnotationFvRsNodeAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsNodeAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsNodeAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsNodeAttList = append(TagAnnotationFvRsNodeAttList, TagAnnotationFvRsNodeAtt) + } + if childClassName == "tagTag" { + TagTagFvRsNodeAtt := TagTagFvRsNodeAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsNodeAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsNodeAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsNodeAttList = append(TagTagFvRsNodeAttList, TagTagFvRsNodeAtt) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsNodeAttList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsNodeAttList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsNodeAtt'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsNodeAttRn(ctx context.Context, data *FvRsNodeAttResourceModel) string { + rn := "rsnodeAtt-[{tDn}]" + for _, identifier := range []string{"tDn"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsNodeAttParentDn(ctx context.Context, dn string, data *FvRsNodeAttResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsNodeAttId(ctx context.Context, data *FvRsNodeAttResourceModel) { + rn := getFvRsNodeAttRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsNodeAttTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsNodeAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsNodeAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsNodeAttTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsNodeAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsNodeAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsNodeAttCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvRsNodeAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsNodeAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsNodeAttResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsNodeAttTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsNodeAttTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Encap.IsNull() && !data.Encap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["encap"] = data.Encap.ValueString() + } + if !data.InstrImedcy.IsNull() && !data.InstrImedcy.IsUnknown() { + payloadMap["attributes"].(map[string]string)["instrImedcy"] = data.InstrImedcy.ValueString() + } + if !data.Mode.IsNull() && !data.Mode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mode"] = data.Mode.ValueString() + } + if !data.TDn.IsNull() && !data.TDn.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tDn"] = data.TDn.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsNodeAtt": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_to_static_leaf_test.go b/internal/provider/resource_aci_relation_to_static_leaf_test.go new file mode 100644 index 000000000..ffc384772 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_static_leaf_test.go @@ -0,0 +1,259 @@ +// 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 TestAccResourceFvRsNodeAttWithFvAEPg(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: testConfigFvRsNodeAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "regular"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsNodeAttAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", "description"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", "encapsulation"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "native"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsNodeAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsNodeAttResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "regular"), + ), + }, + // Import testing + { + ResourceName: "aci_relation_to_static_leaf.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "regular"), + ), + }, + // Update with children + { + Config: testConfigFvRsNodeAttChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_relation_to_static_leaf.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "target_dn", "topology/pod-1/node-101"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvRsNodeAttChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsNodeAttChildrenRemoveOneDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsNodeAttChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_to_static_leaf.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testDependencyConfigFvRsNodeAtt = ` +` + +const testConfigFvRsNodeAttMinDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 +} +` + +const testConfigFvRsNodeAttAllDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + annotation = "annotation" + deployment_immediacy = "immediate" + description = "description" + encapsulation = "encapsulation" + mode = "native" +} +` + +const testConfigFvRsNodeAttResetDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + annotation = "orchestrator:terraform" + deployment_immediacy = "lazy" + description = "" + encapsulation = "" + mode = "regular" +} +` +const testConfigFvRsNodeAttChildrenDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + 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 testConfigFvRsNodeAttChildrenRemoveFromConfigDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 +} +` + +const testConfigFvRsNodeAttChildrenRemoveOneDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvRsNodeAttChildrenRemoveAllDependencyWithFvAEPg = testDependencyConfigFvRsNodeAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_leaf" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/node-101 + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_relation_to_static_path.go b/internal/provider/resource_aci_relation_to_static_path.go new file mode 100644 index 000000000..cd64d062e --- /dev/null +++ b/internal/provider/resource_aci_relation_to_static_path.go @@ -0,0 +1,646 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FvRsPathAttResource{} +var _ resource.ResourceWithImportState = &FvRsPathAttResource{} + +func NewFvRsPathAttResource() resource.Resource { + return &FvRsPathAttResource{} +} + +// FvRsPathAttResource defines the resource implementation. +type FvRsPathAttResource struct { + client *client.Client +} + +// FvRsPathAttResourceModel describes the resource data model. +type FvRsPathAttResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + Encap types.String `tfsdk:"encapsulation"` + InstrImedcy types.String `tfsdk:"deployment_immediacy"` + Mode types.String `tfsdk:"mode"` + PrimaryEncap types.String `tfsdk:"primary_encapsulation"` + TDn types.String `tfsdk:"target_dn"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFvRsPathAttResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFvRsPathAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFvRsPathAttResourceModel describes the resource data model for the children without relation ships. +type TagTagFvRsPathAttResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FvRsPathAttIdentifier struct { + TDn types.String +} + +func (r *FvRsPathAttResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_relation_to_static_path") + resp.TypeName = req.ProviderTypeName + "_relation_to_static_path" + tflog.Debug(ctx, "End metadata of resource: aci_relation_to_static_path") +} + +func (r *FvRsPathAttResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_relation_to_static_path") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The relation_to_static_path resource for the 'fvRsPathAtt' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Relation To Static Path object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Relation To Static Path object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Relation To Static Path object.`, + }, + "encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The encapsulation method (VLAN) of the path.`, + }, + "deployment_immediacy": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("immediate", "lazy"), + }, + MarkdownDescription: `The deployment immediacy preference of this path association.`, + }, + "mode": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("native", "regular", "untagged"), + }, + MarkdownDescription: `The mode of the static association with the path.`, + }, + "primary_encapsulation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `Represents the primary encap when the EPG is isolated.`, + }, + "target_dn": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `null.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_relation_to_static_path") +} + +func (r *FvRsPathAttResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_relation_to_static_path") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_relation_to_static_path") +} + +func (r *FvRsPathAttResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_relation_to_static_path") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FvRsPathAttResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFvRsPathAttId(ctx, stateData) + getAndSetFvRsPathAttAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FvRsPathAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFvRsPathAttId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsPathAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsPathAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsPathAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsPathAttResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_relation_to_static_path") + var data *FvRsPathAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) + + getAndSetFvRsPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FvRsPathAttResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsPathAttResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_relation_to_static_path") + var data *FvRsPathAttResourceModel + var stateData *FvRsPathAttResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsPathAttResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFvRsPathAttResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFvRsPathAttCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFvRsPathAttAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsPathAttResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_relation_to_static_path") + var data *FvRsPathAttResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fvRsPathAtt", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_relation_to_static_path with id '%s'", data.Id.ValueString())) +} + +func (r *FvRsPathAttResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_relation_to_static_path") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FvRsPathAttResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_relation_to_static_path with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_relation_to_static_path") +} + +func getAndSetFvRsPathAttAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FvRsPathAttResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fvRsPathAtt,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fvRsPathAtt").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fvRsPathAtt").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFvRsPathAttParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "encap" { + data.Encap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "instrImedcy" { + data.InstrImedcy = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "mode" { + data.Mode = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "primaryEncap" { + data.PrimaryEncap = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "tDn" { + data.TDn = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFvRsPathAttList := make([]TagAnnotationFvRsPathAttResourceModel, 0) + TagTagFvRsPathAttList := make([]TagTagFvRsPathAttResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFvRsPathAtt := TagAnnotationFvRsPathAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFvRsPathAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFvRsPathAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFvRsPathAttList = append(TagAnnotationFvRsPathAttList, TagAnnotationFvRsPathAtt) + } + if childClassName == "tagTag" { + TagTagFvRsPathAtt := TagTagFvRsPathAttResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFvRsPathAtt.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFvRsPathAtt.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFvRsPathAttList = append(TagTagFvRsPathAttList, TagTagFvRsPathAtt) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFvRsPathAttList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFvRsPathAttList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fvRsPathAtt'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFvRsPathAttRn(ctx context.Context, data *FvRsPathAttResourceModel) string { + rn := "rspathAtt-[{tDn}]" + for _, identifier := range []string{"tDn"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFvRsPathAttParentDn(ctx context.Context, dn string, data *FvRsPathAttResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFvRsPathAttId(ctx context.Context, data *FvRsPathAttResourceModel) { + rn := getFvRsPathAttRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFvRsPathAttTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsPathAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsPathAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFvRsPathAttTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FvRsPathAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsPathAttResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFvRsPathAttCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FvRsPathAttResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFvRsPathAttResourceModel, tagTagPlan, tagTagState []TagTagFvRsPathAttResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFvRsPathAttTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFvRsPathAttTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.Encap.IsNull() && !data.Encap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["encap"] = data.Encap.ValueString() + } + if !data.InstrImedcy.IsNull() && !data.InstrImedcy.IsUnknown() { + payloadMap["attributes"].(map[string]string)["instrImedcy"] = data.InstrImedcy.ValueString() + } + if !data.Mode.IsNull() && !data.Mode.IsUnknown() { + payloadMap["attributes"].(map[string]string)["mode"] = data.Mode.ValueString() + } + if !data.PrimaryEncap.IsNull() && !data.PrimaryEncap.IsUnknown() { + payloadMap["attributes"].(map[string]string)["primaryEncap"] = data.PrimaryEncap.ValueString() + } + if !data.TDn.IsNull() && !data.TDn.IsUnknown() { + payloadMap["attributes"].(map[string]string)["tDn"] = data.TDn.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fvRsPathAtt": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_relation_to_static_path_test.go b/internal/provider/resource_aci_relation_to_static_path_test.go new file mode 100644 index 000000000..613d576d0 --- /dev/null +++ b/internal/provider/resource_aci_relation_to_static_path_test.go @@ -0,0 +1,267 @@ +// 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 TestAccResourceFvRsPathAttWithFvAEPg(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: testConfigFvRsPathAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", ""), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFvRsPathAttAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "immediate"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", "description"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", "encapsulation"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "native"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", "primary_encapsulation"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFvRsPathAttMinDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFvRsPathAttResetDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", ""), + ), + }, + // Import testing + { + ResourceName: "aci_relation_to_static_path.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", ""), + ), + }, + // Update with children + { + Config: testConfigFvRsPathAttChildrenDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_relation_to_static_path.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "target_dn", "topology/pod-1/paths-101/pathep-[eth1/1]"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "deployment_immediacy", "lazy"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "description", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "mode", "regular"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "primary_encapsulation", ""), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFvRsPathAttChildrenRemoveFromConfigDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFvRsPathAttChildrenRemoveOneDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFvRsPathAttChildrenRemoveAllDependencyWithFvAEPg, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_relation_to_static_path.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testDependencyConfigFvRsPathAtt = ` +` + +const testConfigFvRsPathAttMinDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] +} +` + +const testConfigFvRsPathAttAllDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + annotation = "annotation" + deployment_immediacy = "immediate" + description = "description" + encapsulation = "encapsulation" + mode = "native" + primary_encapsulation = "primary_encapsulation" +} +` + +const testConfigFvRsPathAttResetDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + annotation = "orchestrator:terraform" + deployment_immediacy = "lazy" + description = "" + encapsulation = "" + mode = "regular" + primary_encapsulation = "" +} +` +const testConfigFvRsPathAttChildrenDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + 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 testConfigFvRsPathAttChildrenRemoveFromConfigDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] +} +` + +const testConfigFvRsPathAttChildrenRemoveOneDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFvRsPathAttChildrenRemoveAllDependencyWithFvAEPg = testDependencyConfigFvRsPathAtt + testConfigFvAEPgMinDependencyWithFvAp + ` +resource "aci_relation_to_static_path" "test" { + parent_dn = aci_application_epg.test.id + target_dn = topology/pod-1/paths-101/pathep-[eth1/1] + annotations = [] + tags = [] +} +` diff --git a/internal/provider/resource_aci_trust_control_policy.go b/internal/provider/resource_aci_trust_control_policy.go new file mode 100644 index 000000000..a61239f12 --- /dev/null +++ b/internal/provider/resource_aci_trust_control_policy.go @@ -0,0 +1,733 @@ +// 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 ( + "context" + "encoding/json" + "fmt" + "reflect" + "strings" + + "github.com/ciscoecosystem/aci-go-client/v2/client" + "github.com/ciscoecosystem/aci-go-client/v2/container" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/diag" + "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/hashicorp/terraform-plugin-framework/types/basetypes" + "github.com/hashicorp/terraform-plugin-log/tflog" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ resource.Resource = &FhsTrustCtrlPolResource{} +var _ resource.ResourceWithImportState = &FhsTrustCtrlPolResource{} + +func NewFhsTrustCtrlPolResource() resource.Resource { + return &FhsTrustCtrlPolResource{} +} + +// FhsTrustCtrlPolResource defines the resource implementation. +type FhsTrustCtrlPolResource struct { + client *client.Client +} + +// FhsTrustCtrlPolResourceModel describes the resource data model. +type FhsTrustCtrlPolResourceModel struct { + Id types.String `tfsdk:"id"` + ParentDn types.String `tfsdk:"parent_dn"` + Annotation types.String `tfsdk:"annotation"` + Descr types.String `tfsdk:"description"` + HasDhcpv4Server types.String `tfsdk:"has_dhcpv4_server"` + HasDhcpv6Server types.String `tfsdk:"has_dhcpv6_server"` + HasIpv6Router types.String `tfsdk:"has_ipv6_router"` + Name types.String `tfsdk:"name"` + NameAlias types.String `tfsdk:"name_alias"` + OwnerKey types.String `tfsdk:"owner_key"` + OwnerTag types.String `tfsdk:"owner_tag"` + TrustArp types.String `tfsdk:"trust_arp"` + TrustNd types.String `tfsdk:"trust_nd"` + TrustRa types.String `tfsdk:"trust_ra"` + TagAnnotation types.Set `tfsdk:"annotations"` + TagTag types.Set `tfsdk:"tags"` +} + +// TagAnnotationFhsTrustCtrlPolResourceModel describes the resource data model for the children without relation ships. +type TagAnnotationFhsTrustCtrlPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +// TagTagFhsTrustCtrlPolResourceModel describes the resource data model for the children without relation ships. +type TagTagFhsTrustCtrlPolResourceModel struct { + Key types.String `tfsdk:"key"` + Value types.String `tfsdk:"value"` +} + +type FhsTrustCtrlPolIdentifier struct { + Name types.String +} + +func (r *FhsTrustCtrlPolResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + tflog.Debug(ctx, "Start metadata of resource: aci_trust_control_policy") + resp.TypeName = req.ProviderTypeName + "_trust_control_policy" + tflog.Debug(ctx, "End metadata of resource: aci_trust_control_policy") +} + +func (r *FhsTrustCtrlPolResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) { + tflog.Debug(ctx, "Start schema of resource: aci_trust_control_policy") + resp.Schema = schema.Schema{ + // This description is used by the documentation generator and the language server. + MarkdownDescription: "The trust_control_policy resource for the 'fhsTrustCtrlPol' class", + + Attributes: map[string]schema.Attribute{ + "id": schema.StringAttribute{ + Computed: true, + MarkdownDescription: "The distinguished name (DN) of the Trust Control Policy object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + }, + "parent_dn": schema.StringAttribute{ + Required: true, + MarkdownDescription: "The distinguished name (DN) of the parent object.", + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + }, + "annotation": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Default: stringdefault.StaticString(globalAnnotation), + MarkdownDescription: `The annotation of the Trust Control Policy object.`, + }, + "description": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The description of the Trust Control Policy object.`, + }, + "has_dhcpv4_server": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Contains DHCPv4 servers.`, + }, + "has_dhcpv6_server": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Contains DHCPv6 servers.`, + }, + "has_ipv6_router": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Contains IPv6 routers.`, + }, + "name": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + stringplanmodifier.RequiresReplace(), + }, + MarkdownDescription: `The name of the Trust Control Policy object.`, + }, + "name_alias": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The name alias of the Trust Control Policy object.`, + }, + "owner_key": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key for enabling clients to own their data for entity correlation.`, + }, + "owner_tag": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `A tag for enabling clients to add their own data. For example, to indicate who created this object.`, + }, + "trust_arp": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Trust ARP.`, + }, + "trust_nd": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Trust ND.`, + }, + "trust_ra": schema.StringAttribute{ + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + Validators: []validator.String{ + stringvalidator.OneOf("no", "yes"), + }, + MarkdownDescription: `Trust router advertisement.`, + }, + "annotations": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + "tags": schema.SetNestedAttribute{ + MarkdownDescription: ``, + Optional: true, + Computed: true, + PlanModifiers: []planmodifier.Set{ + setplanmodifier.UseStateForUnknown(), + }, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "key": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The key used to uniquely identify this configuration object.`, + }, + "value": schema.StringAttribute{ + Required: true, + PlanModifiers: []planmodifier.String{ + stringplanmodifier.UseStateForUnknown(), + }, + MarkdownDescription: `The value of the property.`, + }, + }, + }, + }, + }, + } + tflog.Debug(ctx, "End schema of resource: aci_trust_control_policy") +} + +func (r *FhsTrustCtrlPolResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + tflog.Debug(ctx, "Start configure of resource: aci_trust_control_policy") + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*client.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Resource Configure Type", + fmt.Sprintf("Expected *client.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client + tflog.Debug(ctx, "End configure of resource: aci_trust_control_policy") +} + +func (r *FhsTrustCtrlPolResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + tflog.Debug(ctx, "Start create of resource: aci_trust_control_policy") + // On create retrieve information on current state prior to making any changes in order to determine child delete operations + var stateData *FhsTrustCtrlPolResourceModel + resp.Diagnostics.Append(req.Plan.Get(ctx, &stateData)...) + setFhsTrustCtrlPolId(ctx, stateData) + getAndSetFhsTrustCtrlPolAttributes(ctx, &resp.Diagnostics, r.client, stateData) + + var data *FhsTrustCtrlPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + setFhsTrustCtrlPolId(ctx, data) + + tflog.Debug(ctx, fmt.Sprintf("Create of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsTrustCtrlPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFhsTrustCtrlPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFhsTrustCtrlPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + + getAndSetFhsTrustCtrlPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End create of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsTrustCtrlPolResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + tflog.Debug(ctx, "Start read of resource: aci_trust_control_policy") + var data *FhsTrustCtrlPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Read of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) + + getAndSetFhsTrustCtrlPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + if data.Id.IsNull() { + var emptyData *FhsTrustCtrlPolResourceModel + resp.Diagnostics.Append(resp.State.Set(ctx, &emptyData)...) + } else { + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + } + + tflog.Debug(ctx, fmt.Sprintf("End read of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsTrustCtrlPolResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + tflog.Debug(ctx, "Start update of resource: aci_trust_control_policy") + var data *FhsTrustCtrlPolResourceModel + var stateData *FhsTrustCtrlPolResourceModel + + // Read Terraform plan data into the model + resp.Diagnostics.Append(req.Plan.Get(ctx, &data)...) + resp.Diagnostics.Append(req.State.Get(ctx, &stateData)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Update of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) + + var tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsTrustCtrlPolResourceModel + data.TagAnnotation.ElementsAs(ctx, &tagAnnotationPlan, false) + stateData.TagAnnotation.ElementsAs(ctx, &tagAnnotationState, false) + var tagTagPlan, tagTagState []TagTagFhsTrustCtrlPolResourceModel + data.TagTag.ElementsAs(ctx, &tagTagPlan, false) + stateData.TagTag.ElementsAs(ctx, &tagTagState, false) + jsonPayload := getFhsTrustCtrlPolCreateJsonPayload(ctx, &resp.Diagnostics, data, tagAnnotationPlan, tagAnnotationState, tagTagPlan, tagTagState) + + if resp.Diagnostics.HasError() { + return + } + + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + + if resp.Diagnostics.HasError() { + return + } + + getAndSetFhsTrustCtrlPolAttributes(ctx, &resp.Diagnostics, r.client, data) + + // Save updated data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) + tflog.Debug(ctx, fmt.Sprintf("End update of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsTrustCtrlPolResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + tflog.Debug(ctx, "Start delete of resource: aci_trust_control_policy") + var data *FhsTrustCtrlPolResourceModel + + // Read Terraform prior state data into the model + resp.Diagnostics.Append(req.State.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + tflog.Debug(ctx, fmt.Sprintf("Delete of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) + jsonPayload := GetDeleteJsonPayload(ctx, &resp.Diagnostics, "fhsTrustCtrlPol", data.Id.ValueString()) + if resp.Diagnostics.HasError() { + return + } + DoRestRequest(ctx, &resp.Diagnostics, r.client, fmt.Sprintf("api/mo/%s.json", data.Id.ValueString()), "POST", jsonPayload) + if resp.Diagnostics.HasError() { + return + } + tflog.Debug(ctx, fmt.Sprintf("End delete of resource aci_trust_control_policy with id '%s'", data.Id.ValueString())) +} + +func (r *FhsTrustCtrlPolResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + tflog.Debug(ctx, "Start import state of resource: aci_trust_control_policy") + resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp) + + var stateData *FhsTrustCtrlPolResourceModel + resp.Diagnostics.Append(resp.State.Get(ctx, &stateData)...) + tflog.Debug(ctx, fmt.Sprintf("Import state of resource aci_trust_control_policy with id '%s'", stateData.Id.ValueString())) + + tflog.Debug(ctx, "End import of state resource: aci_trust_control_policy") +} + +func getAndSetFhsTrustCtrlPolAttributes(ctx context.Context, diags *diag.Diagnostics, client *client.Client, data *FhsTrustCtrlPolResourceModel) { + requestData := DoRestRequest(ctx, diags, client, fmt.Sprintf("api/mo/%s.json?rsp-subtree=children&rsp-subtree-class=%s", data.Id.ValueString(), "fhsTrustCtrlPol,tagAnnotation,tagTag"), "GET", nil) + + if diags.HasError() { + return + } + if requestData.Search("imdata").Search("fhsTrustCtrlPol").Data() != nil { + classReadInfo := requestData.Search("imdata").Search("fhsTrustCtrlPol").Data().([]interface{}) + if len(classReadInfo) == 1 { + attributes := classReadInfo[0].(map[string]interface{})["attributes"].(map[string]interface{}) + for attributeName, attributeValue := range attributes { + if attributeName == "dn" { + data.Id = basetypes.NewStringValue(attributeValue.(string)) + setFhsTrustCtrlPolParentDn(ctx, attributeValue.(string), data) + } + if attributeName == "annotation" { + data.Annotation = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "descr" { + data.Descr = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hasDhcpv4Server" { + data.HasDhcpv4Server = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hasDhcpv6Server" { + data.HasDhcpv6Server = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "hasIpv6Router" { + data.HasIpv6Router = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "name" { + data.Name = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "nameAlias" { + data.NameAlias = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerKey" { + data.OwnerKey = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "ownerTag" { + data.OwnerTag = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "trustArp" { + data.TrustArp = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "trustNd" { + data.TrustNd = basetypes.NewStringValue(attributeValue.(string)) + } + if attributeName == "trustRa" { + data.TrustRa = basetypes.NewStringValue(attributeValue.(string)) + } + } + TagAnnotationFhsTrustCtrlPolList := make([]TagAnnotationFhsTrustCtrlPolResourceModel, 0) + TagTagFhsTrustCtrlPolList := make([]TagTagFhsTrustCtrlPolResourceModel, 0) + _, ok := classReadInfo[0].(map[string]interface{})["children"] + if ok { + children := classReadInfo[0].(map[string]interface{})["children"].([]interface{}) + for _, child := range children { + for childClassName, childClassDetails := range child.(map[string]interface{}) { + childAttributes := childClassDetails.(map[string]interface{})["attributes"].(map[string]interface{}) + if childClassName == "tagAnnotation" { + TagAnnotationFhsTrustCtrlPol := TagAnnotationFhsTrustCtrlPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagAnnotationFhsTrustCtrlPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagAnnotationFhsTrustCtrlPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagAnnotationFhsTrustCtrlPolList = append(TagAnnotationFhsTrustCtrlPolList, TagAnnotationFhsTrustCtrlPol) + } + if childClassName == "tagTag" { + TagTagFhsTrustCtrlPol := TagTagFhsTrustCtrlPolResourceModel{} + for childAttributeName, childAttributeValue := range childAttributes { + if childAttributeName == "key" { + TagTagFhsTrustCtrlPol.Key = basetypes.NewStringValue(childAttributeValue.(string)) + } + if childAttributeName == "value" { + TagTagFhsTrustCtrlPol.Value = basetypes.NewStringValue(childAttributeValue.(string)) + } + } + TagTagFhsTrustCtrlPolList = append(TagTagFhsTrustCtrlPolList, TagTagFhsTrustCtrlPol) + } + } + } + } + tagAnnotationSet, _ := types.SetValueFrom(ctx, data.TagAnnotation.ElementType(ctx), TagAnnotationFhsTrustCtrlPolList) + data.TagAnnotation = tagAnnotationSet + tagTagSet, _ := types.SetValueFrom(ctx, data.TagTag.ElementType(ctx), TagTagFhsTrustCtrlPolList) + data.TagTag = tagTagSet + } else { + diags.AddError( + "too many results in response", + fmt.Sprintf("%v matches returned for class 'fhsTrustCtrlPol'. Please report this issue to the provider developers.", len(classReadInfo)), + ) + } + } else { + data.Id = basetypes.NewStringNull() + } +} + +func getFhsTrustCtrlPolRn(ctx context.Context, data *FhsTrustCtrlPolResourceModel) string { + rn := "trustctrlpol-{name}" + for _, identifier := range []string{"name"} { + fieldName := fmt.Sprintf("%s%s", strings.ToUpper(identifier[:1]), identifier[1:]) + fieldValue := reflect.ValueOf(data).Elem().FieldByName(fieldName).Interface().(basetypes.StringValue).ValueString() + rn = strings.ReplaceAll(rn, fmt.Sprintf("{%s}", identifier), fieldValue) + } + return rn +} + +func setFhsTrustCtrlPolParentDn(ctx context.Context, dn string, data *FhsTrustCtrlPolResourceModel) { + bracketIndex := 0 + rnIndex := 0 + for i := len(dn) - 1; i >= 0; i-- { + if string(dn[i]) == "]" { + bracketIndex = bracketIndex + 1 + } else if string(dn[i]) == "[" { + bracketIndex = bracketIndex - 1 + } else if string(dn[i]) == "/" && bracketIndex == 0 { + rnIndex = i + break + } + } + data.ParentDn = basetypes.NewStringValue(dn[:rnIndex]) +} + +func setFhsTrustCtrlPolId(ctx context.Context, data *FhsTrustCtrlPolResourceModel) { + rn := getFhsTrustCtrlPolRn(ctx, data) + data.Id = types.StringValue(fmt.Sprintf("%s/%s", data.ParentDn.ValueString(), rn)) +} + +func getFhsTrustCtrlPolTagAnnotationChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FhsTrustCtrlPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsTrustCtrlPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagAnnotation.IsUnknown() { + tagAnnotationIdentifiers := []TagAnnotationIdentifier{} + for _, tagAnnotation := range tagAnnotationPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagAnnotation.Key.IsUnknown() { + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + } + if !tagAnnotation.Value.IsUnknown() { + childMap["attributes"]["value"] = tagAnnotation.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + tagAnnotationIdentifier := TagAnnotationIdentifier{} + tagAnnotationIdentifier.Key = tagAnnotation.Key + tagAnnotationIdentifiers = append(tagAnnotationIdentifiers, tagAnnotationIdentifier) + } + for _, tagAnnotation := range tagAnnotationState { + delete := true + for _, tagAnnotationIdentifier := range tagAnnotationIdentifiers { + if tagAnnotationIdentifier.Key == tagAnnotation.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagAnnotation.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagAnnotation": childMap}) + } + } + } else { + data.TagAnnotation = types.SetNull(data.TagAnnotation.ElementType(ctx)) + } + + return childPayloads +} +func getFhsTrustCtrlPolTagTagChildPayloads(ctx context.Context, diags *diag.Diagnostics, data *FhsTrustCtrlPolResourceModel, tagTagPlan, tagTagState []TagTagFhsTrustCtrlPolResourceModel) []map[string]interface{} { + + childPayloads := []map[string]interface{}{} + if !data.TagTag.IsUnknown() { + tagTagIdentifiers := []TagTagIdentifier{} + for _, tagTag := range tagTagPlan { + childMap := map[string]map[string]interface{}{"attributes": {}} + if !tagTag.Key.IsUnknown() { + childMap["attributes"]["key"] = tagTag.Key.ValueString() + } + if !tagTag.Value.IsUnknown() { + childMap["attributes"]["value"] = tagTag.Value.ValueString() + } + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + tagTagIdentifier := TagTagIdentifier{} + tagTagIdentifier.Key = tagTag.Key + tagTagIdentifiers = append(tagTagIdentifiers, tagTagIdentifier) + } + for _, tagTag := range tagTagState { + delete := true + for _, tagTagIdentifier := range tagTagIdentifiers { + if tagTagIdentifier.Key == tagTag.Key { + delete = false + break + } + } + if delete { + childMap := map[string]map[string]interface{}{"attributes": {}} + childMap["attributes"]["status"] = "deleted" + childMap["attributes"]["key"] = tagTag.Key.ValueString() + childPayloads = append(childPayloads, map[string]interface{}{"tagTag": childMap}) + } + } + } else { + data.TagTag = types.SetNull(data.TagTag.ElementType(ctx)) + } + + return childPayloads +} + +func getFhsTrustCtrlPolCreateJsonPayload(ctx context.Context, diags *diag.Diagnostics, data *FhsTrustCtrlPolResourceModel, tagAnnotationPlan, tagAnnotationState []TagAnnotationFhsTrustCtrlPolResourceModel, tagTagPlan, tagTagState []TagTagFhsTrustCtrlPolResourceModel) *container.Container { + payloadMap := map[string]interface{}{} + payloadMap["attributes"] = map[string]string{} + childPayloads := []map[string]interface{}{} + + TagAnnotationchildPayloads := getFhsTrustCtrlPolTagAnnotationChildPayloads(ctx, diags, data, tagAnnotationPlan, tagAnnotationState) + if TagAnnotationchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagAnnotationchildPayloads...) + + TagTagchildPayloads := getFhsTrustCtrlPolTagTagChildPayloads(ctx, diags, data, tagTagPlan, tagTagState) + if TagTagchildPayloads == nil { + return nil + } + childPayloads = append(childPayloads, TagTagchildPayloads...) + + payloadMap["children"] = childPayloads + if !data.Annotation.IsNull() && !data.Annotation.IsUnknown() { + payloadMap["attributes"].(map[string]string)["annotation"] = data.Annotation.ValueString() + } + if !data.Descr.IsNull() && !data.Descr.IsUnknown() { + payloadMap["attributes"].(map[string]string)["descr"] = data.Descr.ValueString() + } + if !data.HasDhcpv4Server.IsNull() && !data.HasDhcpv4Server.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hasDhcpv4Server"] = data.HasDhcpv4Server.ValueString() + } + if !data.HasDhcpv6Server.IsNull() && !data.HasDhcpv6Server.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hasDhcpv6Server"] = data.HasDhcpv6Server.ValueString() + } + if !data.HasIpv6Router.IsNull() && !data.HasIpv6Router.IsUnknown() { + payloadMap["attributes"].(map[string]string)["hasIpv6Router"] = data.HasIpv6Router.ValueString() + } + if !data.Name.IsNull() && !data.Name.IsUnknown() { + payloadMap["attributes"].(map[string]string)["name"] = data.Name.ValueString() + } + if !data.NameAlias.IsNull() && !data.NameAlias.IsUnknown() { + payloadMap["attributes"].(map[string]string)["nameAlias"] = data.NameAlias.ValueString() + } + if !data.OwnerKey.IsNull() && !data.OwnerKey.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerKey"] = data.OwnerKey.ValueString() + } + if !data.OwnerTag.IsNull() && !data.OwnerTag.IsUnknown() { + payloadMap["attributes"].(map[string]string)["ownerTag"] = data.OwnerTag.ValueString() + } + if !data.TrustArp.IsNull() && !data.TrustArp.IsUnknown() { + payloadMap["attributes"].(map[string]string)["trustArp"] = data.TrustArp.ValueString() + } + if !data.TrustNd.IsNull() && !data.TrustNd.IsUnknown() { + payloadMap["attributes"].(map[string]string)["trustNd"] = data.TrustNd.ValueString() + } + if !data.TrustRa.IsNull() && !data.TrustRa.IsUnknown() { + payloadMap["attributes"].(map[string]string)["trustRa"] = data.TrustRa.ValueString() + } + + payload, err := json.Marshal(map[string]interface{}{"fhsTrustCtrlPol": payloadMap}) + if err != nil { + diags.AddError( + "Marshalling of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + + jsonPayload, err := container.ParseJSON(payload) + + if err != nil { + diags.AddError( + "Construction of json payload failed", + fmt.Sprintf("Err: %s. Please report this issue to the provider developers.", err), + ) + return nil + } + return jsonPayload +} diff --git a/internal/provider/resource_aci_trust_control_policy_test.go b/internal/provider/resource_aci_trust_control_policy_test.go new file mode 100644 index 000000000..d1cd0156a --- /dev/null +++ b/internal/provider/resource_aci_trust_control_policy_test.go @@ -0,0 +1,304 @@ +// 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 TestAccResourceFhsTrustCtrlPolWithFvTenant(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: testConfigFhsTrustCtrlPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "false"), + ), + }, + // Update with all config and verify default APIC values + { + Config: testConfigFhsTrustCtrlPolAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "annotation"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", "description"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "no"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "no"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "no"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", "name_alias"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", "owner_key"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", "owner_tag"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "no"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "no"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "no"), + ), + }, + // Update with minimum config and verify config is unchanged + { + Config: testConfigFhsTrustCtrlPolMinDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + ), + }, + // Update with empty strings config or default value + { + Config: testConfigFhsTrustCtrlPolResetDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "false"), + ), + }, + // Import testing + { + ResourceName: "aci_trust_control_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "false"), + ), + }, + // Update with children + { + Config: testConfigFhsTrustCtrlPolChildrenDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.value", "value_2"), + ), + }, + // Import testing with children + { + ResourceName: "aci_trust_control_policy.test", + ImportState: true, + ImportStateVerify: true, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name", "test_name"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotation", "orchestrator:terraform"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "description", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv4_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_dhcpv6_server", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "has_ipv6_router", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "name_alias", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_key", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "owner_tag", ""), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_arp", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_nd", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "trust_ra", "false"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.value", "value_2"), + ), + }, + // Update with children removed from config + { + Config: testConfigFhsTrustCtrlPolChildrenRemoveFromConfigDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.#", "2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.key", "key_0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.value", "value_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.1.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.#", "2"), + ), + }, + // Update with children first child removed + { + Config: testConfigFhsTrustCtrlPolChildrenRemoveOneDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.#", "1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.key", "key_1"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.0.value", "value_2"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.#", "1"), + ), + }, + // Update with all children removed + { + Config: testConfigFhsTrustCtrlPolChildrenRemoveAllDependencyWithFvTenant, + ExpectNonEmptyPlan: false, + Check: resource.ComposeAggregateTestCheckFunc( + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "annotations.#", "0"), + resource.TestCheckResourceAttr("aci_trust_control_policy.test", "tags.#", "0"), + ), + }, + }, + }) +} + +const testConfigFhsTrustCtrlPolMinDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFhsTrustCtrlPolAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "annotation" + description = "description" + has_dhcpv4_server = "no" + has_dhcpv6_server = "no" + has_ipv6_router = "no" + name_alias = "name_alias" + owner_key = "owner_key" + owner_tag = "owner_tag" + trust_arp = "no" + trust_nd = "no" + trust_ra = "no" +} +` + +const testConfigFhsTrustCtrlPolResetDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotation = "orchestrator:terraform" + description = "" + has_dhcpv4_server = "false" + has_dhcpv6_server = "false" + has_ipv6_router = "false" + name_alias = "" + owner_key = "" + owner_tag = "" + trust_arp = "false" + trust_nd = "false" + trust_ra = "false" +} +` +const testConfigFhsTrustCtrlPolChildrenDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + 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 testConfigFhsTrustCtrlPolChildrenRemoveFromConfigDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" +} +` + +const testConfigFhsTrustCtrlPolChildrenRemoveOneDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [ + { + key = "key_1" + value = "value_2" + }, + ] + tags = [ + { + key = "key_1" + value = "value_2" + }, + ] +} +` + +const testConfigFhsTrustCtrlPolChildrenRemoveAllDependencyWithFvTenant = testConfigFvTenantMin + ` +resource "aci_trust_control_policy" "test" { + parent_dn = aci_tenant.test.id + name = "test_name" + annotations = [] + tags = [] +} +` diff --git a/internal/provider/test_constants.go b/internal/provider/test_constants.go index dd9dfd73c..5383a2867 100644 --- a/internal/provider/test_constants.go +++ b/internal/provider/test_constants.go @@ -27,13 +27,6 @@ resource "aci_application_profile" "test" { } ` -const testConfigFvAEPgMinDependencyWithFvAp = testConfigFvApMinDependencyWithFvTenant + ` -resource "aci_application_epg" "test" { - application_profile_dn = aci_application_profile.test.id - name = "test_epg" -} -` - const testConfigFvAEPgMin = testConfigFvTenantMin + ` resource "aci_application_profile" "test" { tenant_dn = aci_tenant.test.id