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

provider/heroku: Add resources for Heroku Pipelines #14078

Merged
merged 8 commits into from
May 1, 2017

Conversation

justincampbell
Copy link
Contributor

Adds 2 resources: heroku_pipeline and heroku_pipeline_coupling to allow managing Heroku Pipelines with Terraform.

Example Terraform config:

resource "heroku_pipeline" "default" {
  name = "my-pipeline"
}

resource "heroku_app" "alpha" {
  name   = "justincampbell-test-alpha"
  region = "us"
}

resource "heroku_pipeline_coupling" "alpha" {
  app      = "${heroku_app.alpha.id}"
  pipeline = "${heroku_pipeline.default.id}"
  stage    = "development"
}

resource "heroku_app" "beta" {
  name   = "justincampbell-test-beta"
  region = "us"
}

resource "heroku_pipeline_coupling" "beta" {
  app      = "${heroku_app.beta.id}"
  pipeline = "${heroku_pipeline.default.id}"
  stage    = "staging"
}

resource "heroku_app" "release" {
  name   = "justincampbell-test-release"
  region = "us"
}

resource "heroku_pipeline_coupling" "release" {
  app      = "${heroku_app.release.id}"
  pipeline = "${heroku_pipeline.default.id}"
  stage    = "production"
}

Acceptance test output:

$ clear; make testacc TEST=./builtin/providers/heroku TESTARGS="-run Pipeline"
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/04/28 16:16:16 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/heroku -v -run Pipeline -timeout 120m
=== RUN   TestAccHerokuPipelineCoupling_Basic
--- PASS: TestAccHerokuPipelineCoupling_Basic (4.58s)
=== RUN   TestAccHerokuPipeline_Basic
--- PASS: TestAccHerokuPipeline_Basic (2.92s)
=== RUN   TestPipelineStage
--- PASS: TestPipelineStage (0.00s)

@justincampbell justincampbell changed the title Add resources for Heroku Pipelines provider/heroku: Add resources for Heroku Pipelines Apr 28, 2017
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 very minor nits. Thanks!

client := meta.(*heroku.Service)

opts := heroku.PipelineCreateOpts{}
opts.Name = d.Get("name").(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this is a required attribute, can initialize the PipelineCreateOpts struct with the Name field populated:

opts := heroku.PipelineCreateOpts{
  Name: d.Get("name").(string),
}

client := meta.(*heroku.Service)

opts := heroku.PipelineCouplingCreateOpts{}
opts.App = d.Get("app").(string)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, as these are all required parameters

}

if foundPipelineCoupling.ID != rs.Primary.ID {
return fmt.Errorf("PipelineCoupling not found")
Copy link
Contributor

Choose a reason for hiding this comment

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

Could output the difference in ID's here for clarity

}
}

func testAccCheckHerokuPipelineCouplingAttributes(coupling *heroku.PipelineCouplingInfoResult, _, pipelineResource, stageName string) resource.TestCheckFunc {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the extra argument here?

"github.com/satori/uuid"
)

var validPipelineStageNames = []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

should scope this to the validator function

@justincampbell
Copy link
Contributor Author

Thanks @grubernaut! I addressed each of the comments above.

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 05654b0 into hashicorp:master May 1, 2017
@danp danp mentioned this pull request May 2, 2017
@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.

2 participants