From c33758e557ae805d80da61912663c41ad1d7874d Mon Sep 17 00:00:00 2001 From: Rutvik Shiyani <88027613+RutvikS-crest@users.noreply.github.com> Date: Fri, 5 Aug 2022 14:50:30 +0530 Subject: [PATCH 1/3] Terraformer updates (#920) * Updated Read function in access_switch_policy_group * User security role update (#151) * Updated fabricNodeControl and userSecurityDomainRole * Updated user security domain * Updated Read Function for UI Deletion Test case (#152) * added set for annotation in ldap_group_map * Updated resources (#155) * aaep_to_domain resource file updated, dn changed and description removed (#156) * updated documentation * updated documentation for match_rule * resource_tagannotation updated (#159) * tag_resource schema updated * Updated Index file of Interface Blacklist * Updated Mgmt Zone (#162) * updated docs --- aci/resource_aci_aaaldapgroupmap.go | 1 + aci/resource_aci_aaaradiusprovider.go | 1 + aci/resource_aci_aaauserep.go | 2 +- aci/resource_aci_aaauserrole.go | 2 +- aci/resource_aci_fabricrsoospath.go | 50 ++++++++++++++++++- aci/resource_aci_fvrsconsif.go | 12 ++++- aci/resource_aci_infrarsdomp.go | 11 ++-- aci/resource_aci_isisdompol.go | 2 +- aci/resource_aci_rtctrlmatchcommterm.go | 2 +- aci/resource_aci_tacacssrc.go | 1 + aci/resource_aci_tagannotation.go | 4 +- aci/resource_aci_tagtag.go | 4 +- .../aci-go-client/models/fv_rs_cons_if.go | 2 + .../docs/d/interface_blacklist.html.markdown | 2 +- website/docs/r/file_remote_path.html.markdown | 1 + .../docs/r/interface_blacklist.html.markdown | 2 +- website/docs/r/match_rule.html.markdown | 3 +- website/docs/r/recurring_window.html.markdown | 1 + .../r/route_control_context.html.markdown | 2 + .../spine_access_port_selector.html.markdown | 2 +- 20 files changed, 87 insertions(+), 20 deletions(-) diff --git a/aci/resource_aci_aaaldapgroupmap.go b/aci/resource_aci_aaaldapgroupmap.go index efebec102..b03e22ff7 100644 --- a/aci/resource_aci_aaaldapgroupmap.go +++ b/aci/resource_aci_aaaldapgroupmap.go @@ -63,6 +63,7 @@ func setLDAPGroupMapAttributes(aaaLdapGroupMap *models.LDAPGroupMap, d *schema.R if err != nil { return d, err } + d.Set("annotation", aaaLdapGroupMapMap["annotation"]) d.Set("name", aaaLdapGroupMapMap["name"]) d.Set("name_alias", aaaLdapGroupMapMap["nameAlias"]) return d, nil diff --git a/aci/resource_aci_aaaradiusprovider.go b/aci/resource_aci_aaaradiusprovider.go index 249d5adbe..d3b3eda2e 100644 --- a/aci/resource_aci_aaaradiusprovider.go +++ b/aci/resource_aci_aaaradiusprovider.go @@ -131,6 +131,7 @@ func setRADIUSProviderAttributes(radius_type string, aaaRadiusProvider *models.R d.Set("retries", aaaRadiusProviderMap["retries"]) d.Set("timeout", aaaRadiusProviderMap["timeout"]) d.Set("name_alias", aaaRadiusProviderMap["nameAlias"]) + d.Set("annotation", aaaRadiusProviderMap["annotation"]) return d, nil } diff --git a/aci/resource_aci_aaauserep.go b/aci/resource_aci_aaauserep.go index 2a6687483..a7bdaa9f5 100644 --- a/aci/resource_aci_aaauserep.go +++ b/aci/resource_aci_aaauserep.go @@ -634,7 +634,7 @@ func resourceAciUserManagementRead(ctx context.Context, d *schema.ResourceData, aaaPwdProfileDn := dn + "/pwdprofile" aaaPwdProfile, err := getRemotePasswordChangeExpirationPolicy(aciClient, aaaPwdProfileDn) if err != nil { - return diag.FromErr(err) + return nil } _, err = setPasswordChangeExpirationPolicyAttributes(aaaPwdProfile, d) if err != nil { diff --git a/aci/resource_aci_aaauserrole.go b/aci/resource_aci_aaauserrole.go index 8dc7043a0..e2bc6a92c 100644 --- a/aci/resource_aci_aaauserrole.go +++ b/aci/resource_aci_aaauserrole.go @@ -63,7 +63,7 @@ func getRemoteUserRole(client *client.Client, dn string) (*models.UserRole, erro func setUserRoleAttributes(aaaUserRole *models.UserRole, d *schema.ResourceData) (*schema.ResourceData, error) { d.SetId(aaaUserRole.DistinguishedName) d.Set("description", aaaUserRole.Description) - + d.Set("annotation", aaaUserRole.Annotation) aaaUserRoleMap, err := aaaUserRole.ToMap() if err != nil { return nil, err diff --git a/aci/resource_aci_fabricrsoospath.go b/aci/resource_aci_fabricrsoospath.go index 2fab94196..7d3180bac 100644 --- a/aci/resource_aci_fabricrsoospath.go +++ b/aci/resource_aci_fabricrsoospath.go @@ -25,11 +25,14 @@ func resourceAciOutofServiceFabricPath() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ + Schema: map[string]*schema.Schema{ "annotation": { Type: schema.TypeString, Optional: true, Computed: true, + DefaultFunc: func() (interface{}, error) { + return "orchestrator:terraform", nil + }, }, "pod_id": { Type: schema.TypeInt, @@ -51,7 +54,7 @@ func resourceAciOutofServiceFabricPath() *schema.Resource { Required: true, ForceNew: true, }, - }), + }, } } @@ -73,6 +76,49 @@ func setOutofServiceFabricPathAttributes(fabricRsOosPath *models.OutofServiceFab if err != nil { return d, err } + if fabricRsOosPath.TDn != "" { + interfaceRegEx := regexp.MustCompile(`topology/pod-([0-9]+?)/paths-([0-9]+?)/pathep-\[(.*?)\]`) + fexRegEx := regexp.MustCompile(`topology/pod-([0-9]+?)/paths-([0-9]+?)/extpaths-([0-9]+?)/pathep-\[(.*?)\]`) + matchInterface := interfaceRegEx.FindStringSubmatch(fabricRsOosPath.TDn) + if len(matchInterface) > 0 { + podId, err := strconv.Atoi(matchInterface[1]) + if err != nil { + return nil, err + } + d.Set("pod_id", podId) + + nodeId, err := strconv.Atoi(matchInterface[2]) + if err != nil { + return nil, err + } + d.Set("node_id", nodeId) + + d.Set("interface", matchInterface[3]) + } else { + matchFex := fexRegEx.FindStringSubmatch(fabricRsOosPath.TDn) + if len(matchFex) > 0 { + podId, err := strconv.Atoi(matchFex[1]) + if err != nil { + return nil, err + } + d.Set("pod_id", podId) + + nodeId, err := strconv.Atoi(matchFex[2]) + if err != nil { + return nil, err + } + d.Set("node_id", nodeId) + + fexId, err := strconv.Atoi(matchFex[3]) + if err != nil { + return nil, err + } + d.Set("fex_id", fexId) + + d.Set("interface", matchFex[4]) + } + } + } d.Set("annotation", fabricRsOosPathMap["annotation"]) return d, nil } diff --git a/aci/resource_aci_fvrsconsif.go b/aci/resource_aci_fvrsconsif.go index f50b74a7c..e80cad107 100644 --- a/aci/resource_aci_fvrsconsif.go +++ b/aci/resource_aci_fvrsconsif.go @@ -24,12 +24,20 @@ func resourceAciContractInterfaceRelationship() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ + Schema: map[string]*schema.Schema{ "application_epg_dn": { Type: schema.TypeString, Required: true, ForceNew: true, }, + "annotation": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + DefaultFunc: func() (interface{}, error) { + return "orchestrator:terraform", nil + }, + }, "prio": { Type: schema.TypeString, Optional: true, @@ -49,7 +57,7 @@ func resourceAciContractInterfaceRelationship() *schema.Resource { Required: true, ForceNew: true, }, - }), + }, } } diff --git a/aci/resource_aci_infrarsdomp.go b/aci/resource_aci_infrarsdomp.go index abee5bb8f..e0c11d8c6 100644 --- a/aci/resource_aci_infrarsdomp.go +++ b/aci/resource_aci_infrarsdomp.go @@ -23,23 +23,26 @@ func resourceAciInfraRsDomP() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ + Schema: map[string]*schema.Schema{ "attachable_access_entity_profile_dn": { Type: schema.TypeString, Required: true, ForceNew: true, }, - "annotation": { + "annotation": &schema.Schema{ Type: schema.TypeString, Optional: true, Computed: true, + DefaultFunc: func() (interface{}, error) { + return "orchestrator:terraform", nil + }, }, "domain_dn": { Type: schema.TypeString, Required: true, ForceNew: true, }, - }), + }, } } @@ -61,11 +64,11 @@ func setInfraRsDomPAttributes(infraRsDomP *models.InfraRsDomP, d *schema.Resourc if dn != infraRsDomP.DistinguishedName { d.Set("attachable_access_entity_profile_dn", "") } - d.Set("attachable_access_entity_profile_dn", GetParentDn(dn, fmt.Sprintf("/%s", fmt.Sprintf(models.RninfraRsDomP, d.Get("domain_dn"))))) infraRsDomPMap, err := infraRsDomP.ToMap() if err != nil { return d, err } + d.Set("attachable_access_entity_profile_dn", GetParentDn(dn, fmt.Sprintf("/rsdomP-[%s]", infraRsDomPMap["tDn"]))) d.Set("annotation", infraRsDomPMap["annotation"]) d.Set("domain_dn", infraRsDomPMap["tDn"]) return d, nil diff --git a/aci/resource_aci_isisdompol.go b/aci/resource_aci_isisdompol.go index 4604fa872..ea0fb2fa8 100644 --- a/aci/resource_aci_isisdompol.go +++ b/aci/resource_aci_isisdompol.go @@ -369,7 +369,7 @@ func resourceAciISISDomainPolicyRead(ctx context.Context, d *schema.ResourceData if isisCompDn != "" { isisLvlComp, err := getRemoteISISLevel(aciClient, isisCompDn) if err != nil { - return diag.FromErr(err) + return nil } _, err = setISISLevelAttributes(isisLvlComp, d) if err != nil { diff --git a/aci/resource_aci_rtctrlmatchcommterm.go b/aci/resource_aci_rtctrlmatchcommterm.go index f57b7263b..9292d5622 100644 --- a/aci/resource_aci_rtctrlmatchcommterm.go +++ b/aci/resource_aci_rtctrlmatchcommterm.go @@ -331,7 +331,7 @@ func resourceAciMatchCommunityTermRead(ctx context.Context, d *schema.ResourceDa rtctrlMatchCommFactor, err := getRemoteMatchCommunityFactor(aciClient, dn) if err != nil { d.SetId("") - return diag.FromErr(err) + return nil } factorSet, err := setMatchCommunityFactorAttributes(rtctrlMatchCommFactor, make(map[string]string)) if err != nil { diff --git a/aci/resource_aci_tacacssrc.go b/aci/resource_aci_tacacssrc.go index ef5cfa8ae..80d64f16b 100644 --- a/aci/resource_aci_tacacssrc.go +++ b/aci/resource_aci_tacacssrc.go @@ -121,6 +121,7 @@ func setTACACSSourceAttributes(tacacsSrc *models.TACACSSource, d *schema.Resourc d.Set("min_sev", tacacsSrcMap["minSev"]) d.Set("name", tacacsSrcMap["name"]) d.Set("name_alias", tacacsSrcMap["nameAlias"]) + d.Set("annotation", tacacsSrcMap["annotation"]) return d, nil } diff --git a/aci/resource_aci_tagannotation.go b/aci/resource_aci_tagannotation.go index 65366357b..5786dcb23 100644 --- a/aci/resource_aci_tagannotation.go +++ b/aci/resource_aci_tagannotation.go @@ -23,7 +23,7 @@ func resourceAciAnnotation() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ + Schema: map[string]*schema.Schema{ "parent_dn": { Type: schema.TypeString, Required: true, @@ -38,7 +38,7 @@ func resourceAciAnnotation() *schema.Resource { Type: schema.TypeString, Required: true, }, - }), + }, } } diff --git a/aci/resource_aci_tagtag.go b/aci/resource_aci_tagtag.go index 186684b14..d6707a051 100644 --- a/aci/resource_aci_tagtag.go +++ b/aci/resource_aci_tagtag.go @@ -23,7 +23,7 @@ func resourceAciTag() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendBaseAttrSchema(map[string]*schema.Schema{ + Schema: map[string]*schema.Schema{ "parent_dn": { Type: schema.TypeString, Required: true, @@ -38,7 +38,7 @@ func resourceAciTag() *schema.Resource { Type: schema.TypeString, Required: true, }, - }), + }, } } diff --git a/vendor/github.com/ciscoecosystem/aci-go-client/models/fv_rs_cons_if.go b/vendor/github.com/ciscoecosystem/aci-go-client/models/fv_rs_cons_if.go index 5ec87cc7e..9871a2f05 100644 --- a/vendor/github.com/ciscoecosystem/aci-go-client/models/fv_rs_cons_if.go +++ b/vendor/github.com/ciscoecosystem/aci-go-client/models/fv_rs_cons_if.go @@ -48,6 +48,7 @@ func (fvRsConsIf *ContractInterfaceRelationship) ToMap() (map[string]string, err A(fvRsConsIfMap, "prio", fvRsConsIf.Prio) A(fvRsConsIfMap, "tnVzCPIfName", fvRsConsIf.TnVzCPIfName) A(fvRsConsIfMap, "tDn", fvRsConsIf.tDn) + A(fvRsConsIfMap, "annotation", fvRsConsIf.Annotation) return fvRsConsIfMap, err } @@ -64,6 +65,7 @@ func ContractInterfaceRelationshipFromContainerList(cont *container.Container, i Prio: G(ContractInterfaceRelationshipCont, "prio"), TnVzCPIfName: G(ContractInterfaceRelationshipCont, "tnVzCPIfName"), tDn: G(ContractInterfaceRelationshipCont, "tDn"), + Annotation: G(ContractInterfaceRelationshipCont, "annotation"), }, } } diff --git a/website/docs/d/interface_blacklist.html.markdown b/website/docs/d/interface_blacklist.html.markdown index db2b8f4ec..1cccf388e 100644 --- a/website/docs/d/interface_blacklist.html.markdown +++ b/website/docs/d/interface_blacklist.html.markdown @@ -34,7 +34,7 @@ data "aci_outof_service_fabric_path" "example" { * `pod_id` - (Required) The Pod ID of the switch that own the interface that need to be disabled. * `node_id` - (Required) The Node ID of the switch that own the interface that need to be disabled. -* `fex_id` - (Required) The FEX ID of the FEX that own the interface that need to be disabled. +* `fex_id` - (Optional) The FEX ID of the FEX that own the interface that need to be disabled. * `interface` - (Required) The interface name of the interface that need to be disabled. ## Attribute Reference ## diff --git a/website/docs/r/file_remote_path.html.markdown b/website/docs/r/file_remote_path.html.markdown index 618da286a..1ef7f471c 100644 --- a/website/docs/r/file_remote_path.html.markdown +++ b/website/docs/r/file_remote_path.html.markdown @@ -37,6 +37,7 @@ resource "aci_file_remote_path" "example" { ## Argument Reference ## * `name` - (Required) Name of object File Remote Path. * `host` - (Required) Hostname or IP for export destination of object File Remote Path. +* `name_alias` - (Optional) Name alias for object File Remote Path. * `annotation` - (Optional) Annotation of object File Remote Path. * `auth_type` - (Optional) Authentication Type Choice. Allowed values are "usePassword" and "useSshKeyContents". Default value is "usePassword". Type: String. * `identity_private_key_contents` - (Optional) SSH Private Key File contents for datatransfer. Must be set if `auth_type` is equal to "useSshKeyContents". diff --git a/website/docs/r/interface_blacklist.html.markdown b/website/docs/r/interface_blacklist.html.markdown index 537dcc411..ac1a89624 100644 --- a/website/docs/r/interface_blacklist.html.markdown +++ b/website/docs/r/interface_blacklist.html.markdown @@ -34,7 +34,7 @@ resource "aci_interface_blacklist" "example" { * `pod_id` - (Required) The Pod ID of the switch that own the interface that need to be disabled. * `node_id` - (Required) The Node ID of the switch that own the interface that need to be disabled. -* `fex_id` - (Required) The FEX ID of the FEX that own the interface that need to be disabled. +* `fex_id` - (Optional) The FEX ID of the FEX that own the interface that need to be disabled. * `interface` - (Required) The interface name of the interface that need to be disabled. * `annotation` - (Optional) Annotation of the blacklist object (fabricRsOosPath). diff --git a/website/docs/r/match_rule.html.markdown b/website/docs/r/match_rule.html.markdown index 7443ebc81..8d3d4ce54 100644 --- a/website/docs/r/match_rule.html.markdown +++ b/website/docs/r/match_rule.html.markdown @@ -36,7 +36,8 @@ resource "aci_match_rule" "rule" { * `tenant_dn` - (Required) Distinguished name of parent Tenant object. * `name` - (Required) Name of object Match Rule. * `annotation` - (Optional) Annotation of object Match Rule. - +* `name_alias` - (Optional) Name alias for object Match Rule. +* `description` - (Optional) Description of object Match Rule. ## Importing ## diff --git a/website/docs/r/recurring_window.html.markdown b/website/docs/r/recurring_window.html.markdown index cdcb90fde..4e17530da 100644 --- a/website/docs/r/recurring_window.html.markdown +++ b/website/docs/r/recurring_window.html.markdown @@ -43,6 +43,7 @@ resource "aci_recurring_window" "example" { * `scheduler_dn` - (Required) Distinguished name of parent Scheduler object. * `name` - (Required) Name of object Recurring Window. +* `name_alias` - (Optional) Name alias for object Recurring Window. * `annotation` - (Optional) Annotation of object Recurring Window. * `concur_cap` - (Optional) Maximum Concurrent Tasks. The concurrency capacity limit. This is the maximum number of tasks that can be processed concurrently. Range: "1" - "65535". Default value is "unlimited"(If user sets "0" as a value, provider will accept it but it'll set it as "unlimited"). Type: String. * `day` - (Optional) Recurring Window Schedule Day. The day of the week that the recurring window begins. Allowed values are "Friday", "Monday", "Saturday", "Sunday", "Thursday", "Tuesday", "Wednesday", "even-day", "every-day", "odd-day", and default value is "every-day". Type: String. diff --git a/website/docs/r/route_control_context.html.markdown b/website/docs/r/route_control_context.html.markdown index 5015d6da7..c1f120f8b 100644 --- a/website/docs/r/route_control_context.html.markdown +++ b/website/docs/r/route_control_context.html.markdown @@ -41,6 +41,8 @@ resource "aci_route_control_context" "control" { * `annotation` - (Optional) Annotation of object Route Control Context. * `action` - (Optional) Action. The action required when the condition is met. Allowed values are "deny", "permit", and default value is "permit". Type: String. * `order` - (Optional) Local Order.The order of the policy context. Allowed range is 0-9 and default value is "0". +- `description` - (Optional) Description of object Route Control Context. +- `name_alias` - (Optional) Name alias of object Route Control Context. * `set_rule` - (Optional) Represents the relation to an Attribute Profile (class rtctrlAttrP). Type: String. * `relation_rtctrl_rs_ctx_p_to_subj_p` - (Optional) Represents the relation to a Subject Profile (class rtctrlSubjP). Type: List. diff --git a/website/docs/r/spine_access_port_selector.html.markdown b/website/docs/r/spine_access_port_selector.html.markdown index 5f8db67a7..e8aba64d6 100644 --- a/website/docs/r/spine_access_port_selector.html.markdown +++ b/website/docs/r/spine_access_port_selector.html.markdown @@ -42,7 +42,7 @@ resource "aci_spine_access_port_selector" "example" { * `spine_access_port_selector_type` - (Required) The type of Spine Access Port Selector. Allowed values are "ALL" and "range". Default is "ALL". The "range" can be specified with the resource "aci_access_port_block". * `annotation` - (Optional) Annotation of the Spine Access Port Selector. * `name_alias` - (Optional) Name Alias of the Spine Access Port Selector. - +- `description` - (Optional) Description of object Spine Access Port Selector. * `relation_infra_rs_sp_acc_grp` - (Optional) Represents the relation to a Spine Access Group (class infraSpAccGrp). Type: String. From 3c95dbf7ea55e94c2d90021418953d969df18fc3 Mon Sep 17 00:00:00 2001 From: RutvikS-crest Date: Mon, 31 Oct 2022 12:55:22 +0530 Subject: [PATCH 2/3] added Annotation Schema function --- aci/base_attr_schema.go | 23 + aci/resource_aci_bgpprotp.go | 57 +- aci/resource_aci_cloudrouterp.go | 6 - aci/resource_aci_dhcprelayp.go | 6 - aci/resource_aci_fabricexplicitgep.go | 57 +- aci/resource_aci_fabricrsoospath.go | 52 +- aci/resource_aci_fcdomp.go | 122 +++-- aci/resource_aci_fvrsconsif.go | 59 +-- aci/resource_aci_fvrsdomatt.go | 375 +++++++------ aci/resource_aci_infrarsaccbasegrp.go | 42 +- aci/resource_aci_infrarsdomp.go | 31 +- aci/resource_aci_infrarsfunctoepg.go | 89 ++-- aci/resource_aci_infrarsspaccportp.go | 33 +- ...source_aci_infrarsspaccportp_deprecated.go | 33 +- aci/resource_aci_l2extdomp.go | 81 ++- aci/resource_aci_l3extdomp.go | 82 ++- aci/resource_aci_mgmtgrp.go | 24 +- aci/resource_aci_physdomp.go | 77 ++- aci/resource_aci_snmpctxp.go | 33 +- aci/resource_aci_trigrecurrwindowp.go | 152 +++--- aci/resource_aci_vmmctrlrp.go | 405 +++++++------- aci/resource_aci_vmmdomp.go | 495 +++++++++--------- aci/resource_aci_vnsabsnode.go | 6 - 23 files changed, 1125 insertions(+), 1215 deletions(-) diff --git a/aci/base_attr_schema.go b/aci/base_attr_schema.go index 0cb48837e..7e6037ac7 100644 --- a/aci/base_attr_schema.go +++ b/aci/base_attr_schema.go @@ -20,6 +20,29 @@ func GetBaseAttrSchema() map[string]*schema.Schema { } } +func GetAnnotationAttrSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "annotation": { + Type: schema.TypeString, + Optional: true, + Computed: true, + DefaultFunc: func() (interface{}, error) { + return "orchestrator:terraform", nil + }, + }, + } +} + +func GetDescriptionAttrSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "description": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + } +} + func GetAllowEmptyAttrSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "allow_empty_result": &schema.Schema{ diff --git a/aci/resource_aci_bgpprotp.go b/aci/resource_aci_bgpprotp.go index 2ade9da08..64f9aae72 100644 --- a/aci/resource_aci_bgpprotp.go +++ b/aci/resource_aci_bgpprotp.go @@ -24,36 +24,35 @@ func resourceAciL3outBGPProtocolProfile() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "logical_node_profile_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "logical_node_profile_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "relation_bgp_rs_best_path_ctrl_pol": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + }, + "relation_bgp_rs_bgp_node_ctx_pol": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + }, }, - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Default: "orchestrator:terraform", - }, - "relation_bgp_rs_best_path_ctrl_pol": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - "relation_bgp_rs_bgp_node_ctx_pol": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - }, - }, + ), } } func getRemoteL3outBGPProtocolProfile(client *client.Client, dn string) (*models.L3outBGPProtocolProfile, error) { diff --git a/aci/resource_aci_cloudrouterp.go b/aci/resource_aci_cloudrouterp.go index f3d8b5900..09261adbb 100644 --- a/aci/resource_aci_cloudrouterp.go +++ b/aci/resource_aci_cloudrouterp.go @@ -38,12 +38,6 @@ func resourceAciCloudVpnGateway() *schema.Resource { ForceNew: true, }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name_alias": &schema.Schema{ Type: schema.TypeString, Optional: true, diff --git a/aci/resource_aci_dhcprelayp.go b/aci/resource_aci_dhcprelayp.go index 47d116616..4a7577ab4 100644 --- a/aci/resource_aci_dhcprelayp.go +++ b/aci/resource_aci_dhcprelayp.go @@ -40,12 +40,6 @@ func resourceAciDHCPRelayPolicy() *schema.Resource { ForceNew: true, }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "mode": &schema.Schema{ Type: schema.TypeString, Optional: true, diff --git a/aci/resource_aci_fabricexplicitgep.go b/aci/resource_aci_fabricexplicitgep.go index 4fa9c8e14..4e3585785 100644 --- a/aci/resource_aci_fabricexplicitgep.go +++ b/aci/resource_aci_fabricexplicitgep.go @@ -24,37 +24,34 @@ func resourceAciVPCExplicitProtectionGroup() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "switch1": &schema.Schema{ - Type: schema.TypeString, - Required: true, - }, - "switch2": &schema.Schema{ - Type: schema.TypeString, - Required: true, - }, - "vpc_domain_policy": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "switch1": &schema.Schema{ + Type: schema.TypeString, + Required: true, + }, + "switch2": &schema.Schema{ + Type: schema.TypeString, + Required: true, + }, + "vpc_domain_policy": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "vpc_explicit_protection_group_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Default: "orchestrator:terraform", - }, - "vpc_explicit_protection_group_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - }, + ), } } diff --git a/aci/resource_aci_fabricrsoospath.go b/aci/resource_aci_fabricrsoospath.go index 7d3180bac..a9b5a1c35 100644 --- a/aci/resource_aci_fabricrsoospath.go +++ b/aci/resource_aci_fabricrsoospath.go @@ -25,36 +25,32 @@ func resourceAciOutofServiceFabricPath() *schema.Resource { }, SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "annotation": { - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + + "pod_id": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + }, + "node_id": { + Type: schema.TypeInt, + Required: true, + ForceNew: true, + }, + "fex_id": { + Type: schema.TypeInt, + Optional: true, + ForceNew: true, + }, + "interface": { + Type: schema.TypeString, + Required: true, + ForceNew: true, }, }, - "pod_id": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - }, - "node_id": { - Type: schema.TypeInt, - Required: true, - ForceNew: true, - }, - "fex_id": { - Type: schema.TypeInt, - Optional: true, - ForceNew: true, - }, - "interface": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - }, + ), } } diff --git a/aci/resource_aci_fcdomp.go b/aci/resource_aci_fcdomp.go index 6c95ebfe9..839bb0f2d 100644 --- a/aci/resource_aci_fcdomp.go +++ b/aci/resource_aci_fcdomp.go @@ -24,70 +24,66 @@ func resourceAciFCDomain() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Default: "orchestrator:terraform", - }, - - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "relation_infra_rs_vlan_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_fc_rs_vsan_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_fc_rs_vsan_attr": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "relation_infra_rs_vlan_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_fc_rs_vsan_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_fc_rs_vsan_attr": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_vlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + Computed: true, + }, + "relation_infra_rs_vip_addr_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_fc_rs_vsan_attr_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + Computed: true, + }, + "relation_fc_rs_vsan_ns_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + Computed: true, + }, }, - "relation_infra_rs_vlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - Computed: true, - }, - "relation_infra_rs_vip_addr_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_fc_rs_vsan_attr_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - Computed: true, - }, - "relation_fc_rs_vsan_ns_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - Computed: true, - }, - }, + ), } } func getRemoteFCDomain(client *client.Client, dn string) (*models.FCDomain, error) { diff --git a/aci/resource_aci_fvrsconsif.go b/aci/resource_aci_fvrsconsif.go index e80cad107..6d742dae9 100644 --- a/aci/resource_aci_fvrsconsif.go +++ b/aci/resource_aci_fvrsconsif.go @@ -24,40 +24,35 @@ func resourceAciContractInterfaceRelationship() *schema.Resource { }, SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "application_epg_dn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "application_epg_dn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "prio": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "level1", + "level2", + "level3", + "level4", + "level5", + "level6", + "unspecified", + }, false), + }, + "contract_interface_dn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, }, }, - "prio": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "level1", - "level2", - "level3", - "level4", - "level5", - "level6", - "unspecified", - }, false), - }, - "contract_interface_dn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - }, + ), } } diff --git a/aci/resource_aci_fvrsdomatt.go b/aci/resource_aci_fvrsdomatt.go index 16503544c..2c0972b75 100644 --- a/aci/resource_aci_fvrsdomatt.go +++ b/aci/resource_aci_fvrsdomatt.go @@ -26,224 +26,217 @@ func resourceAciDomain() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "application_epg_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "application_epg_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - "tdn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, + "tdn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, - "binding_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "staticBinding", - "dynamicBinding", - "ephemeral", - }, false), - }, + "binding_type": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "none", + "staticBinding", + "dynamicBinding", + "ephemeral", + }, false), + }, - "allow_micro_seg": &schema.Schema{ - Type: schema.TypeBool, - Optional: true, - Computed: true, - }, + "allow_micro_seg": &schema.Schema{ + Type: schema.TypeBool, + Optional: true, + Computed: true, + }, - "custom_epg_name": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "custom_epg_name": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "delimiter": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "delimiter": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "encap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "encap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "encap_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "auto", - "vlan", - "vxlan", - }, false), - }, + "encap_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "auto", + "vlan", + "vxlan", + }, false), + }, - "epg_cos": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "Cos0", - "Cos1", - "Cos2", - "Cos3", - "Cos4", - "Cos5", - "Cos6", - "Cos7", - }, false), - }, + "epg_cos": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "Cos0", + "Cos1", + "Cos2", + "Cos3", + "Cos4", + "Cos5", + "Cos6", + "Cos7", + }, false), + }, - "epg_cos_pref": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "disabled", - "enabled", - }, false), - }, + "epg_cos_pref": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "disabled", + "enabled", + }, false), + }, - "instr_imedcy": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "immediate", - "lazy", - }, false), - }, + "instr_imedcy": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "immediate", + "lazy", + }, false), + }, - "lag_policy_name": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - Deprecated: "use enhanced_lag_policy instead", - }, + "lag_policy_name": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + Deprecated: "use enhanced_lag_policy instead", + }, - "netflow_dir": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "both", - "ingress", - "egress", - }, false), - }, + "netflow_dir": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "both", + "ingress", + "egress", + }, false), + }, - "netflow_pref": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "disabled", - "enabled", - }, false), - }, + "netflow_pref": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "disabled", + "enabled", + }, false), + }, - "num_ports": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "num_ports": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "port_allocation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "elastic", - "fixed", - }, false), - }, + "port_allocation": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "none", + "elastic", + "fixed", + }, false), + }, - "primary_encap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "primary_encap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "primary_encap_inner": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "primary_encap_inner": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "res_imedcy": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "lazy", - "immediate", - "pre-provision", - }, false), - }, + "res_imedcy": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "lazy", + "immediate", + "pre-provision", + }, false), + }, - "secondary_encap_inner": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "secondary_encap_inner": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "switching_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "native", - "AVE", - }, false), - }, + "switching_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "native", + "AVE", + }, false), + }, - "vmm_id": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - }, + "vmm_id": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + }, - "vmm_allow_promiscuous": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "vmm_allow_promiscuous": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "vmm_forged_transmits": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "vmm_forged_transmits": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "vmm_mac_changes": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "vmm_mac_changes": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "enhanced_lag_policy": &schema.Schema{ - Type: schema.TypeString, - Optional: true, + "enhanced_lag_policy": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + }, }, - }, + ), } } func getRemoteDomain(client *client.Client, dn string) (*models.FVDomain, error) { diff --git a/aci/resource_aci_infrarsaccbasegrp.go b/aci/resource_aci_infrarsaccbasegrp.go index c61575d43..4cccd9674 100644 --- a/aci/resource_aci_infrarsaccbasegrp.go +++ b/aci/resource_aci_infrarsaccbasegrp.go @@ -24,34 +24,28 @@ func resourceAciAccessGroup() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "access_port_selector_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "fex_id": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "access_port_selector_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, - "tdn": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "fex_id": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + "tdn": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, }, }, - }, + ), } } func getRemoteAccessAccessGroup(client *client.Client, dn string) (*models.AccessAccessGroup, error) { diff --git a/aci/resource_aci_infrarsdomp.go b/aci/resource_aci_infrarsdomp.go index e0c11d8c6..2589fe07e 100644 --- a/aci/resource_aci_infrarsdomp.go +++ b/aci/resource_aci_infrarsdomp.go @@ -23,26 +23,21 @@ func resourceAciInfraRsDomP() *schema.Resource { }, SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "attachable_access_entity_profile_dn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "attachable_access_entity_profile_dn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "domain_dn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, }, }, - "domain_dn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - }, + ), } } diff --git a/aci/resource_aci_infrarsfunctoepg.go b/aci/resource_aci_infrarsfunctoepg.go index a1ed3447d..9877efad7 100644 --- a/aci/resource_aci_infrarsfunctoepg.go +++ b/aci/resource_aci_infrarsfunctoepg.go @@ -25,61 +25,54 @@ func resourceAciEPGsUsingFunction() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "access_generic_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "access_generic_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - "tdn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, + "tdn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, - "encap": &schema.Schema{ - Type: schema.TypeString, - Required: true, - }, + "encap": &schema.Schema{ + Type: schema.TypeString, + Required: true, + }, - "instr_imedcy": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "immediate", - "lazy", - }, false), - }, + "instr_imedcy": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "immediate", + "lazy", + }, false), + }, - "mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "regular", - "native", - "untagged", - }, false), - }, + "mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "regular", + "native", + "untagged", + }, false), + }, - "primary_encap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, + "primary_encap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, }, - }, + ), } } func getRemoteEPGsUsingFunction(client *client.Client, dn string) (*models.EPGsUsingFunction, error) { diff --git a/aci/resource_aci_infrarsspaccportp.go b/aci/resource_aci_infrarsspaccportp.go index 1fe4cc4fe..fe7edcfc8 100644 --- a/aci/resource_aci_infrarsspaccportp.go +++ b/aci/resource_aci_infrarsspaccportp.go @@ -24,29 +24,22 @@ func resourceAciInterfaceProfile() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "spine_profile_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "spine_profile_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - "tdn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + "tdn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, }, - }, + ), } } func getRemoteInterfaceProfile(client *client.Client, dn string) (*models.InterfaceProfile, error) { diff --git a/aci/resource_aci_infrarsspaccportp_deprecated.go b/aci/resource_aci_infrarsspaccportp_deprecated.go index 19cc4a0b5..9730774a8 100644 --- a/aci/resource_aci_infrarsspaccportp_deprecated.go +++ b/aci/resource_aci_infrarsspaccportp_deprecated.go @@ -18,28 +18,21 @@ func resourceAciInterfaceProfileDeprecated() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "spine_profile_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "spine_profile_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - "tdn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + "tdn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, }, - }, + ), } } diff --git a/aci/resource_aci_l2extdomp.go b/aci/resource_aci_l2extdomp.go index 8586028b3..886ba6e1e 100644 --- a/aci/resource_aci_l2extdomp.go +++ b/aci/resource_aci_l2extdomp.go @@ -24,55 +24,48 @@ func resourceAciL2Domain() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, }, - }, - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "relation_infra_rs_vlan_ns": &schema.Schema{ - Type: schema.TypeString, + "relation_infra_rs_vlan_ns": &schema.Schema{ + Type: schema.TypeString, - Optional: true, - }, - "relation_infra_rs_vlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_infra_rs_vip_addr_ns": &schema.Schema{ - Type: schema.TypeString, + Optional: true, + }, + "relation_infra_rs_vlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_infra_rs_vip_addr_ns": &schema.Schema{ + Type: schema.TypeString, - Optional: true, - }, - "relation_extnw_rs_out": &schema.Schema{ - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, - Set: schema.HashString, - }, - "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, + Optional: true, + }, + "relation_extnw_rs_out": &schema.Schema{ + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Set: schema.HashString, + }, + "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, }, - }, + ), } } func getRemoteL2Domain(client *client.Client, dn string) (*models.L2Domain, error) { diff --git a/aci/resource_aci_l3extdomp.go b/aci/resource_aci_l3extdomp.go index 4381810dc..b9a39404b 100644 --- a/aci/resource_aci_l3extdomp.go +++ b/aci/resource_aci_l3extdomp.go @@ -24,56 +24,50 @@ func resourceAciL3DomainProfile() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, - "relation_infra_rs_vlan_ns": &schema.Schema{ - Type: schema.TypeString, + "relation_infra_rs_vlan_ns": &schema.Schema{ + Type: schema.TypeString, - Optional: true, - }, - "relation_infra_rs_vlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_infra_rs_vip_addr_ns": &schema.Schema{ - Type: schema.TypeString, + Optional: true, + }, + "relation_infra_rs_vlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_infra_rs_vip_addr_ns": &schema.Schema{ + Type: schema.TypeString, - Optional: true, - }, - "relation_extnw_rs_out": &schema.Schema{ - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, - Set: schema.HashString, - }, - "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, + Optional: true, + }, + "relation_extnw_rs_out": &schema.Schema{ + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Set: schema.HashString, + }, + "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, }, - }, + ), } } func getRemoteL3DomainProfile(client *client.Client, dn string) (*models.L3DomainProfile, error) { diff --git a/aci/resource_aci_mgmtgrp.go b/aci/resource_aci_mgmtgrp.go index e414912e3..22bbf496f 100644 --- a/aci/resource_aci_mgmtgrp.go +++ b/aci/resource_aci_mgmtgrp.go @@ -23,23 +23,17 @@ func resourceAciManagedNodeConnectivityGroup() *schema.Resource { }, SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, }, - }, + ), } } diff --git a/aci/resource_aci_physdomp.go b/aci/resource_aci_physdomp.go index f4c9b4e28..1aee284ed 100644 --- a/aci/resource_aci_physdomp.go +++ b/aci/resource_aci_physdomp.go @@ -24,47 +24,44 @@ func resourceAciPhysicalDomain() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Default: "orchestrator:terraform", - }, - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "relation_infra_rs_vlan_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_vlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_infra_rs_vip_addr_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, }, - - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "relation_infra_rs_vlan_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_infra_rs_vlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_infra_rs_vip_addr_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - }, + ), } } func getRemotePhysicalDomain(client *client.Client, dn string) (*models.PhysicalDomain, error) { diff --git a/aci/resource_aci_snmpctxp.go b/aci/resource_aci_snmpctxp.go index dbcb2063e..3bd30f112 100644 --- a/aci/resource_aci_snmpctxp.go +++ b/aci/resource_aci_snmpctxp.go @@ -23,26 +23,21 @@ func resourceAciSNMPContextProfile() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendNameAliasAttrSchema(map[string]*schema.Schema{ - "vrf_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + GetNameAliasAttrSchema(), + map[string]*schema.Schema{ + "vrf_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - }), + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + }), } } diff --git a/aci/resource_aci_trigrecurrwindowp.go b/aci/resource_aci_trigrecurrwindowp.go index e7997c886..af9db1c3e 100644 --- a/aci/resource_aci_trigrecurrwindowp.go +++ b/aci/resource_aci_trigrecurrwindowp.go @@ -24,86 +24,80 @@ func resourceAciRecurringWindow() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendNameAliasAttrSchema(map[string]*schema.Schema{ - "scheduler_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + GetNameAliasAttrSchema(), + map[string]*schema.Schema{ + "scheduler_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, }, - }, - "concur_cap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "day": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "Friday", - "Monday", - "Saturday", - "Sunday", - "Thursday", - "Tuesday", - "Wednesday", - "even-day", - "every-day", - "odd-day", - }, false), - }, - "hour": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "minute": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "node_upg_interval": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "proc_break": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.Any(validation.StringInSlice([]string{ - "none", - }, false), validateColonSeparatedTimeStamp()), - }, - "proc_cap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "time_cap": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.Any(validation.StringInSlice([]string{ - "unlimited", - }, false), validateColonSeparatedTimeStamp()), - }, - }), + "concur_cap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "day": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "Friday", + "Monday", + "Saturday", + "Sunday", + "Thursday", + "Tuesday", + "Wednesday", + "even-day", + "every-day", + "odd-day", + }, false), + }, + "hour": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "minute": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "node_upg_interval": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "proc_break": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.Any(validation.StringInSlice([]string{ + "none", + }, false), validateColonSeparatedTimeStamp()), + }, + "proc_cap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "time_cap": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.Any(validation.StringInSlice([]string{ + "unlimited", + }, false), validateColonSeparatedTimeStamp()), + }, + }), } } diff --git a/aci/resource_aci_vmmctrlrp.go b/aci/resource_aci_vmmctrlrp.go index 21c156100..b54aad995 100644 --- a/aci/resource_aci_vmmctrlrp.go +++ b/aci/resource_aci_vmmctrlrp.go @@ -27,223 +27,220 @@ func resourceAciVMMController() *schema.Resource { }, SchemaVersion: 1, - Schema: AppendNameAliasAttrSchema(map[string]*schema.Schema{ - "vmm_domain_dn": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - // Default: "orchestrator:terraform", - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil - }}, - "dvs_version": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "5.1", - "5.5", - "6.0", - "6.5", - "6.6", - "7.0", - "unmanaged", - }, false), - }, - "host_or_ip": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "inventory_trig_st": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "autoTriggered", - "triggered", - "untriggered", - }, false), - }, - "mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "cf", - "default", - "k8s", - "n1kv", - "nsx", - "openshift", - "ovs", - "rancher", - "rhev", - "unknown", - }, false), - }, - "msft_config_err_msg": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "msft_config_issues": { - Type: schema.TypeList, - Optional: true, - Computed: true, - Elem: &schema.Schema{ - Type: schema.TypeString, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + GetNameAliasAttrSchema(), + map[string]*schema.Schema{ + "vmm_domain_dn": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "dvs_version": { + Type: schema.TypeString, + Optional: true, + Computed: true, ValidateFunc: validation.StringInSlice([]string{ - "aaacert-invalid", - "duplicate-mac-in-inventory", - "duplicate-rootContName", - "invalid-object-in-inventory", - "invalid-rootContName", - "inventory-failed", - "missing-hostGroup-in-cloud", - "missing-rootContName", - "not-applicable", - "zero-mac-in-inventory", + "5.1", + "5.5", + "6.0", + "6.5", + "6.6", + "7.0", + "unmanaged", + }, false), + }, + "host_or_ip": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "inventory_trig_st": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "autoTriggered", + "triggered", + "untriggered", + }, false), + }, + "mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "cf", + "default", + "k8s", + "n1kv", + "nsx", + "openshift", + "ovs", + "rancher", + "rhev", + "unknown", + }, false), + }, + "msft_config_err_msg": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "msft_config_issues": { + Type: schema.TypeList, + Optional: true, + Computed: true, + Elem: &schema.Schema{ + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "aaacert-invalid", + "duplicate-mac-in-inventory", + "duplicate-rootContName", + "invalid-object-in-inventory", + "invalid-rootContName", + "inventory-failed", + "missing-hostGroup-in-cloud", + "missing-rootContName", + "not-applicable", + "zero-mac-in-inventory", + }, false), + }, + }, + "n1kv_stats_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "disabled", + "enabled", + "unknown", + }, false), + }, + "name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "port": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "root_cont_name": { + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + "scope": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "MicrosoftSCVMM", + "cloudfoundry", + "iaas", + "kubernetes", + "network", + "nsx", + "openshift", + "openstack", + "rhev", + "unmanaged", + "vm", + }, false), + }, + "seq_num": { + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + "stats_mode": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "disabled", + "enabled", + "unknown", + }, false), + }, + "vxlan_depl_pref": { + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "nsx", + "vxlan", }, false), }, - }, - "n1kv_stats_mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "disabled", - "enabled", - "unknown", - }, false), - }, - "name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "port": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "root_cont_name": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - "scope": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "MicrosoftSCVMM", - "cloudfoundry", - "iaas", - "kubernetes", - "network", - "nsx", - "openshift", - "openstack", - "rhev", - "unmanaged", - "vm", - }, false), - }, - "seq_num": { - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "stats_mode": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "disabled", - "enabled", - "unknown", - }, false), - }, - "vxlan_depl_pref": { - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "nsx", - "vxlan", - }, false), - }, - "relation_vmm_rs_acc": { - Type: schema.TypeString, + "relation_vmm_rs_acc": { + Type: schema.TypeString, - Optional: true, - Description: "Create relation to vmm:UsrAccP", - }, - "relation_vmm_rs_ctrlr_p_mon_pol": { - Type: schema.TypeString, + Optional: true, + Description: "Create relation to vmm:UsrAccP", + }, + "relation_vmm_rs_ctrlr_p_mon_pol": { + Type: schema.TypeString, - Optional: true, - Description: "Create relation to mon:InfraPol", - }, - "relation_vmm_rs_mcast_addr_ns": { - Type: schema.TypeString, + Optional: true, + Description: "Create relation to mon:InfraPol", + }, + "relation_vmm_rs_mcast_addr_ns": { + Type: schema.TypeString, - Optional: true, - Description: "Create relation to fvns:McastAddrInstP", - }, - "relation_vmm_rs_mgmt_e_pg": { - Type: schema.TypeString, + Optional: true, + Description: "Create relation to fvns:McastAddrInstP", + }, + "relation_vmm_rs_mgmt_e_pg": { + Type: schema.TypeString, - Optional: true, - Description: "Create relation to fv:EPg", - }, - "relation_vmm_rs_to_ext_dev_mgr": { - Type: schema.TypeSet, - Elem: &schema.Schema{Type: schema.TypeString}, - Optional: true, - Description: "Create relation to extdev:MgrP", - Set: schema.HashString, - }, - "relation_vmm_rs_vmm_ctrlr_p": { - Type: schema.TypeSet, - Optional: true, - Description: "Create relation to vmmCtrlrP", - Elem: &schema.Resource{ - Schema: map[string]*schema.Schema{ - "epg_depl_pref": { - Optional: true, - Type: schema.TypeString, - ValidateFunc: validation.StringInSlice([]string{ - "both", - "local", - }, false), - }, - "target_dn": { - Required: true, - Type: schema.TypeString, + Optional: true, + Description: "Create relation to fv:EPg", + }, + "relation_vmm_rs_to_ext_dev_mgr": { + Type: schema.TypeSet, + Elem: &schema.Schema{Type: schema.TypeString}, + Optional: true, + Description: "Create relation to extdev:MgrP", + Set: schema.HashString, + }, + "relation_vmm_rs_vmm_ctrlr_p": { + Type: schema.TypeSet, + Optional: true, + Description: "Create relation to vmmCtrlrP", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "epg_depl_pref": { + Optional: true, + Type: schema.TypeString, + ValidateFunc: validation.StringInSlice([]string{ + "both", + "local", + }, false), + }, + "target_dn": { + Required: true, + Type: schema.TypeString, + }, }, }, }, - }, - "relation_vmm_rs_vxlan_ns": { - Type: schema.TypeString, + "relation_vmm_rs_vxlan_ns": { + Type: schema.TypeString, - Optional: true, - Description: "Create relation to fvns:VxlanInstP", + Optional: true, + Description: "Create relation to fvns:VxlanInstP", + }, + "relation_vmm_rs_vxlan_ns_def": { + Type: schema.TypeString, + Computed: true, + Optional: true, + Description: "Create relation to fvns:AInstP", + }, }, - "relation_vmm_rs_vxlan_ns_def": { - Type: schema.TypeString, - Computed: true, - Optional: true, - Description: "Create relation to fvns:AInstP", - }}), + ), } } diff --git a/aci/resource_aci_vmmdomp.go b/aci/resource_aci_vmmdomp.go index f254bb23b..c4d0521be 100644 --- a/aci/resource_aci_vmmdomp.go +++ b/aci/resource_aci_vmmdomp.go @@ -25,255 +25,252 @@ func resourceAciVMMDomain() *schema.Resource { SchemaVersion: 1, - Schema: map[string]*schema.Schema{ - "provider_profile_dn": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "name": &schema.Schema{ - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Default: "orchestrator:terraform", - }, - - "access_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "read-write", - "read-only", - }, false), - }, - - "arp_learning": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "enabled", - "disabled", - }, false), - }, - - "ave_time_out": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "config_infra_pg": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "no", - "yes", - }, false), - }, - - "ctrl_knob": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "epDpVerify", - }, false), - }, - - "delimiter": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "enable_ave": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "no", - "yes", - }, false), - }, - - "enable_tag": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "no", - "yes", - }, false), - }, - - "enable_vm_folder": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "no", - "yes", - }, false), - }, - - "encap_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "unknown", - "vlan", - "vxlan", - }, false), - }, - - "enf_pref": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "sw", - "hw", - "unknown", - }, false), - }, - - "ep_inventory_type": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "none", - "on-link", - }, false), - }, - - "ep_ret_time": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "hv_avail_monitor": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "no", - "yes", - }, false), - }, - - "mcast_addr": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "default", - "n1kv", - "unknown", - "ovs", - "k8s", - "rhev", - "cf", - "openshift", - }, false), - }, - - "name_alias": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - - "pref_encap_mode": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - ValidateFunc: validation.StringInSlice([]string{ - "unspecified", - "vlan", - "vxlan", - }, false), - }, - - "relation_vmm_rs_pref_enhanced_lag_pol": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_infra_rs_vlan_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_vmm_rs_dom_mcast_addr_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_vmm_rs_default_cdp_if_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_vmm_rs_default_lacp_lag_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_infra_rs_vlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_infra_rs_vip_addr_ns": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_vmm_rs_default_lldp_if_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_vmm_rs_default_stp_if_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ - Type: schema.TypeString, - - Optional: true, - }, - "relation_vmm_rs_default_fw_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - "relation_vmm_rs_default_l2_inst_pol": &schema.Schema{ - Type: schema.TypeString, - Computed: true, - Optional: true, - }, - }, + Schema: AppendAttrSchemas( + GetAnnotationAttrSchema(), + map[string]*schema.Schema{ + "provider_profile_dn": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "name": &schema.Schema{ + Type: schema.TypeString, + Required: true, + ForceNew: true, + }, + + "access_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "read-write", + "read-only", + }, false), + }, + + "arp_learning": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "enabled", + "disabled", + }, false), + }, + + "ave_time_out": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "config_infra_pg": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "no", + "yes", + }, false), + }, + + "ctrl_knob": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "none", + "epDpVerify", + }, false), + }, + + "delimiter": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "enable_ave": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "no", + "yes", + }, false), + }, + + "enable_tag": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "no", + "yes", + }, false), + }, + + "enable_vm_folder": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "no", + "yes", + }, false), + }, + + "encap_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "unknown", + "vlan", + "vxlan", + }, false), + }, + + "enf_pref": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "sw", + "hw", + "unknown", + }, false), + }, + + "ep_inventory_type": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "none", + "on-link", + }, false), + }, + + "ep_ret_time": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "hv_avail_monitor": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "no", + "yes", + }, false), + }, + + "mcast_addr": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "default", + "n1kv", + "unknown", + "ovs", + "k8s", + "rhev", + "cf", + "openshift", + }, false), + }, + + "name_alias": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + }, + + "pref_encap_mode": &schema.Schema{ + Type: schema.TypeString, + Optional: true, + Computed: true, + ValidateFunc: validation.StringInSlice([]string{ + "unspecified", + "vlan", + "vxlan", + }, false), + }, + + "relation_vmm_rs_pref_enhanced_lag_pol": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_vlan_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_vmm_rs_dom_mcast_addr_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_vmm_rs_default_cdp_if_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_vmm_rs_default_lacp_lag_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_infra_rs_vlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_infra_rs_vip_addr_ns": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_vmm_rs_default_lldp_if_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_vmm_rs_default_stp_if_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_infra_rs_dom_vxlan_ns_def": &schema.Schema{ + Type: schema.TypeString, + + Optional: true, + }, + "relation_vmm_rs_default_fw_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + "relation_vmm_rs_default_l2_inst_pol": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Optional: true, + }, + }, + ), } } func getRemoteVMMDomain(client *client.Client, dn string) (*models.VMMDomain, error) { diff --git a/aci/resource_aci_vnsabsnode.go b/aci/resource_aci_vnsabsnode.go index 15458c0b0..df9a95dd4 100644 --- a/aci/resource_aci_vnsabsnode.go +++ b/aci/resource_aci_vnsabsnode.go @@ -38,12 +38,6 @@ func resourceAciFunctionNode() *schema.Resource { ForceNew: true, }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "func_template_type": &schema.Schema{ Type: schema.TypeString, Optional: true, From ff0bffd8bfdc5bf4fe661d38525110adbcf31649 Mon Sep 17 00:00:00 2001 From: RutvikS-crest Date: Mon, 31 Oct 2022 13:01:02 +0530 Subject: [PATCH 3/3] added Annotation Schema function --- aci/base_attr_schema.go | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/aci/base_attr_schema.go b/aci/base_attr_schema.go index 7e6037ac7..b64a72e34 100644 --- a/aci/base_attr_schema.go +++ b/aci/base_attr_schema.go @@ -2,24 +2,6 @@ package aci import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" -func GetBaseAttrSchema() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "description": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - }, - "annotation": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - Computed: true, - DefaultFunc: func() (interface{}, error) { - return "orchestrator:terraform", nil - }, - }, - } -} - func GetAnnotationAttrSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ "annotation": { @@ -45,7 +27,7 @@ func GetDescriptionAttrSchema() map[string]*schema.Schema { func GetAllowEmptyAttrSchema() map[string]*schema.Schema { return map[string]*schema.Schema{ - "allow_empty_result": &schema.Schema{ + "allow_empty_result": { Type: schema.TypeBool, Optional: true, Default: false, @@ -53,6 +35,13 @@ func GetAllowEmptyAttrSchema() map[string]*schema.Schema { } } +func GetBaseAttrSchema() map[string]*schema.Schema { + return AppendAttrSchemas( + GetAnnotationAttrSchema(), + GetDescriptionAttrSchema(), + ) +} + // AppendBaseAttrSchema adds the BaseAttr to any schema func AppendBaseAttrSchema(attrs map[string]*schema.Schema) map[string]*schema.Schema { for key, value := range GetBaseAttrSchema() {