François Beausoleil
François Beausoleil

Reputation: 16515

How to remove addon when attached with multiple names on Heroku?

We're migrating some things around and needed to attach the same database using two different environment variables temporarily. Now that we migrated, I would like to remove the attachment, but sadly, the Heroku command-line client says that I have an ambiguous identifier:

$ heroku addons --app $APP_SOURCE

Add-on                                                          Plan         Price     State
──────────────────────────────────────────────────────────────  ───────────  ────────  ───────
heroku-postgresql (...)                    hobby-basic  $9/month  created
 ├─ as DATABASE
 ├─ as HEROKU_POSTGRESQL_ORANGE
 ├─ as DATABASE on stb-crds-rails-sf app
 ├─ as SHARETHEBUS_RAILS_DATABASE on stb-crds-rails-sf app
 └─ as SHARETHEBUS_RAILS_DATABASE_URL on stb-crds-rails-sf app


$ heroku addons:detach --app stb-crds-rails-sf $ADDON_NAME
 ▸    Ambiguous identifier; multiple matching attachments found: DATABASE, SHARETHEBUS_RAILS_DATABASE, SHARETHEBUS_RAILS_DATABASE_URL.

I tried also tried heroku addons:detach --app stb-crds-rails-sf $ADDON_NAME --as SHARETHEBUS_RAILS_DATABASE_URL and heroku addons:detach --app stb-crds-rails-sf $ADDON_NAME SHARETHEBUS_RAILS_DATABASE_URL, but the command-line says the last arguments are unexpected.

What are our options to remove the extra addons?

Upvotes: 4

Views: 906

Answers (1)

François Beausoleil
François Beausoleil

Reputation: 16515

Turns out you can use the variable name instead of the addon name:

$ heroku addons:detach SHARETHEBUS_RAILS_DATABASE_URL

Upvotes: 5

Related Questions