Skip to content

Commit caff636

Browse files
committed
[bug_fix] Fix importing for mso_schema_template_anp_epg_contract to select the contract with the correct type
1 parent b5699dd commit caff636

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mso/resource_mso_schema_template_anp_epg_contract.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ func resourceMSOTemplateAnpEpgContractImport(d *schema.ResourceData, m interface
9898
stateANP := get_attribute[4]
9999
stateEPG := get_attribute[6]
100100
stateContract := get_attribute[8]
101+
stateRelationshipType := get_attribute[10]
102+
101103
for i := 0; i < count; i++ {
102104
tempCont, err := cont.ArrayElement(i, "templates")
103105
if err != nil {
@@ -145,7 +147,7 @@ func resourceMSOTemplateAnpEpgContractImport(d *schema.ResourceData, m interface
145147
re := regexp.MustCompile("/schemas/(.*)/templates/(.*)/contracts/(.*)")
146148
match := re.FindStringSubmatch(contractRef)
147149
apiContract := match[3]
148-
if apiContract == stateContract {
150+
if apiContract == stateContract && apiRelationshipType == stateRelationshipType {
149151
d.SetId(apiContract)
150152
d.Set("contract_name", match[3])
151153
d.Set("contract_schema_id", match[1])

website/docs/r/schema_template_anp_epg_contract.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ No attributes are exported.
4545
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]: <https://www.terraform.io/docs/import/index.html>
4646

4747
```bash
48-
terraform import mso_schema_template_anp_epg_contract.contract1 {schema_id}/template/{template_name}/anp/{anp_name}/epg/{epg_name}/contract/{contract_name}
48+
terraform import mso_schema_template_anp_epg_contract.contract1 {schema_id}/template/{template_name}/anp/{anp_name}/epg/{epg_name}/contract/{contract_name}/relationship_type/{consumer|provider}
4949
```

0 commit comments

Comments
 (0)