Merge pull request #3049 from svanharmelen/b-chef-provisioner

provisioner/chef: fixes issue #2872
This commit is contained in:
Sander van Harmelen 2015-08-24 13:37:33 +02:00
commit a535f9eda1
1 changed files with 15 additions and 8 deletions

View File

@ -200,16 +200,23 @@ func (r *ResourceProvisioner) decodeConfig(c *terraform.ResourceConfig) (*Provis
return nil, err return nil, err
} }
// We need to decode this twice. Once for the Raw config and once // We need to merge both configs into a single map first. Order is
// for the parsed Config. This makes sure that all values are there // important as we need to make sure interpolated values are used
// even if some still need to be interpolated later on. // over raw values. This makes sure that all values are there even
// Without this the validation will fail when using a variable for // if some still need to be interpolated later on. Without this
// a required parameter (the node_name for example). // the validation will fail when using a variable for a required
if err := dec.Decode(c.Raw); err != nil { // parameter (the node_name for example).
return nil, err m := make(map[string]interface{})
for k, v := range c.Raw {
m[k] = v
} }
if err := dec.Decode(c.Config); err != nil { for k, v := range c.Config {
m[k] = v
}
if err := dec.Decode(m); err != nil {
return nil, err return nil, err
} }