provider/consul: catalog entry service id should default to service name

This commit is contained in:
Manuwela Kanade 2017-02-08 09:43:00 +00:00
parent bd5a5b0b29
commit 0942aed7a3
1 changed files with 3 additions and 0 deletions

View File

@ -147,6 +147,9 @@ func resourceConsulCatalogEntryCreate(d *schema.ResourceData, meta interface{})
for i, rawService := range serviceList {
serviceData := rawService.(map[string]interface{})
if len(serviceData["id"].(string)) == 0 {
serviceData["id"] = serviceData["name"].(string)
}
serviceID := serviceData["id"].(string)
serviceIDs[i] = serviceID