provider/consul: Disambiguate between set/get

This commit is contained in:
Armon Dadgar 2014-10-20 12:06:27 -07:00
parent 00eaabf5b8
commit f4d5d648c9
1 changed files with 2 additions and 7 deletions

View File

@ -120,12 +120,8 @@ func resourceConsulKeysCreate(d *schema.ResourceData, meta interface{}) error {
return err
}
if valueRaw, ok := sub["value"]; ok {
value, ok := valueRaw.(string)
if !ok {
return fmt.Errorf("Failed to get value for key '%s'", key)
}
value := sub["value"].(string)
if value != "" {
log.Printf("[DEBUG] Setting key '%s' to '%v' in %s", path, value, dc)
pair := consulapi.KVPair{Key: path, Value: []byte(value)}
if _, err := kv.Put(&pair, &wOpts); err != nil {
@ -142,7 +138,6 @@ func resourceConsulKeysCreate(d *schema.ResourceData, meta interface{}) error {
}
value := attribute_value(sub, key, pair)
vars[key] = value
sub["value"] = value
}
}