Skip to content

Commit

Permalink
Test nulling unchanged config variables
Browse files Browse the repository at this point in the history
  • Loading branch information
nn-bhowes authored Nov 25, 2022
1 parent 73f9f94 commit e28b916
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions aptible/resource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,15 @@ func resourceAppUpdate(_ context.Context, d *schema.ResourceData, meta interface
o, c := d.GetChange("config")
old := o.(map[string]interface{})
config := c.(map[string]interface{})
// Remove any identical keys since they do not need setting.
// In the case of APTIBLE_DOCKER_IMAGE this will avoid a deployment
for key := range config {
if _, present := old[key]; present {
if config[key] == old[key] {
delete(config, key)
}
}
}
// Set any old keys that are not present to an empty string.
// The API will then clear them during normalization otherwise
// the old values will be merged with the new
Expand Down

0 comments on commit e28b916

Please sign in to comment.