Skip to content

Conversation

@wata727
Copy link
Member

@wata727 wata727 commented Oct 16, 2024

Follow up of #214

#214 cannot find provider-defined function calls in JSON syntax because it implicitly assumes the expression to be hclsyntax.FunctionCallExpr when walking expressions.

This PR fixes it to find function calls by taking advantage of the fact that evaluating a JSON syntax expression in a nil context always results in a template string that can be parsed in native syntax. This is the same logic used to find function calls in TFLint.
https://github.com/terraform-linters/tflint/blob/v0.53.0/terraform/lang/function_calls.go#L21

Given the fact that this logic is reusable in this rule, it might be worth providing it as an SDK API, but that's outside the scope here.

@wata727 wata727 merged commit ac15058 into main Nov 3, 2024
2 checks passed
@wata727 wata727 deleted the support_provider_defined_function_in_json_syntax branch November 3, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants