Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

providers/heroku: add heroku_space resource #13921

Merged
merged 6 commits into from
Apr 25, 2017

Conversation

bernerdschaefer
Copy link
Contributor

This introduces a new heroku_space resource for managing Heroku Private Spaces.

It creates, renames, and destroys private spaces in the configured region.

Combined with #13862, this should resolve #7059.

Acceptance test results
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/24 17:43:53 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/heroku -v  -timeout 120m
=== RUN   TestProvider
--- PASS: TestProvider (0.00s)
=== RUN   TestProvider_impl
--- PASS: TestProvider_impl (0.00s)
=== RUN   TestAccHerokuAddon_Basic
--- PASS: TestAccHerokuAddon_Basic (4.19s)
=== RUN   TestAccHerokuAddon_noPlan
--- PASS: TestAccHerokuAddon_noPlan (5.59s)
=== RUN   TestAccHerokuApp_Basic
--- PASS: TestAccHerokuApp_Basic (2.81s)
=== RUN   TestAccHerokuApp_NameChange
--- PASS: TestAccHerokuApp_NameChange (5.03s)
=== RUN   TestAccHerokuApp_NukeVars
--- PASS: TestAccHerokuApp_NukeVars (5.05s)
=== RUN   TestAccHerokuApp_Organization
--- PASS: TestAccHerokuApp_Organization (3.16s)
=== RUN   TestAccHerokuCert_Basic
--- PASS: TestAccHerokuCert_Basic (19.18s)
=== RUN   TestAccHerokuDomain_Basic
--- PASS: TestAccHerokuDomain_Basic (3.28s)
=== RUN   TestAccHerokuDrain_Basic
--- PASS: TestAccHerokuDrain_Basic (3.30s)
=== RUN   TestAccHerokuSpace_Basic
--- PASS: TestAccHerokuSpace_Basic (7.24s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/heroku	58.851s

d.SetId(space.ID)
log.Printf("[INFO] Space ID: %s", d.Id())

setSpaceAttributes(d, (*heroku.Space)(space))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the vendored version of heroku-go is updated, this type conversion can be dropped, as the Space methods have been updated to all return *heroku.Space.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding an inline comment here noting this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly! Done in e7c904a.

# Create a new Heroku app in test-space
resource "heroku_app" "default" {
name = "test-app"
space = "${heroku_space.default.name}"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit of documentation is only accurate if #13862 is also merged.

if org == "" {
t.Skip("HEROKU_ORGANIZATION is not set; skipping test.")
}
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder if this needs an additional flag, like HEROKU_ENABLE_SPACES=1, since not all organizations can currently create private spaces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return an API error if the organization cannot create a private space, yeah?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right, this should return a 403 Forbidden error for organizations without space management access.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay cool, if the error returned from the API is sufficiently descriptive enough, I don't think we'll need to add the env-var.

Copy link
Contributor

@grubernaut grubernaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, few minor nits though, nothing major. Thanks!

d.SetId(space.ID)
log.Printf("[INFO] Space ID: %s", d.Id())

setSpaceAttributes(d, (*heroku.Space)(space))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding an inline comment here noting this?

if org == "" {
t.Skip("HEROKU_ORGANIZATION is not set; skipping test.")
}
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will return an API error if the organization cannot create a private space, yeah?

## Example Usage

```hcl
# Create a new Heroku space
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use // for inline comments in examples

region = "virginia"
}

# Create a new Heroku app in test-space
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 26d6a56.

Copy link
Contributor

@grubernaut grubernaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@grubernaut grubernaut merged commit 22ed31c into hashicorp:master Apr 25, 2017
vanstee pushed a commit to vanstee/terraform that referenced this pull request Sep 28, 2017
providers/heroku: add heroku_space resource
vanstee pushed a commit to vanstee/terraform that referenced this pull request Sep 28, 2017
providers/heroku: add heroku_space resource
@ghost
Copy link

ghost commented Apr 13, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Heroku Spaces Support
3 participants