Okay, here is the output from the logging…
2020/07/10 16:14:55 root_module_manager.go:138: looking up
/Users/raul/repos/aws/resolver-inbound in module references of /Users/raul/repos/aws/ccoe-unbound
2020/07/10 16:14:55 server.go:342: Posting server notification “window/showMessage” {“type”:2,“message”:“No root module found for main.tf. Functionality may be limited. You may need to run terraform init”}
2020/07/10 16:15:04 server.go:469: Received 1 new requests
2020/07/10 16:15:04 server.go:165: Processing 1 requests
2020/07/10 16:15:04 server.go:223: Checking request for “textDocument/didClose”: {“textDocument”:{“uri”:“file:///Users/raul/repos/aws/resolver-inbound/main.tf”}}
2020/07/10 16:15:04 rpc_logger.go:29: Incoming notification for “textDocument/didClose”: {“textDocument”:{“uri”:“file:///Users/raul/repos/aws/resolver-inbound/main.tf”}}
2020/07/10 16:15:04 server.go:469: Received 1 new requests
2020/07/10 16:15:04 server.go:165: Processing 1 requests
2020/07/10 16:15:04 server.go:223: Checking request for “textDocument/didOpen”: {“textDocument”:{“uri”:“file:///Users/raul/repos/aws/resolver-inbound/outputs.tf”,“languageId”:“terraform”,“version”:1,“text”:“output "account_id" {\n value = data.aws_caller_identity.current.account_id\n}\noutput "caller_arn" {\n value = data.aws_caller_identity.current.arn\n}\noutput "caller_user" {\n value = data.aws_caller_identity.current.user_id\n}\noutput "sg_id" {\n value = aws_security_group.sg.id\n}\noutput "sg_allow_tcp_id" {\n value = aws_security_group_rule.allow_dns_tcp.id\n}\noutput "sg_allow_udp_id" {\n value = aws_security_group_rule.allow_dns_udp.id\n}\n”}}
2020/07/10 16:15:04 rpc_logger.go:29: Incoming notification for “textDocument/didOpen”: {“textDocument”:{“uri”:“file:///Users/raul/repos/aws/resolver-inbound/outputs.tf”,“languageId”:“terraform”,“version”:1,“text”:“output "account_id" {\n value = data.aws_caller_identity.current.account_id\n}\noutput "caller_arn" {\n value = data.aws_caller_identity.current.arn\n}\noutput "caller_user" {\n value = data.aws_caller_identity.current.user_id\n}\noutput "sg_id" {\n value = aws_security_group.sg.id\n}\noutput "sg_allow_tcp_id" {\n value = aws_security_group_rule.allow_dns_tcp.id\n}\noutput "sg_allow_udp_id" {\n value = aws_security_group_rule.allow_dns_udp.id\n}\n”}}
2020/07/10 16:15:04 root_module_manager.go:138: looking up /Users/raul/repos/aws/resolver-inbound in module references of /Users/raul/repos/aws/ccoe-unbound
2020/07/10 16:15:04 server.go:342: Posting server notification “window/showMessage” {“type”:2,“message”:“No root module found for outputs.tf. Functionality may be limited. You may need to run terraform init”}
It looks like the information I did not provide may be part of the problem. I have three git projects in the vs code workspace. It appears that the language server is treating them as if they were one common set of code.
After removing the two other projects from the workspace, then the language server stops complaining. I understand the behavior now.
I don’t know if this should be considered a bug or an enhancement request, but it would be useful if I did not have to have one workspace per project as it makes refactoring trickier.