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

/terraform-provider-heroku/heroku.resourceHerokuFormationRead: invalid memory address or nil pointer dereference #213

Open
cwallsfdc opened this issue Jul 2, 2019 · 2 comments

Comments

@cwallsfdc
Copy link

cwallsfdc commented Jul 2, 2019

Seeing the following during "heroku_formation.app: Refreshing state..."...

panic: runtime error: invalid memory address or nil pointer dereference
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd8687c]
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: 
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: goroutine 113 [running]:
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: github.com/terraform-providers/terraform-provider-heroku/heroku.resourceHerokuFormationRead(0xc0002e9d50, 0xf0dd80, 0xc0001a5bc0, 0xc0002e9d50, 0x0)

Terraform Version

Terraform v0.12.3
+ provider.heroku v2.0.1

Heroku Provider Version

See above.

Affected Resource(s)

  • resource "heroku_formation"
  • resource "heroku_build"

Terraform Configuration Files

Available upon request.

Debug Output

https://gist.github.com/cwallsfdc/c6fdc8c726919a700a81e6fc27e0a89d

Panic Output

https://gist.github.com/cwallsfdc/59f17c57f89cf7928f7e8bec84707938

Expected Behavior

A generated plan that builds and starts app.

Actual Behavior

panic: runtime error: invalid memory address or nil pointer dereference
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd8687c]
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: 
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: goroutine 113 [running]:
2019-07-01T21:06:46.755-0600 [DEBUG] plugin.terraform-provider-heroku_v2.0.1_x4: github.com/terraform-providers/terraform-provider-heroku/heroku.resourceHerokuFormationRead(0xc0002e9d50, 0xf0dd80, 0xc0001a5bc0, 0xc0002e9d50, 0x0)

Steps to Reproduce

See "Important Factoids".

Important Factoids

Changed app.tf from heroku_slug to heroku_build then ran terraform plan.

From:

# Create a slug for the app with a local slug archive file
resource "heroku_slug" "app" {
  app                            = "${heroku_app.app.id}"
  buildpack_provided_description = "Java"
  file_path                      = "${local.slug_filepath}"
  stack                          = "${local.stack}"

  commit = "${var.commit}"

  process_types = {
    web = "${local.web}"
  }
}

# Deploy a release to the app with the slug
resource "heroku_app_release" "app" {
  app     = "${heroku_app.app.id}"
  slug_id = "${heroku_slug.app.id}"
  depends_on = ["heroku_slug.app"]
}

# Launch the app's web process by scaling-up
resource "heroku_formation" "app" {
  app        = "${heroku_app.app.id}"
  type       = "web"
  quantity   = "${local.dyno_count}"
  size       = "${local.dyno_size}"
  depends_on = ["heroku_app_release.app"]
}

To:

resource "heroku_build" "app" {
    app = "${heroku_app.app.id}"

    buildpacks = "${local.buildpacks}"

    source = {
        path = "${local.slug_filepath}"
    }
}

# Launch the app's web process by scaling-up
resource "heroku_formation" "app" {
    app        = "${heroku_app.app.id}"
    type       = "web"
    quantity   = "${local.dyno_count}"
    size       = "${local.dyno_size}"
    depends_on = ["heroku_build.app"]
}
@ghost ghost added bug crash labels Jul 2, 2019
@mars
Copy link
Member

mars commented Jul 2, 2019

This is definitely a bug 🐞buuuuut if you try removing the existing formation from state and then re-apply, does it get past this?

terraform state rm heroku_formation.app
terraform plan

Formations are kind of weird ephemeral things, and using Terraform to try to migrate between build/release methods like that is undefined behavior.

@cwallsfdc
Copy link
Author

does it get past this?

Indeed it does. Thank you.

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

No branches or pull requests

2 participants