#2087 gracefully handle non-presence of service on remote consul agent
This commit is contained in:
parent
df4c0c82f2
commit
6e40210227
|
@ -106,7 +106,7 @@ func resourceConsulAgentServiceRead(d *schema.ResourceData, meta interface{}) er
|
|||
if services, err := agent.Services(); err != nil {
|
||||
return fmt.Errorf("Failed to get services from Consul agent: %v", err)
|
||||
} else if service, ok := services[name]; !ok {
|
||||
return fmt.Errorf("Failed to get service '%s' from Consul agent", name)
|
||||
d.Set("id", "")
|
||||
} else {
|
||||
d.Set("address", service.Address)
|
||||
d.Set("id", service.ID)
|
||||
|
|
Loading…
Reference in New Issue