diff --git a/mso/resource_mso_schema_template_anp_epg_contract.go b/mso/resource_mso_schema_template_anp_epg_contract.go index 9afa80ad..514ca384 100644 --- a/mso/resource_mso_schema_template_anp_epg_contract.go +++ b/mso/resource_mso_schema_template_anp_epg_contract.go @@ -98,6 +98,8 @@ func resourceMSOTemplateAnpEpgContractImport(d *schema.ResourceData, m interface stateANP := get_attribute[4] stateEPG := get_attribute[6] stateContract := get_attribute[8] + stateRelationshipType := get_attribute[10] + for i := 0; i < count; i++ { tempCont, err := cont.ArrayElement(i, "templates") if err != nil { @@ -145,7 +147,7 @@ func resourceMSOTemplateAnpEpgContractImport(d *schema.ResourceData, m interface re := regexp.MustCompile("/schemas/(.*)/templates/(.*)/contracts/(.*)") match := re.FindStringSubmatch(contractRef) apiContract := match[3] - if apiContract == stateContract { + if apiContract == stateContract && apiRelationshipType == stateRelationshipType { d.SetId(apiContract) d.Set("contract_name", match[3]) d.Set("contract_schema_id", match[1]) diff --git a/website/docs/r/schema_template_anp_epg_contract.html.markdown b/website/docs/r/schema_template_anp_epg_contract.html.markdown index d5264202..cb5641a0 100644 --- a/website/docs/r/schema_template_anp_epg_contract.html.markdown +++ b/website/docs/r/schema_template_anp_epg_contract.html.markdown @@ -45,5 +45,5 @@ No attributes are exported. An existing MSO Schema Template Application Network Profile Endpoint Group Contract can be [imported][docs-import] into this resource via its Id/path, via the following command: [docs-import]: ```bash -terraform import mso_schema_template_anp_epg_contract.contract1 {schema_id}/template/{template_name}/anp/{anp_name}/epg/{epg_name}/contract/{contract_name} +terraform import mso_schema_template_anp_epg_contract.contract1 {schema_id}/template/{template_name}/anp/{anp_name}/epg/{epg_name}/contract/{contract_name}/relationshipType/{consumer|provider} ```