diff --git a/builtin/providers/heroku/resource_heroku_app.go b/builtin/providers/heroku/resource_heroku_app.go index 8381c70b2..156a3be24 100644 --- a/builtin/providers/heroku/resource_heroku_app.go +++ b/builtin/providers/heroku/resource_heroku_app.go @@ -69,7 +69,6 @@ func resourceHerokuApp() *schema.Resource { "config_vars": &schema.Schema{ Type: schema.TypeList, Optional: true, - Computed: true, Elem: &schema.Schema{ Type: schema.TypeMap, }, @@ -141,6 +140,19 @@ func resourceHerokuAppRead(d *schema.ResourceData, meta interface{}) error { return err } + // Only get the config vars that we care about + care := make(map[string]struct{}) + for _, v := range d.Get("config_vars").([]interface{}) { + for k, _ := range v.(map[string]interface{}) { + care[k] = struct{}{} + } + } + for k, _ := range app.Vars { + if _, ok := care[k]; !ok { + delete(app.Vars, k) + } + } + d.Set("name", app.App.Name) d.Set("stack", app.App.Stack.Name) d.Set("region", app.App.Region.Name) diff --git a/website/source/docs/providers/heroku/r/app.html.markdown b/website/source/docs/providers/heroku/r/app.html.markdown index e90475d56..22d236f63 100644 --- a/website/source/docs/providers/heroku/r/app.html.markdown +++ b/website/source/docs/providers/heroku/r/app.html.markdown @@ -32,8 +32,10 @@ The following arguments are supported: * `stack` - (Optional) The application stack is what platform to run the application in. * `config_vars` - (Optional) Configuration variables for the application. - This is a map that can set keys against the application. - + The config variables in this map are not the final set of configuration + variables, but rather variables you want present. That is, other + configuration variables set externally won't be removed by Terraform + if they aren't present in this list. ## Attributes Reference