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

heroku_addon_attachment #19

Merged
merged 5 commits into from
Nov 7, 2017
Merged

heroku_addon_attachment #19

merged 5 commits into from
Nov 7, 2017

Conversation

JamesBelchamber
Copy link
Contributor

This creates the heroku_addon_attachment resource, which allows pre-existing addons to be attached to additional apps. Fixes #3

…xisting addons to be attached to additional apps
…ed Name to the heroku_addon schema (so it matches the documentation)
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

Hey @JamesBelchamber

Thanks for this PR, I've taken a look through and this mostly LGTM - if we can add an extra acceptance test covering the optional name field then this should be good to merge :)

Thanks!

app_id = "%s"
addon_id = "%s"
}`, appName, addonName)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

could we also add an additional test making use of the name field?

@JamesBelchamber
Copy link
Contributor Author

The tests were a bit dumb anyway, I've refactored them and added an extra one :)

func testAccCheckHerokuAddonAttachmentConfig_named(appName string, addonName string, name string) string {
return fmt.Sprintf(`
resource "heroku_addon_attachment" "foobar" {
app_id = "%s"
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the new test - I've just tried running the tests and they currently fail on an empty subscription due to the missing Heroku App:

$ acctests heroku TestAccHerokuAddonAttachment_
=== RUN   TestAccHerokuAddonAttachment_Basic
--- FAIL: TestAccHerokuAddonAttachment_Basic (1.40s)
	testing.go:434: Step 0 error: Error applying: 1 error(s) occurred:

		* heroku_addon_attachment.foobar: 1 error(s) occurred:

		* heroku_addon_attachment.foobar: Post https://api.heroku.com/addon-attachments: No such app.
=== RUN   TestAccHerokuAddonAttachment_Named
--- FAIL: TestAccHerokuAddonAttachment_Named (0.19s)
	testing.go:434: Step 0 error: Error applying: 1 error(s) occurred:

		* heroku_addon_attachment.foobar: 1 error(s) occurred:

		* heroku_addon_attachment.foobar: Post https://api.heroku.com/addon-attachments: No such app.
FAIL
exit status 1
FAIL	github.com/terraform-providers/terraform-provider-heroku/heroku	1.617s

.. could we update this to create the Heroku App as part of the tests so the tests are standalone? However this otherwise LGTM 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm. I haven't been running acctest so I didn't realise that. I'll get it working, will probably need to create an addon too.

Copy link
Contributor

Choose a reason for hiding this comment

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

@JamesBelchamber no worries, for context from the snippet above I'm using acctests as a bash wrapper for TF_ACC=1 go test ./heroku ... as it's less typing :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there a way to focus the test to a single resource? I'd rather avoid creating chargeable resources that I don't need to.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure - this command will run just a single test (the test name is a prefix match):

TF_ACC=1 go test ./heroku -v -timeout 120m -run=TestAccHerokuAddonAttachment_Basic

hope that helps - let me know if you want me to run any of the tests to confirm too :)

@JamesBelchamber
Copy link
Contributor Author

That should work better, we're creating the app and the addon now :)

@JamesBelchamber
Copy link
Contributor Author

$ TF_ACC=1 go test ./heroku -v -timeout 120m -run=TestAccHerokuAddonAttachment_Basic
=== RUN   TestAccHerokuAddonAttachment_Basic
--- PASS: TestAccHerokuAddonAttachment_Basic (6.44s)
PASS
ok      github.com/terraform-providers/terraform-provider-heroku/heroku 6.453s
$ TF_ACC=1 go test ./heroku -v -timeout 120m -run=TestAccHerokuAddonAttachment_Named
=== RUN   TestAccHerokuAddonAttachment_Named
--- PASS: TestAccHerokuAddonAttachment_Named (5.90s)
PASS
ok      github.com/terraform-providers/terraform-provider-heroku/heroku 5.911s

Passes tests :)

Copy link
Contributor

@tombuildsstuff tombuildsstuff 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 for this! Tests pass:

$ acctests heroku TestAccHerokuAddonAttachment_
=== RUN   TestAccHerokuAddonAttachment_Basic
--- PASS: TestAccHerokuAddonAttachment_Basic (7.75s)
=== RUN   TestAccHerokuAddonAttachment_Named
--- PASS: TestAccHerokuAddonAttachment_Named (6.89s)
PASS
ok  	github.com/terraform-providers/terraform-provider-heroku/heroku	14.664s

@tombuildsstuff tombuildsstuff merged commit bda6b7b into heroku:master Nov 7, 2017
@JamesBelchamber JamesBelchamber deleted the feature/addon-attachment branch November 7, 2017 11:52
tombuildsstuff added a commit that referenced this pull request Nov 7, 2017
mhelmich pushed a commit to mhelmich/terraform-provider-heroku that referenced this pull request Aug 20, 2018
mhelmich pushed a commit to mhelmich/terraform-provider-heroku that referenced this pull request Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants