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

Panic when provider or resource label contains ` #1026

Closed
dbanck opened this issue Aug 4, 2022 · 1 comment · Fixed by #1030
Closed

Panic when provider or resource label contains ` #1026

dbanck opened this issue Aug 4, 2022 · 1 comment · Fixed by #1030
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dbanck
Copy link
Member

dbanck commented Aug 4, 2022

Server Version

main@48ab782618ea68c80b25dcd323d95f6ab93eb56f

Terraform Configuration Files

resource "`" "name" {
  
}

provider "`" {
  
}

Log Output

panic: must contain only letters, digits, and dashes, and may not use leading or trailing dashes

goroutine 25 [running]:
github.com/hashicorp/terraform-registry-address.MustParseProviderPart({0x1b708a0?, 0xc00044a150?})
	/Users/dbanck/go/pkg/mod/github.com/hashicorp/[email protected]/provider.go:440 +0x4c
github.com/hashicorp/terraform-schema/internal/addr.NewLegacyProvider(...)
	/Users/dbanck/Projects/terraform-schema/internal/addr/addr.go:10
github.com/hashicorp/terraform-schema/earlydecoder.LoadModule({0xc0000cc247, 0x24}, 0xc00063a0ac?)
	/Users/dbanck/Projects/terraform-schema/earlydecoder/decoder.go:134 +0xe16
github.com/hashicorp/terraform-ls/internal/terraform/module.LoadModuleMetadata(0xc0000ccff0?, {0xc0000ccff7, 0x24})
	/Users/dbanck/Projects/terraform-ls/internal/terraform/module/module_ops.go:248 +0x208
github.com/hashicorp/terraform-ls/internal/indexer.(*Indexer).decodeModule.func1({0xc00048c760?, 0xc0000ccff0?})
	/Users/dbanck/Projects/terraform-ls/internal/indexer/document_change.go:67 +0x47
github.com/hashicorp/terraform-ls/internal/scheduler.(*Scheduler).eval(0xc00044ac60, {0x182b420, 0xc000425fc0})
	/Users/dbanck/Projects/terraform-ls/internal/scheduler/scheduler.go:68 +0x109
created by github.com/hashicorp/terraform-ls/internal/scheduler.(*Scheduler).Start
	/Users/dbanck/Projects/terraform-ls/internal/scheduler/scheduler.go:48 +0x65

Expected Behavior

No crash, instead diagnostics with the error

Actual Behavior

terraform-ls crashes

Steps to Reproduce

Accidentally type ` into a provider or resource label.

@dbanck dbanck added the bug Something isn't working label Aug 4, 2022
@dbanck dbanck changed the title Panic when block label contains ` Panic when provider or resource label contains ` Aug 4, 2022
@radeksimko radeksimko self-assigned this Aug 4, 2022
@radeksimko radeksimko added this to the v0.29.0 milestone Aug 4, 2022
@github-actions
Copy link

github-actions bot commented Sep 8, 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 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants