providers/heroku: config vars aren't computed, they're non-exclusive

/cc @pearkes - See doc change
This commit is contained in:
Mitchell Hashimoto 2014-08-27 16:26:03 -07:00
parent 02d18d67b8
commit 0a03ff9d34
2 changed files with 17 additions and 3 deletions

View File

@ -69,7 +69,6 @@ func resourceHerokuApp() *schema.Resource {
"config_vars": &schema.Schema{ "config_vars": &schema.Schema{
Type: schema.TypeList, Type: schema.TypeList,
Optional: true, Optional: true,
Computed: true,
Elem: &schema.Schema{ Elem: &schema.Schema{
Type: schema.TypeMap, Type: schema.TypeMap,
}, },
@ -141,6 +140,19 @@ func resourceHerokuAppRead(d *schema.ResourceData, meta interface{}) error {
return err 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("name", app.App.Name)
d.Set("stack", app.App.Stack.Name) d.Set("stack", app.App.Stack.Name)
d.Set("region", app.App.Region.Name) d.Set("region", app.App.Region.Name)

View File

@ -32,8 +32,10 @@ The following arguments are supported:
* `stack` - (Optional) The application stack is what platform to run the application * `stack` - (Optional) The application stack is what platform to run the application
in. in.
* `config_vars` - (Optional) Configuration variables for the application. * `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 ## Attributes Reference