question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Document Terraform (CLI) as a dependency

See original GitHub issue

I’ve also filed this as a bug for the terraform-ls repo: https://github.com/hashicorp/terraform-ls/issues/398


OS: Darwin x64 20.2.0 (macOS Big Sur Version 11.1) VS Code: 1.53.0 VS Code Terraform Extension: v2.5.0


The VS Code Terraform extension always gives me the following message whenever I open any .tf file.

image

Then although I have already run terraform init, when I click the terraform init button I get the following message.

image


I was able to replicate this error when opening VS Code into a folder with a single minimal main.tf file.

File Tree

$ find . -print
.
./main.tf
./.terraform
./.terraform/plugins
./.terraform/plugins/darwin_amd64
./.terraform/plugins/darwin_amd64/terraform-provider-aws_v3.27.0_x5
./.terraform/plugins/darwin_amd64/lock.json

main.tf

terraform {
  required_version = ">= 0.12.26"

  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 3.0"
    }
  }
}

provider "aws" {
  region = "us-east-1"
}

terraform version output

$ terraform version
Terraform v0.12.30
+ provider.aws v3.27.0

terraform init output

$ terraform init

Initializing the backend...

Initializing provider plugins...

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.

terraform-ls logs output for the terraform VSCode extension. For this output:

  1. I opened VSCode to my test folder
  2. I opened main.tf which gave me the message in the first screenshot
  3. I clicked the terraform init button in the popup message
Launching language server: /Users/aburck/.vscode/extensions/hashicorp.terraform-2.5.0/lsp/terraform-ls serve for folder: file:///Users/aburck/code/local/test/
2021/02/07 02:15:06 serve_command.go:137: Starting terraform-ls 0.13.0
2021/02/07 02:15:06 service.go:71: Preparing new session ...
2021/02/07 02:15:06 watcher.go:215: watching for changes ...
2021/02/07 02:15:06 langserver.go:69: Starting server (pid 81470) ...
2021/02/07 02:15:06 server.go:573: Received 1 new requests
2021/02/07 02:15:06 server.go:174: Processing 1 requests
2021/02/07 02:15:06 server.go:265: Checking request for "initialize": {"processId":81445,"clientInfo":{"name":"vscode","version":"1.53.0"},"rootPath":"/Users/aburck/code/local/test","rootUri":"file:///Users/aburck/code/local/test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","member","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}}}},"window":{"workDoneProgress":true}},"initializationOptions":{"commandPrefix":"6","experimentalFeatures":{}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/aburck/code/local/test","name":"test"}]}
2021/02/07 02:15:06 rpc_logger.go:29: Incoming request for "initialize" (ID 0): {"processId":81445,"clientInfo":{"name":"vscode","version":"1.53.0"},"rootPath":"/Users/aburck/code/local/test","rootUri":"file:///Users/aburck/code/local/test","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional"},"didChangeConfiguration":{"dynamicRegistration":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]}},"executeCommand":{"dynamicRegistration":true},"configuration":true,"workspaceFolders":true,"semanticTokens":{"refreshSupport":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]}},"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}}},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","member","macro","keyword","modifier","comment","string","number","regexp","operator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}}}},"window":{"workDoneProgress":true}},"initializationOptions":{"commandPrefix":"6","experimentalFeatures":{}},"trace":"off","workspaceFolders":[{"uri":"file:///Users/aburck/code/local/test","name":"test"}]}
2021/02/07 02:15:06 walker.go:102: asynchronously walking through /Users/aburck/code/local/test
2021/02/07 02:15:06 rpc_logger.go:50: Response to "initialize" (ID 0): {"capabilities":{"textDocumentSync":{"openClose":true,"change":2,"save":{}},"completionProvider":{},"hoverProvider":true,"signatureHelpProvider":{},"documentSymbolProvider":true,"codeLensProvider":{},"documentLinkProvider":{},"documentFormattingProvider":true,"documentOnTypeFormattingProvider":{"firstTriggerCharacter":""},"executeCommandProvider":{"commands":["6.terraform-ls.rootmodules","6.terraform-ls.terraform.init","6.terraform-ls.terraform.validate"],"workDoneProgress":true},"semanticTokensProvider":{"legend":{"tokenTypes":["type","string","property"],"tokenModifiers":["deprecated","modification"]},"full":true},"workspace":{"workspaceFolders":{}}},"serverInfo":{"name":"terraform-ls","version":"0.13.0"}}
2021/02/07 02:15:06 walker.go:150: found module /Users/aburck/code/local/test
2021/02/07 02:15:06 server.go:246: Completed 1 requests [2.831693ms elapsed]
2021/02/07 02:15:06 module_manager.go:67: MM: adding new module: /Users/aburck/code/local/test
2021/02/07 02:15:06 module_loader.go:164: ML: enqueing "OpTypeGetTerraformVersion" module operation: /Users/aburck/code/local/test
2021/02/07 02:15:06 module_loader.go:164: ML: enqueing "OpTypeObtainSchema" module operation: /Users/aburck/code/local/test
2021/02/07 02:15:06 walker.go:202: walking of /Users/aburck/code/local/test finished
2021/02/07 02:15:06 walker.go:75: stopping walker
2021/02/07 02:15:06 walker.go:108: async walking through /Users/aburck/code/local/test finished
2021/02/07 02:15:06 module_loader.go:136: executing "OpTypeGetTerraformVersion" for /Users/aburck/code/local/test
2021/02/07 02:15:06 module_ops.go:83: getting executor failed: no exec path provided for terraform
2021/02/07 02:15:06 module_loader.go:144: finished "OpTypeGetTerraformVersion" for /Users/aburck/code/local/test
2021/02/07 02:15:06 module_loader.go:136: executing "OpTypeObtainSchema" for /Users/aburck/code/local/test
2021/02/07 02:15:06 module_ops.go:108: getting executor failed: no exec path provided for terraform
2021/02/07 02:15:06 module_loader.go:147: finished "OpTypeObtainSchema" for /Users/aburck/code/local/test
2021/02/07 02:15:06 server.go:573: Received 1 new requests
2021/02/07 02:15:06 server.go:174: Processing 1 requests
2021/02/07 02:15:06 server.go:265: Checking request for "initialized": {}
2021/02/07 02:15:06 rpc_logger.go:29: Incoming notification for "initialized": {}
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/didOpen": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf","languageId":"terraform","version":1,"text":"terraform {\n  required_version = \">= 0.12.26\"\n\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \"~> 3.0\"\n    }\n  }\n}\n\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n"}}
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 rpc_logger.go:29: Incoming notification for "textDocument/didOpen": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf","languageId":"terraform","version":1,"text":"terraform {\n  required_version = \">= 0.12.26\"\n\n  required_providers {\n    aws = {\n      source  = \"hashicorp/aws\"\n      version = \"~> 3.0\"\n    }\n  }\n}\n\nprovider \"aws\" {\n  region = \"us-east-1\"\n}\n"}}
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/documentLink": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 server.go:297: Task error: [-32601] no such method "textDocument/documentLink"
2021/02/07 02:15:32 did_open.go:58: opened module: /Users/aburck/code/local/test
2021/02/07 02:15:32 module_loader.go:164: ML: enqueing "OpTypeParseConfiguration" module operation: /Users/aburck/code/local/test
2021/02/07 02:15:32 module_loader.go:136: executing "OpTypeParseConfiguration" for /Users/aburck/code/local/test
2021/02/07 02:15:32 module_loader.go:150: finished "OpTypeParseConfiguration" for /Users/aburck/code/local/test
2021/02/07 02:15:32 watcher.go:73: adding module for watching: /Users/aburck/code/local/test
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "workspace/executeCommand": {"command":"6.terraform-ls.rootmodules","arguments":["uri=file:///Users/aburck/code/local/test/main.tf"]}
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/documentSymbol": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 rpc_logger.go:29: Incoming request for "textDocument/documentSymbol" (ID 3): {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 rpc_logger.go:50: Response to "textDocument/documentSymbol" (ID 3): [{"name":"terraform","kind":5,"location":{"uri":"file:///Users/aburck/code/local/test/main.tf","range":{"start":{"line":0,"character":0},"end":{"line":9,"character":1}}}},{"name":"provider \"aws\"","kind":5,"location":{"uri":"file:///Users/aburck/code/local/test/main.tf","range":{"start":{"line":11,"character":0},"end":{"line":13,"character":1}}}}]
2021/02/07 02:15:32 server.go:246: Completed 1 requests [207.198µs elapsed]
2021/02/07 02:15:32 server.go:443: Posting server notification "textDocument/publishDiagnostics" {"uri":"file:///Users/aburck/code/local/test/main.tf","diagnostics":[]}
2021/02/07 02:15:32 server.go:443: Posting server call "window/showMessageRequest" {"type":3,"message":"No schema found for \"test\". Functionality may be limited. You may need to run terraform init.","actions":[{"title":"terraform init"}]}
2021/02/07 02:15:32 rpc_logger.go:45: Error for "textDocument/documentLink" (ID 1): [-32601] no such method "textDocument/documentLink"
2021/02/07 02:15:32 server.go:246: Completed 1 requests [3.41341ms elapsed]
2021/02/07 02:15:32 rpc_logger.go:29: Incoming request for "workspace/executeCommand" (ID 2): {"command":"6.terraform-ls.rootmodules","arguments":["uri=file:///Users/aburck/code/local/test/main.tf"]}
2021/02/07 02:15:32 rpc_logger.go:50: Response to "workspace/executeCommand" (ID 2): {"responseVersion":0,"doneLoading":true,"rootModules":[]}
2021/02/07 02:15:32 server.go:246: Completed 1 requests [592.448µs elapsed]
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/semanticTokens/full": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 rpc_logger.go:29: Incoming request for "textDocument/semanticTokens/full" (ID 4): {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 module_manager.go:140: falling back to preloaded schema for /Users/aburck/code/local/test...
[Error - 2:15:32 AM] Request textDocument/documentLink failed.
  Message: no such method "textDocument/documentLink"
  Code: -32601 
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/documentSymbol": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/codeLens": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 server.go:297: Task error: [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:32 rpc_logger.go:45: Error for "textDocument/codeLens" (ID 6): [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:32 server.go:246: Completed 1 requests [76.85µs elapsed]
[Error - 2:15:32 AM] Request textDocument/codeLens failed.
  Message: no such method "textDocument/codeLens"
  Code: -32601 
2021/02/07 02:15:32 server.go:573: Received 1 new requests
2021/02/07 02:15:32 server.go:174: Processing 1 requests
2021/02/07 02:15:32 server.go:265: Checking request for "textDocument/codeLens": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:32 server.go:297: Task error: [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:32 rpc_logger.go:45: Error for "textDocument/codeLens" (ID 7): [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:32 server.go:246: Completed 1 requests [77.992µs elapsed]
[Error - 2:15:32 AM] Request textDocument/codeLens failed.
  Message: no such method "textDocument/codeLens"
  Code: -32601 
2021/02/07 02:15:33 module_manager.go:149: preloaded provider schema (134 providers) set for /Users/aburck/code/local/test
2021/02/07 02:15:33 rpc_logger.go:50: Response to "textDocument/semanticTokens/full" (ID 4): {"data":[0,0,9,0,0,1,2,16,2,0,2,2,18,0,0,1,4,3,2,0,7,0,8,0,0,0,9,5,1,2,1,2,6,2,2]}
2021/02/07 02:15:33 server.go:246: Completed 1 requests [895.307323ms elapsed]
2021/02/07 02:15:33 rpc_logger.go:29: Incoming request for "textDocument/documentSymbol" (ID 5): {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:33 rpc_logger.go:50: Response to "textDocument/documentSymbol" (ID 5): [{"name":"terraform","kind":5,"location":{"uri":"file:///Users/aburck/code/local/test/main.tf","range":{"start":{"line":0,"character":0},"end":{"line":9,"character":1}}}},{"name":"provider \"aws\"","kind":5,"location":{"uri":"file:///Users/aburck/code/local/test/main.tf","range":{"start":{"line":11,"character":0},"end":{"line":13,"character":1}}}}]
2021/02/07 02:15:33 server.go:246: Completed 1 requests [808.004139ms elapsed]
2021/02/07 02:15:36 server.go:573: Received 1 new requests
2021/02/07 02:15:36 server.go:174: Processing 1 requests
2021/02/07 02:15:36 server.go:265: Checking request for "": 
2021/02/07 02:15:36 server.go:443: Posting server call "window/workDoneProgress/create" {"token":"a824b024-691c-11eb-889c-acde48001122"}
2021/02/07 02:15:36 server.go:573: Received 1 new requests
2021/02/07 02:15:36 server.go:174: Processing 1 requests
2021/02/07 02:15:36 server.go:265: Checking request for "": 
2021/02/07 02:15:36 server.go:443: Posting server notification "window/showMessage" {"type":1,"message":"Initialization failed: no exec path provided for terraform"}
2021/02/07 02:15:36 server.go:573: Received 1 new requests
2021/02/07 02:15:36 server.go:174: Processing 1 requests
2021/02/07 02:15:36 server.go:265: Checking request for "textDocument/codeLens": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:36 server.go:297: Task error: [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:36 rpc_logger.go:45: Error for "textDocument/codeLens" (ID 8): [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:36 server.go:246: Completed 1 requests [64.883µs elapsed]
[Error - 2:15:36 AM] Request textDocument/codeLens failed.
  Message: no such method "textDocument/codeLens"
  Code: -32601 
2021/02/07 02:15:36 server.go:573: Received 1 new requests
2021/02/07 02:15:36 server.go:174: Processing 1 requests
2021/02/07 02:15:36 server.go:265: Checking request for "textDocument/codeLens": {"textDocument":{"uri":"file:///Users/aburck/code/local/test/main.tf"}}
2021/02/07 02:15:36 server.go:297: Task error: [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:36 rpc_logger.go:45: Error for "textDocument/codeLens" (ID 9): [-32601] no such method "textDocument/codeLens"
2021/02/07 02:15:36 server.go:246: Completed 1 requests [43.055µs elapsed]
[Error - 2:15:36 AM] Request textDocument/codeLens failed.
  Message: no such method "textDocument/codeLens"
  Code: -32601 

Terraform Install

$ which terraform
/Users/aburck/.local/bin/terraform

$ echo $PATH
/Users/aburck/.local/bin:...

I simply downloaded and extracted the terraform executable to ~/.local/bin. Then I added ~/.local/bin to my PATH via my ~/.zshrc using export PATH="$HOME/.local/bin:$PATH"

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:6
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
Helmut-Onnacommented, Feb 25, 2021

Can this error message be disabled completely? It didn’t existed in a previous version (no idea which since it got auto updated)

I move between directories and TF versions and every time I open a file I get the annoying message

No schema found for...

I only want the syntax highlight and formatting help. How can I disable the rest?

2reactions
burck1commented, Feb 22, 2021

I would be curious to know how you manage these different installations of Terraform locally. Would you just wget the archive and unzip the binary somewhere to $PATH? How do you know which version of Terraform to use when working with a particular project?

I imagine this is a common problem for someone who manages multiple projects and so understanding your workflow would help us support it better.

Sorry for the delayed response. We do something very similar to what @bevans-HD mentions. We commit a config file to our repos that specifies the terraform version to be used (among other CI / CD) settings. Then we’ve developed in-house wrapper around the terraform CLI that handles switching the terraform version used based on the config file (looks for the config file recursively in parent directories).

But for a more universal option, my suggestion for the vscode terraform extension would be to support the standard vscode extension workspace configuration settings that can be committed to our repos. Something along the lines of:

.vscode/settings.json

"terraform.version": "0.14.7"

Though it looks like we can override the terraform executable path, it’d be nice if the extension would handle downloading and switching it for us.

Furthermore, if this extension supported Multi-root Workspaces then we’d be able to setup each terraform configuration root in our repos with separate vscode settings and thus potentially separate terraform versions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create Resource Dependencies | Terraform
In this tutorial, you will learn about dependencies between resources and modules. Most of the time, Terraform infers dependencies between resources based ...
Read more >
CLI options - Terragrunt
The command will recursively find terragrunt modules in the current directory tree and run the terraform command in dependency order (unless the command...
Read more >
21 Terraform CLI Commands & Examples - Spacelift
terraform graph — Produces a graph in DOT language showing the dependencies between objects in the state file. This can then be rendered...
Read more >
The Ultimate Terraform Commands Cheat Sheet - A Cloud Guru
Grab our ultimate Terraform cheat sheet PDF for all the commands you ... can always pull up Terraform's built-in command-line documentation.
Read more >
Terraform: Dependency Lock File (.terraform.lock.hcl)
Terraform 0.14 and later uses the Dependency Lock File track its decision from one run to another on determining which dependencies are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found