From 6e402102272d64b428fa7cd61f61aafa93f665e8 Mon Sep 17 00:00:00 2001 From: Max Englander Date: Wed, 6 Jul 2016 08:29:47 -0400 Subject: [PATCH] #2087 gracefully handle non-presence of service on remote consul agent --- builtin/providers/consul/resource_consul_agent_service.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/providers/consul/resource_consul_agent_service.go b/builtin/providers/consul/resource_consul_agent_service.go index 9ede63bf3..6636060a8 100644 --- a/builtin/providers/consul/resource_consul_agent_service.go +++ b/builtin/providers/consul/resource_consul_agent_service.go @@ -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)