From 9a0c0ea985788f8c706975058d20d3cb46149063 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 19 Aug 2014 10:16:47 -0700 Subject: [PATCH] providers/heroku: domain/drain have dep on app --- CHANGELOG.md | 1 + builtin/providers/heroku/resource_heroku_domain.go | 4 ++++ builtin/providers/heroku/resource_heroku_drain.go | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6954770f0..c7c8c3f48 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ BUG FIXES: * core: Variables are validated to not contain interpolations. [GH-180] * providers/heroku: If you delete the `config_vars` block, config vars are properly nuked. + * providers/heroku: Domains and drains are deleted before the app. PLUGIN CHANGES: diff --git a/builtin/providers/heroku/resource_heroku_domain.go b/builtin/providers/heroku/resource_heroku_domain.go index 56e2ee0f7..619d15d06 100644 --- a/builtin/providers/heroku/resource_heroku_domain.go +++ b/builtin/providers/heroku/resource_heroku_domain.go @@ -6,6 +6,7 @@ import ( "github.com/bgentry/heroku-go" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" ) func resourceHerokuDomain() *schema.Resource { @@ -51,6 +52,9 @@ func resourceHerokuDomainCreate(d *schema.ResourceData, meta interface{}) error d.SetId(do.Id) d.Set("hostname", do.Hostname) d.Set("cname", fmt.Sprintf("%s.herokuapp.com", app)) + d.SetDependencies([]terraform.ResourceDependency{ + terraform.ResourceDependency{ID: app}, + }) log.Printf("[INFO] Domain ID: %s", d.Id()) return nil diff --git a/builtin/providers/heroku/resource_heroku_drain.go b/builtin/providers/heroku/resource_heroku_drain.go index a02e423cd..77087c591 100644 --- a/builtin/providers/heroku/resource_heroku_drain.go +++ b/builtin/providers/heroku/resource_heroku_drain.go @@ -6,6 +6,7 @@ import ( "github.com/bgentry/heroku-go" "github.com/hashicorp/terraform/helper/schema" + "github.com/hashicorp/terraform/terraform" ) func resourceHerokuDrain() *schema.Resource { @@ -51,6 +52,9 @@ func resourceHerokuDrainCreate(d *schema.ResourceData, meta interface{}) error { d.SetId(dr.Id) d.Set("url", dr.URL) d.Set("token", dr.Token) + d.SetDependencies([]terraform.ResourceDependency{ + terraform.ResourceDependency{ID: app}, + }) log.Printf("[INFO] Drain ID: %s", d.Id()) return nil