snapcrafters / terraform

Unofficial snap package for Hashicorp Terraform
https://snapcraft.io/terraform
Mozilla Public License 2.0
1 stars 3 forks source link

[Bug]: Terraform crashed! This is always indicative of a bug within Terraform. #104

Closed mcarvalhor closed 7 months ago

mcarvalhor commented 7 months ago

What happened?

Hi đź‘‹

It looks like the latest revision of Terraform snap (released today) is not working. When trying to run terraform plan or terraform apply it crashes.

Filling a bug here first, but not sure if this is an upstream issue that should go to https://github.com/hashicorp/terraform/issues instead.

Workaround for now: sudo snap refresh --channel="latest/stable" --revision="661" terraform && sudo snap refresh --hold terraform

What should have happened?

With terraform plan it should refresh and show the plan. With terraform apply it should refresh, show the plan and ask for "yes/no".

Output of snap info $snap_name

name:      terraform
summary:   Terraform enables you to create, change, and improve infrastructure.
publisher: Snapcrafters✪
store-url: https://snapcraft.io/terraform
contact:   https://github.com/jnsgruk/terraform/issues
license:   MPL-2.0
description: |
  Terraform enables you to safely and predictably create, change, and improve
  infrastructure. It is an open source tool that codifies APIs into
  declarative configuration files that can be shared amongst team members,
  treated as code, edited, reviewed, and versioned.

  **Are you having issues?**

  Let us know by creating a new issue here:
  https://github.com/snapcrafters/terraform/issues

  **Authors**

  This snap is maintained by the Snapcrafters community, and is not
  necessarily endorsed or officially maintained by the upstream developers.
commands:
  - terraform
snap-id:      8vbHYTd6VDLMIlISfzZDxzCRUFeSdBqT
tracking:     latest/stable
refresh-date: today at 15:34 -03
channels:
  latest/stable:    1.8.0 2024-04-11 (666) 28MB classic
  latest/candidate: 1.8.0 2024-04-11 (666) 28MB classic
  latest/beta:      ↑                           
  latest/edge:      ↑                           
installed:          1.8.0            (666) 28MB classic

Output of snap connections $snap_name

(empty - installed with "--classic")

Output of snap version

snap    2.61.3+23.10
snapd   2.61.3+23.10
series  16
ubuntu  23.10
kernel  6.5.0-27-generic

Relevant log output

TRACE: https://private-fileshare.canonical.com/~mcarvalhor/2024-04-11_terraform-snap-issue/.G3O6pIhrk5VktB5dXXCm/trace.log (136M)

DEBUG: https://private-fileshare.canonical.com/~mcarvalhor/2024-04-11_terraform-snap-issue/.G3O6pIhrk5VktB5dXXCm/debug.log (6M)

Teminal output of app

my-user@my-laptop:~/github-repositories/infrastructure-services/legacy/ps5/environments/is/production$ terraform plan

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

Terraform crashed! This is always indicative of a bug within Terraform.
Please report the crash with Terraform[1] so that we can fix this.

When reporting bugs, please include your terraform version, the stack trace
shown below, and any additional information which may help replicate the issue.

[1]: https://github.com/hashicorp/terraform/issues

!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

panic: runtime error: invalid memory address or nil pointer dereference
goroutine 83286 [running]:
runtime/debug.Stack()
    /snap/go/10585/src/runtime/debug/stack.go:24 +0x5e
github.com/hashicorp/terraform/internal/logging.PanicHandler()
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/logging/panic.go:84 +0x18b
panic({0x2f6ff80?, 0x577c190?})
    /snap/go/10585/src/runtime/panic.go:770 +0x132
github.com/hashicorp/terraform/internal/refactoring.findMoveStatements(0xc00495b340, {0x0?, 0xc009cb7700?, 0x10?})
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/refactoring/move_statement.go:73 +0x387
github.com/hashicorp/terraform/internal/refactoring.findMoveStatements(0xc000e587e0, {0x0?, 0xc010008c30?, 0xc00e5c5be0?})
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/refactoring/move_statement.go:96 +0x5f7
github.com/hashicorp/terraform/internal/refactoring.FindMoveStatements(...)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/refactoring/move_statement.go:45
github.com/hashicorp/terraform/internal/terraform.(*Context).prePlanFindAndApplyMoves(0xc008c73f00, 0xc000e587e0, 0xc00b3cd860)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/terraform/context_plan.go:508 +0x3f
github.com/hashicorp/terraform/internal/terraform.(*Context).planWalk(0xc008c73f00, 0xc000e587e0, 0xc0036da600, 0xc00837cb40)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/terraform/context_plan.go:632 +0x11b
github.com/hashicorp/terraform/internal/terraform.(*Context).plan(0x0?, 0x0?, 0x0?, 0xc009cb7e10?)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/terraform/context_plan.go:372 +0x1c
github.com/hashicorp/terraform/internal/terraform.(*Context).PlanAndEval(0xc008c73f00, 0xc000e587e0, 0xc0036da600, 0xc00837cb40)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/terraform/context_plan.go:247 +0x837
github.com/hashicorp/terraform/internal/terraform.(*Context).Plan(...)
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/terraform/context_plan.go:140
github.com/hashicorp/terraform/internal/backend/local.(*Local).opPlan.func2()
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/backend/local/backend_plan.go:108 +0xe9
created by github.com/hashicorp/terraform/internal/backend/local.(*Local).opPlan in goroutine 13
    /build/snapcraft-terraform-1ca286a77f07904dbca175185ebc132e/parts/terraform/build/internal/backend/local/backend_plan.go:104 +0x7b7
mcarvalhor commented 7 months ago

https://github.com/hashicorp/terraform/issues/34976 Still keeping this open as I believe it will need a new snap revision once fixed.

jnsgruk commented 7 months ago

This should now be solved :) https://github.com/snapcrafters/terraform/issues/106