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

Tell heroku_addon that the addon cannot update its plan #317

Open
Floby opened this issue Jun 30, 2021 · 3 comments
Open

Tell heroku_addon that the addon cannot update its plan #317

Floby opened this issue Jun 30, 2021 · 3 comments
Assignees
Labels

Comments

@Floby
Copy link

Floby commented Jun 30, 2021

Some Heroku Addons (for example Heroku PostgreSQL) cannot update their plan in place. The heroku_addon resource assumes all addons can. Updating the plan of a heroku_addon with the posgresql addon results in a unapplyable valid plan.

Feature Request:

  1. The provider automatically detects (if this information is available through the API) that the addon's plan cannot be updated and forces recreation of the resource.

  2. Add a recreate_on_upgrade = true|false argument to heroku_addon to force destroy and recreate rather than update in-place.

Terraform Version

v1.0.1

Heroku Provider Version

4.5.1

Affected Resource(s)

  • heroku_addon

Terraform Configuration Files

resource "heroku_app"  "api" {
  region  = "eu"
  name = var.app_name
}
resource "heroku_addon" "database" {
  app  = heroku_app.api.name
  plan = "heroku-postgresql:${var.db_plan}"
}

Expected Behavior

The provider detects that heroku-postresql cannot change plan in-place and force recreation of the resource when applying with a different plan.

Actual Behavior

terraform produces a plan that cannot be applied.

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply -var db_plan=hobby-basic
  2. terraform apply -var db_plan=standard-0
@Floby
Copy link
Author

Floby commented Jun 30, 2021

For anyone interested, my current workaround is this

resource "heroku_addon" "database" {
  for_each = toset([var.db_plan])
  app  = heroku_app.api.name
  plan = "heroku-postgresql:${each.key}"
}

@davidji99
Copy link
Collaborator

davidji99 commented Jul 1, 2021

Hi @Floby,

Thanks for reporting this issue! We'd definitely need to modify heroku_addon's behavior to account for non-updatable addons.

The proposed solution for an additional boolean type attribute on heroku_addon would not force a resource recreation event unless the behavior was to toggle recreate_on_upgrade to true/false every time you wanted to trigger a recreation. This sort of behavior would not be desirable and introduces a superfluous attribute is not needed in the modification of an addon. It is likely we'll need to leverage a similar solution implemented in the heroku_build resource to specifically designate the heroku_addon.plan attribute for recreation based on the addon prefix name (heroku-postgresql).

I'll take a look at this in the coming days.

@davidji99 davidji99 self-assigned this Jul 1, 2021
@davidji99 davidji99 added the bug label Jul 1, 2021
@Floby
Copy link
Author

Floby commented Jul 1, 2021

thanks for your reply ! I didn't know if this sort of information was available through the API so I added the 2nd proposition just in case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants