Skip to content

Support provider-defined functions syntax #98

Closed
@dbanck

Description

@dbanck

Background

We currently only have a static list of valid function names in the Terraform grammar. Provider-defined functions introduce a new syntax for function calls, provider::aws::noop(). Also, it's impossible to compile all function names as a static list in the grammar, so we'll just assume that any function call with this new snytax is valid.

Proposal

  • Update Terraforms functions grammar block, e.g.
  functions:
    begin: ([:\w]+)(\()
    name: meta.function-call.hcl
    comment: Built-in and provider defined function calls
    beginCaptures:
      "1":
        patterns:
          - match: \b(abs|abspath|...|zipmap)\b
            name: support.function.builtin.terraform
          - match: \b(provider::\w+::\w+)\b
            name: support.function.provider
      "2":
        name: punctuation.section.parens.begin.hcl
    end: \)
  • Add some tests for the new syntax

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions