providers/heroku: add cname to domain

This commit is contained in:
Jack Pearkes 2014-07-23 15:55:01 -04:00
parent 26d5c093da
commit accc477984
2 changed files with 4 additions and 0 deletions

View File

@ -34,6 +34,7 @@ func resource_heroku_domain_create(
rs.ID = do.Id rs.ID = do.Id
rs.Attributes["hostname"] = do.Hostname rs.Attributes["hostname"] = do.Hostname
rs.Attributes["cname"] = fmt.Sprintf("%s.herokuapp.com", app)
log.Printf("[INFO] Domain ID: %s", rs.ID) log.Printf("[INFO] Domain ID: %s", rs.ID)
@ -80,6 +81,7 @@ func resource_heroku_domain_refresh(
} }
s.Attributes["hostname"] = domain.Hostname s.Attributes["hostname"] = domain.Hostname
s.Attributes["cname"] = fmt.Sprintf("%s.herokuapp.com", s.Attributes["app"])
return s, nil return s, nil
} }

View File

@ -26,6 +26,8 @@ func TestAccHerokuDomain_Basic(t *testing.T) {
"heroku_domain.foobar", "hostname", "terraform.example.com"), "heroku_domain.foobar", "hostname", "terraform.example.com"),
resource.TestCheckResourceAttr( resource.TestCheckResourceAttr(
"heroku_domain.foobar", "app", "terraform-test-app"), "heroku_domain.foobar", "app", "terraform-test-app"),
resource.TestCheckResourceAttr(
"heroku_domain.foobar", "cname", "terraform-test-app.herokuapp.com"),
), ),
}, },
}, },