Skip to content

Doesn't recognize object's values from module's output and lack of completions in object or array #2017

@nicraMarcin

Description

@nicraMarcin

Language Server Version

0.37.0

Terraform Version

Terraform v1.5.7 on darwin_arm64

Client Version

Zed 0.201.8

Terraform Configuration

# modules/aws-s3/main.tf
# used aws_provider - default

resource "aws_s3_bucket" "this" {
  bucket = var.bucket_name
}

# without {} works
output "bucket" {
  value = aws_s3_bucket.this
}

# trying to atuocomplete nested in {} or []
# after `aws` I'm pressing control+space without
# triggering autocompletion
output "bucket_object" {
  value = {
    bucket_id = aws.
  }
}

variable "bucket_name" {
  type = string
}

# ./main.tf
# just for testing main bucket
module "my-bucket" {
  source = "./modules/aws-s3"
  
  bucket_name = "my-bucket-very-strange-name"
}

#./sub-bucket.tf
# to use main bucket id as prefix for sub bucket
module "subbucket" {
  source = "./modules/aws-s3"
  
  # here responses till my-bucket.bucket
  # The bucket has attributes but nothing
  # is responded
  bucket_name = module.my-bucket.bucket
}

Steps to Reproduce

  1. Create new terraform directory.
    2 Create test module by creating directory modules/aws-s3
  2. in module directory configure aws-provider and create main.tf with simple s3 bucket, variable and output
    Here when we try to set directly resource.aws_s3_bucket ... completions works
Image

when we want to put resources into object or array - completions doesn't work

Image
  1. in root directory create main.tf to create s3 resource using created module using required value bucket_name
  2. Create file sub-bucket.tf to use created module and use created bucket's id from p.4 as new bucket's prefix name
    as we can see, terraform-ls doesn't return data that bucket has. (Jetbrains returns all bucket's data)
Image

Expected Behavior

terraform-ls should return resources data even if we use it in objects or arrays

values: [ data.xxxx ]

terraform-ls should return values from modules outputs which object has (similar as Jetbrains returns)

Actual Behavior

I don't know why it happens.

Gist

No response

Workarounds

No response

References

No response

Help Wanted

  • I'm interested in contributing a fix myself

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions