Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/resources/pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ pipeline is created, and apps are added to different stages using
[`heroku_pipeline_coupling`](./pipeline_coupling.html), you can promote app
slugs to the next stage.

## Generation Compatibility

All apps in a pipeline must use the same Heroku platform generation (Cedar or Fir).
Attempting to add apps from different generations will result in an error.

## Ownership & Access

Pipelines may be created as Personal or Team resources. Access to a pipeline
Expand Down
15 changes: 12 additions & 3 deletions heroku/resource_heroku_pipeline_coupling.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"fmt"
"log"
"strings"

"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
Expand Down Expand Up @@ -67,7 +68,15 @@ func resourceHerokuPipelineCouplingCreate(d *schema.ResourceData, meta interface

p, err := client.PipelineCouplingCreate(context.TODO(), opts)
if err != nil {
return fmt.Errorf("Error creating pipeline: %s", err)
// Enhance generation-related errors with app context
errMsg := err.Error()
if strings.Contains(errMsg, "same generation") {
if app, appErr := client.AppInfo(context.TODO(), d.Get("app_id").(string)); appErr == nil {
return fmt.Errorf("%s\n\nYour app '%s' is %s generation. Ensure all apps in the pipeline use the same generation (Cedar or Fir)",
errMsg, app.Name, app.Generation.Name)
}
}
return fmt.Errorf("error creating pipeline: %s", err)
}

d.SetId(p.ID)
Expand All @@ -84,7 +93,7 @@ func resourceHerokuPipelineCouplingDelete(d *schema.ResourceData, meta interface

_, err := client.PipelineCouplingDelete(context.TODO(), d.Id())
if err != nil {
return fmt.Errorf("Error deleting pipeline: %s", err)
return fmt.Errorf("error deleting pipeline: %s", err)
}

return nil
Expand All @@ -95,7 +104,7 @@ func resourceHerokuPipelineCouplingRead(d *schema.ResourceData, meta interface{}

p, err := client.PipelineCouplingInfo(context.TODO(), d.Id())
if err != nil {
return fmt.Errorf("Error retrieving pipeline: %s", err)
return fmt.Errorf("error retrieving pipeline: %s", err)
}

d.Set("app_id", p.App.ID)
Expand Down