From 1cc95b7a720f867f56a4e2d40d96efc957c64e40 Mon Sep 17 00:00:00 2001 From: Armon Dadgar Date: Tue, 14 Oct 2014 12:16:42 -0700 Subject: [PATCH] provider/consul: Change to GetOk with schema.Helper --- builtin/providers/consul/resource_consul_keys.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/builtin/providers/consul/resource_consul_keys.go b/builtin/providers/consul/resource_consul_keys.go index 75564a4a35..4aef3df5e4 100644 --- a/builtin/providers/consul/resource_consul_keys.go +++ b/builtin/providers/consul/resource_consul_keys.go @@ -89,7 +89,7 @@ func resourceConsulKeysCreate(d *schema.ResourceData, meta interface{}) error { // Resolve the datacenter first, all the other keys are dependent // on this. var dc string - if v := d.Get("datacenter"); v != nil { + if v, ok := d.GetOk("datacenter"); ok { dc = v.(string) log.Printf("[DEBUG] Consul datacenter: %s", dc) } else { @@ -101,7 +101,7 @@ func resourceConsulKeysCreate(d *schema.ResourceData, meta interface{}) error { } } var token string - if v := d.Get("token"); v != nil { + if v, ok := d.GetOk("token"); ok { token = v.(string) } @@ -160,14 +160,14 @@ func resourceConsulKeysRead(d *schema.ResourceData, meta interface{}) error { // Get the DC, error if not available. var dc string - if v := d.Get("datacenter"); v != nil { + if v, ok := d.GetOk("datacenter"); ok { dc = v.(string) log.Printf("[DEBUG] Consul datacenter: %s", dc) } else { return fmt.Errorf("Missing datacenter configuration") } var token string - if v := d.Get("token"); v != nil { + if v, ok := d.GetOk("token"); ok { token = v.(string) } @@ -208,14 +208,14 @@ func resourceConsulKeysDelete(d *schema.ResourceData, meta interface{}) error { // Get the DC, error if not available. var dc string - if v := d.Get("datacenter"); v != nil { + if v, ok := d.GetOk("datacenter"); ok { dc = v.(string) log.Printf("[DEBUG] Consul datacenter: %s", dc) } else { return fmt.Errorf("Missing datacenter configuration") } var token string - if v := d.Get("token"); v != nil { + if v, ok := d.GetOk("token"); ok { token = v.(string) }