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 show crashes when AWS_PROFILE env is missing #31127

Closed
sateeshblue opened this issue May 25, 2022 · 5 comments
Closed

terraform show crashes when AWS_PROFILE env is missing #31127

sateeshblue opened this issue May 25, 2022 · 5 comments
Labels
bug cli confirmed a Terraform Core team member has reproduced this issue crash

Comments

@sateeshblue
Copy link

Terraform Version

Terraform v1.2.1
on linux_amd64
+ provider registry.terraform.io/cloudposse/awsutils v0.11.0
+ provider registry.terraform.io/hashicorp/aws v4.11.0
+ provider registry.terraform.io/hashicorp/cloudinit v2.2.0
+ provider registry.terraform.io/hashicorp/random v3.1.3
+ provider registry.terraform.io/hashicorp/tls v3.3.0

Terraform Configuration Files

!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

can't construct diagnostic(s) from string
goroutine 1 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x19
github.com/hashicorp/terraform/internal/logging.PanicHandler()
        /home/circleci/project/project/internal/logging/panic.go:55 +0x153
panic({0x22b6a40, 0xc000d437c0})
        /usr/local/go/src/runtime/panic.go:844 +0x258
github.com/hashicorp/terraform/internal/tfdiags.Diagnostics.Append({0x0?, 0xb8?, 0x26b428d?}, {0xc000c1f7f0?, 0x1, 0x3e8a710?})
        /home/circleci/project/project/internal/tfdiags/diagnostics.go:86 +0xa0e
github.com/hashicorp/terraform/internal/command.(*ShowCommand).showFromLatestStateSnapshot(0xc000188000)
        /home/circleci/project/project/internal/command/show.go:154 +0x245
github.com/hashicorp/terraform/internal/command.(*ShowCommand).show(0xc000188000, {0x0, 0x0})
        /home/circleci/project/project/internal/command/show.go:93 +0x6d
github.com/hashicorp/terraform/internal/command.(*ShowCommand).Run(0xc000188000, {0xc00004c050?, 0xffffffffffffffff?, 0x0?})
        /home/circleci/project/project/internal/command/show.go:51 +0x218
github.com/mitchellh/cli.(*CLI).Run(0xc0002c6500)
        /home/circleci/go/pkg/mod/github.com/mitchellh/cli@v1.1.3/cli.go:262 +0x5f8
main.realMain()
        /home/circleci/project/project/main.go:312 +0x15b4
main.main()
        /home/circleci/project/project/main.go:58 +0x19

Debug Output

Expected Behavior

terraform listing

Actual Behavior

Steps to Reproduce

terraform show

Additional Context

exporting the AWS_PROFILE fixes the issue

References

@sateeshblue sateeshblue added bug new new issue not yet triaged labels May 25, 2022
@jbardin jbardin added cli confirmed a Terraform Core team member has reproduced this issue and removed new new issue not yet triaged labels May 25, 2022
@crw
Copy link
Collaborator

crw commented May 28, 2022

Thanks for the report!

@bschaatsbergen
Copy link
Member

bschaatsbergen commented Jun 20, 2022

I'll happily look into this. Meanwhile @sateeshblue can you please share some more details on your setup so that I can reproduce this.

@richardkmichael
Copy link

I have the same crash, but it's not with a missing AWS_PROFILE -- instead it happens if the backend is unavailable.

Terraform 1.2.4, configured to use the HTTP backend, stored in a GitLab repo. Without a username and password (TF_HTTP_USERNAME|PASSWORD), it crashes.

terraform {
  backend "http" {
    address = "https://gitlab.com/api/v4/projects/NNN/terraform/state/default"
    lock_address = "https://gitlab.com/api/v4/projects/NNN/terraform/state/default/lock"
    unlock_address = "https://gitlab.com/api/v4/projects/NNN/terraform/state/default/lock"
    lock_method = "POST"
    unlock_method = "DELETE"
    retry_wait_min = 5
  }
}
 $ terraform show
!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!

can't construct diagnostic(s) from string
goroutine 1 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x68
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x20
github.com/hashicorp/terraform/internal/logging.PanicHandler()
        /Users/distiller/project/project/internal/logging/panic.go:55 +0x174
panic({0x1068b2020, 0x14000b928b0})
        /usr/local/go/src/runtime/panic.go:844 +0x258
github.com/hashicorp/terraform/internal/tfdiags.Diagnostics.Append({0x0?, 0x3e?, 0x1060bc6be?}, {0x140009bf7b8?, 0x1, 0x16?})
        /Users/distiller/project/project/internal/tfdiags/diagnostics.go:86 +0x8b4
github.com/hashicorp/terraform/internal/command.(*ShowCommand).showFromLatestStateSnapshot(0x14000603860)
        /Users/distiller/project/project/internal/command/show.go:154 +0x1c8
github.com/hashicorp/terraform/internal/command.(*ShowCommand).show(0x14000603860, {0x0, 0x0})
        /Users/distiller/project/project/internal/command/show.go:93 +0x50
github.com/hashicorp/terraform/internal/command.(*ShowCommand).Run(0x14000603860, {0x14000110030?, 0x6?, 0xffffffffffffffff?})
        /Users/distiller/project/project/internal/command/show.go:51 +0x1a8
github.com/mitchellh/cli.(*CLI).Run(0x1400087eb40)
        /Users/distiller/go/pkg/mod/github.com/mitchellh/cli@v1.1.4/cli.go:262 +0x4cc
main.realMain()
        /Users/distiller/project/project/main.go:312 +0x12b0
main.main()
        /Users/distiller/project/project/main.go:58 +0x20

 $ terraform -version
Terraform v1.2.4
on darwin_arm64
+ provider registry.terraform.io/hashicorp/aws v4.14.0
+ provider registry.terraform.io/hashicorp/random v3.1.0

$ uname -a
Darwin air.local 20.6.0 Darwin Kernel Version 20.6.0: Tue Apr 19 21:04:40 PDT 2022; root:xnu-7195.141.29~1/RELEASE_ARM64_T8101 arm64

@kmoe kmoe added the crash label Jul 15, 2022
@jbardin
Copy link
Member

jbardin commented Aug 4, 2022

Closed via #31444

@jbardin jbardin closed this as completed Aug 4, 2022
@github-actions
Copy link

github-actions bot commented Sep 4, 2022

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug cli confirmed a Terraform Core team member has reproduced this issue crash
Projects
None yet
Development

No branches or pull requests

6 participants