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 crash on attempted autocomplete of workspace name #30193

Closed
socketbox opened this issue Dec 17, 2021 · 4 comments · Fixed by #30316
Closed

Terraform crash on attempted autocomplete of workspace name #30193

socketbox opened this issue Dec 17, 2021 · 4 comments · Fixed by #30316
Labels
bug cli confirmed a Terraform Core team member has reproduced this issue v1.1 Issues (primarily bugs) reported against v1.1 releases

Comments

@socketbox
Copy link

Terraform Version

[2021-12-17 02:48:04]» terraform version                        
Terraform v1.1.1                                                
on linux_amd64                                                  
+ provider registry.terraform.io/cloudflare/cloudflare v3.5.0   
+ provider registry.terraform.io/hashicorp/google v3.79.0       
+ provider registry.terraform.io/hashicorp/google-beta v3.75.0  
+ provider registry.terraform.io/hashicorp/kubernetes v2.4.1    
+ provider registry.terraform.io/hashicorp/null v3.1.0          
+ provider registry.terraform.io/hashicorp/random v3.1.0        

Terraform Configuration Files

Not sure if this is applicable

Debug Output

                                                                                                                                                                │
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!                                                                                       │
                                                                                                                                                               │
runtime error: invalid memory address or nil pointer dereferencegoroutine 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:44 +0xb5                                                                                      │
panic({0x221d240, 0x3ed5b10})                                                                                                                                  │
        /usr/local/go/src/runtime/panic.go:1047 +0x266                                                                                                         │
github.com/hashicorp/terraform/internal/command.completePredictSequence.Predict(...)                                                                           │
        /home/circleci/project/project/internal/command/autocomplete.go:32                                                                                     │
github.com/posener/complete.(*Command).predict(0xc0001af590, {{0xc0000db230, 0x1, 0x1}, {0xc0000db230, 0x0, 0x1}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:107 +0x5fe                                                                     │
github.com/posener/complete.(*Command).predict(0xc0001af560, {{0xc0000db220, 0x2, 0x2}, {0xc0000db220, 0x1, 0x2}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5                                                                      │
github.com/posener/complete.(*Command).predict(0xc00036ec40, {{0xc0000db210, 0x3, 0x3}, {0xc0000db210, 0x2, 0x3}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5                                                                      │
github.com/posener/complete.(*Command).Predict(...)                                                                                                            │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:27                                                                             │
github.com/posener/complete.(*Complete).Complete(0xc00036ec40)                                                                                                 │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/complete.go:69 +0x1b9                                                                     │
github.com/mitchellh/cli.(*CLI).Run(0xc00044cb40)                                                                                                              │
        /home/circleci/go/pkg/mod/github.com/mitchellh/[email protected]/cli.go:184 +0xaa                                                                             │
main.realMain()                                                                                                                                                │
        /home/circleci/project/project/main.go:309 +0x1509                                                                                                     │
main.main()                                                                                                                                                    │
        /home/circleci/project/project/main.go:58 +0x19                                                                                                        │
                                                                                                                                                               │
!!!!!!!!!!!!!!!!!!!!!!!!!!! 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 !!!!!!!!!!!!!!!!!!!!!!!!!!!!                                                                                       │
                                                                                                                                                               │
runtime error: invalid memory address or nil pointer dereferencegoroutine 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:44 +0xb5                                                                                      │
panic({0x221d240, 0x3ed5b10})                                                                                                                                  │
        /usr/local/go/src/runtime/panic.go:1047 +0x266                                                                                                         │
github.com/hashicorp/terraform/internal/command.completePredictSequence.Predict(...)                                                                           │
        /home/circleci/project/project/internal/command/autocomplete.go:32                                                                                     │
github.com/posener/complete.(*Command).predict(0xc000662f90, {{0xc000164370, 0x1, 0x1}, {0xc000164370, 0x0, 0x1}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:107 +0x5fe                                                                     │
github.com/posener/complete.(*Command).predict(0xc000662f60, {{0xc000164360, 0x2, 0x2}, {0xc000164360, 0x1, 0x2}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5                                                                      │
github.com/posener/complete.(*Command).predict(0xc0004860e0, {{0xc000164350, 0x3, 0x3}, {0xc000164350, 0x2, 0x3}, {0xc00005e265, 0x4}, {0xc00005e25e, ...}})   │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5                                                                      │
github.com/posener/complete.(*Command).Predict(...)                                                                                                            │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/command.go:27                                                                             │
github.com/posener/complete.(*Complete).Complete(0xc0004860e0)                                                                                                 │
        /home/circleci/go/pkg/mod/github.com/posener/[email protected]/complete.go:69 +0x1b9                                                                     │
github.com/mitchellh/cli.(*CLI).Run(0xc000454280)                                                                                                              │
        /home/circleci/go/pkg/mod/github.com/mitchellh/[email protected]/cli.go:184 +0xaa                                                                             │
main.realMain()                                                                                                                                                │
        /home/circleci/project/project/main.go:309 +0x1509                                                                                                     │
main.main()                                                                                                                                                    │
        /home/circleci/project/project/main.go:58 +0x19                                                                                                        │
                       tf workspace delete case                                                                                                                │
Completing `corrections'                                                                                                                                       │

Expected Behavior

After typing the first four letters of a workspace and hitting Tab, the name of either one of the two workspaces that begin with the string case should have been displayed.

Actual Behavior

The application crashed. See crash output above.

Steps to Reproduce

  1. Create a workspace named foobar.
  2. Create a second workspace called foobaz
  3. Attempt to delete the first workspace by typing terraform workspace delete foo<Tab>

Additional Context

Not that this is unusual, but I'm running terraform inside of tmux in zsh.

References

I searched for the word "crash" in open issues but found none.

@socketbox socketbox added bug new new issue not yet triaged labels Dec 17, 2021
@crw
Copy link
Collaborator

crw commented Dec 17, 2021

Thanks for this report, I was able to easily reproduce this on terraform 1.1.2 / darwin arm64 in zsh.

@kbechler
Copy link

kbechler commented Dec 30, 2021

I was able to reproduce it on

> terraform version
Terraform v1.1.2
on linux_amd64
+ provider registry.terraform.io/kreuzwerker/docker v2.13.0

and bash autocompletion

@apparentlymart apparentlymart added v1.1 Issues (primarily bugs) reported against v1.1 releases cli confirmed a Terraform Core team member has reproduced this issue and removed new new issue not yet triaged labels Jan 4, 2022
@0xdnL
Copy link

0xdnL commented Jan 7, 2022

Can confirm this crash

terraform version
Terraform v1.1.3
on darwin_amd64
!!!!!!!!!!!!!!!!!!!!!!!!!!! TERRAFORM CRASH !!!!!!!!!!!!!!!!!!!!!!!!!!!!

runtime error: invalid memory address or nil pointer dereference
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()
        /Users/distiller/project/project/internal/logging/panic.go:55 +0x154
panic({0x2e24ae0, 0x4aea0d0})
        /usr/local/go/src/runtime/panic.go:1047 +0x266
github.com/hashicorp/terraform/internal/command.completePredictSequence.Predict(...)
        /Users/distiller/project/project/internal/command/autocomplete.go:32
github.com/posener/complete.(*Command).predict(0xc00078f140, {{0xc0007fde90, 0x1, 0x3}, {0xc0007fde90, 0x0, 0x3}, {0x0, 0x0}, {0xc00005a10e, ...}})
        /Users/distiller/go/pkg/mod/github.com/posener/[email protected]/command.go:107 +0x5fe
github.com/posener/complete.(*Command).predict(0xc00078f110, {{0xc0007fde80, 0x2, 0x4}, {0xc0007fde80, 0x1, 0x4}, {0x0, 0x0}, {0xc00005a10e, ...}})
        /Users/distiller/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5
github.com/posener/complete.(*Command).predict(0xc00037c380, {{0xc0007fde70, 0x3, 0x5}, {0xc0007fde70, 0x2, 0x5}, {0x0, 0x0}, {0xc00005a10e, ...}})
        /Users/distiller/go/pkg/mod/github.com/posener/[email protected]/command.go:73 +0x9a5
github.com/posener/complete.(*Command).Predict(...)
        /Users/distiller/go/pkg/mod/github.com/posener/[email protected]/command.go:27
github.com/posener/complete.(*Complete).Complete(0xc00037c380)
        /Users/distiller/go/pkg/mod/github.com/posener/[email protected]/complete.go:69 +0x1b9
github.com/mitchellh/cli.(*CLI).Run(0xc0005417c0)
        /Users/distiller/go/pkg/mod/github.com/mitchellh/[email protected]/cli.go:184 +0xaa
main.realMain()
        /Users/distiller/project/project/main.go:309 +0x1509
main.main()
        /Users/distiller/project/project/main.go:58 +0x19

@github-actions
Copy link

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 Feb 21, 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 v1.1 Issues (primarily bugs) reported against v1.1 releases
Projects
None yet
5 participants