terraform-ls icon indicating copy to clipboard operation
terraform-ls copied to clipboard

Support expanding function arguments (fn([1,2,3]...)

Open canidam opened this issue 10 months ago • 0 comments

Language Server Version

v0.36.4

Problem Statement

I have a list variable I pass to a function, where I use expansion symbol (...) to pass items as separate parameters.

For example:

variable "private_cidr_newbits" {
  type        = list(number)
  default     = [3, 3, 3]
  description = "The newbits value passed to cidrsubnets function"
}

When I pass it to function such as cidrsubnets(var.cidr, var.private_cidr_newbits...) I get this error:

Image

Using the variable without expansion elsewhere works fine. (passing it to a variable that is expected to be a list)

Attempted Solutions

No response

Proposal

No response

Related LSP methods

No response

References

  • https://developer.hashicorp.com/terraform/language/expressions/function-calls#expanding-function-arguments

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

canidam avatar Feb 11 '25 07:02 canidam