-
Notifications
You must be signed in to change notification settings - Fork 77
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
Support buildpack registry names #170
Comments
👍 |
Seems reasonable. Maybe something along these lines: https://play.golang.org/p/Ndcb-IY5hpP |
Interesting, I was just thinking of using a
Of course they can be a pain |
Agreed @shawncatz , in the proposal I intentionally avoid parsing URLs in Terraform. Just because a value is a valid URI does not mean it's valid for a buildpack. By minimizing the Registry Name detection to a very simple regex for the single @talbright |
I was going to take a stab at a fix for this, but the complexity in the |
Understandable @shawncatz , I'm to putting this in my queue to work on in the next few weeks 📥 |
Yup, that was just a brief example, I didn't take it to the next step. You'd need to tease apart the |
I've been working on implementing this, but I've found it's blocked by the behavior of the Platform API. Specifically, when setting a buildpack by Definitely open to ideas here, but I don't think we'll be able to cleanly support Buildpack Registry Names because of this state churn. |
Here's a comparison of my changes thus far. …and here's the relevant output from the new test
|
My team has encountered this with |
@sigmavirus24, per my comment above:
🙅♂️ It's an incompatibility with Heroku API, because the API always returns the URL, not the name set in Terraform. This is the expected Terraform behavior, whenever it receives different resource attribute values from a provider's API. ✅ The only clean solution is to use buildpack URLs within Terraform configurations. |
I guess that means there's no way to replicate whatever |
That's a great point @sigmavirus24 👍 If the API call made by We're definitely open to contributions ✨ |
Indicates that the API is returning a URL in the name 😞 and that made me look at the CLI: https://github.com/heroku/cli/blob/01b9030435e457749d7ffa28883d758a5145c5fc/packages/buildpacks/src/buildpacks.ts#L140-L156 which uses this function to translate the URL to a "name" which is why it shows the right stuff above. It sounds like this kind of translation isn't something this provider wants to do, right? |
That's enlightening @sigmavirus24, that the API doesn't return a clean translation into the names. It looks like there's a pattern that could be matched to translate into a buildpack's Registry Name:
Unsure that this is the complete set of rules 🤷 Implementing this would also require a custom diff to compare the two possible value variations to each of the buildpack list entries. All that said, I think it's fine to add such translation logic to the provider, even though it's not ideal separation of concerns. We have plenty of crafty workarounds for such challenges with Heroku API, and this would just be another one! |
Various resources have attributes that allow setting buildpacks:
heroku_app
heroku_build
Currently, these resources implicitly support only
http
URLs, although the Heroku Platform API now supports Buildpack Registry names as well.Thanks to recent updates to the heroku-go client, registry names can now be implemented in these resources.
I proposed implementing a simple heuristic to detect Registry Names:
The heuristic would be shared between the
heroku_app
&heroku_build
resources.And then the detected value would be set into the underlying
name
orurl
property.The text was updated successfully, but these errors were encountered: