Unconditionally set opsworks layer custom_json
Previously in Update we would only set req.CustomJson if a non-empty value was provided in the config. It seems that the Opsworks API considers a null CustomJson to mean "do not change" rather than "set to empty", so we need to explicitly set the empty string in the request body in order to successfully remove an already-configured custom JSON.
This commit is contained in:
parent
72f121aec1
commit
41c535dc68
|
@ -356,9 +356,7 @@ func (lt *opsworksLayerType) Create(d *schema.ResourceData, client *opsworks.Ops
|
|||
req.Shortname = aws.String(lt.TypeName)
|
||||
}
|
||||
|
||||
if customJson, ok := d.GetOk("custom_json"); ok {
|
||||
req.CustomJson = aws.String(customJson.(string))
|
||||
}
|
||||
req.CustomJson = aws.String(d.Get("custom_json").(string))
|
||||
|
||||
log.Printf("[DEBUG] Creating OpsWorks layer: %s", d.Id())
|
||||
|
||||
|
@ -411,9 +409,7 @@ func (lt *opsworksLayerType) Update(d *schema.ResourceData, client *opsworks.Ops
|
|||
req.Shortname = aws.String(lt.TypeName)
|
||||
}
|
||||
|
||||
if customJson, ok := d.GetOk("custom_json"); ok {
|
||||
req.CustomJson = aws.String(customJson.(string))
|
||||
}
|
||||
req.CustomJson = aws.String(d.Get("custom_json").(string))
|
||||
|
||||
log.Printf("[DEBUG] Updating OpsWorks layer: %s", d.Id())
|
||||
|
||||
|
|
Loading…
Reference in New Issue