diff --git a/mso/resource_mso_schema_site_anp_epg_static_leaf.go b/mso/resource_mso_schema_site_anp_epg_static_leaf.go index 6f914108..4528b187 100644 --- a/mso/resource_mso_schema_site_anp_epg_static_leaf.go +++ b/mso/resource_mso_schema_site_anp_epg_static_leaf.go @@ -88,9 +88,10 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter } stateSite := get_attribute[2] + stateTemplate := get_attribute[4] found := false - stateAnp := get_attribute[4] - stateEpg := get_attribute[6] + stateAnp := get_attribute[6] + stateEpg := get_attribute[8] statePath := import_split[2] for i := 0; i < count; i++ { @@ -99,8 +100,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafImport(d *schema.ResourceData, m inter return nil, err } apiSite := models.StripQuotes(tempCont.S("siteId").String()) + apiTemplate := models.StripQuotes(tempCont.S("templateName").String()) - if apiSite == stateSite { + if apiSite == stateSite && apiTemplate == stateTemplate { anpCount, err := tempCont.ArrayCount("anps") if err != nil { return nil, fmt.Errorf("Unable to get Anp list") @@ -329,6 +331,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa stateSite := d.Get("site_id").(string) found := false + stateTemplate := d.Get("template_name").(string) stateAnp := d.Get("anp_name").(string) stateEpg := d.Get("epg_name").(string) statePath := d.Get("path").(string) @@ -339,8 +342,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafRead(d *schema.ResourceData, m interfa return err } apiSite := models.StripQuotes(tempCont.S("siteId").String()) + apiTemplate := models.StripQuotes(tempCont.S("templateName").String()) - if apiSite == stateSite { + if apiSite == stateSite && apiTemplate == stateTemplate { anpCount, err := tempCont.ArrayCount("anps") if err != nil { return fmt.Errorf("Unable to get Anp list") @@ -435,6 +439,7 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter index := -1 stateSite := d.Get("site_id").(string) + stateTemplate := d.Get("template_name").(string) stateAnp := d.Get("anp_name").(string) stateEpg := d.Get("epg_name").(string) statePath := d.Get("path").(string) @@ -445,8 +450,9 @@ func resourceMSOSchemaSiteAnpEpgStaticleafDelete(d *schema.ResourceData, m inter return err } apiSite := models.StripQuotes(tempCont.S("siteId").String()) + apiTemplate := models.StripQuotes(tempCont.S("templateName").String()) - if apiSite == stateSite { + if apiSite == stateSite && apiTemplate == stateTemplate { anpCount, err := tempCont.ArrayCount("anps") if err != nil { return fmt.Errorf("Unable to get Anp list")