Search code examples
heroku

Automatically add addon from app.json, heroku.yml or other config


I would like to provide a button from github to directly deploy an app. Its a go application which serves some website.

Now for persistent data it requires an addon "Heroku Postgres".

I tried defining a heroku.yml with:

setup:
  addons:
    - plan: heroku-postgresql

I tried app.json with:

{
  "addons": ["heroku-postgresql:hobby-dev"]
}

But it does nothing at all, it never adds the addon. I know I can add it manually through the website or CLI, but I want a fully automatic way - if that is possible.


Solution

  • It should look something like this

     "addons": [
        {
          "plan": "heroku-postgresql",
          "options": {
            "version": "12"
        }
      }
    ]
    

    Example app.json from heroku