Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Terraform JSON (*.tf.json) config files #498

Closed
radeksimko opened this issue May 7, 2021 · 1 comment · Fixed by #672
Closed

Support Terraform JSON (*.tf.json) config files #498

radeksimko opened this issue May 7, 2021 · 1 comment · Fixed by #672

Comments

@radeksimko
Copy link
Member

Current Version

0.16.1

Context

Users can write their configuration as HCL - which is typically preferred when configuration is hand-written, or they can choose to use a JSON-based variant of the language when generating configuration.

https://www.terraform.io/docs/language/syntax/json.html

Use-cases

There is little benefit (esp. when compared to the amount of effort needed to implement it) in improving editing experience of JSON configuration, such as providing completion, hover, semantic highlighting etc. within .tf.json.

However users would likely benefit from the parsed version of that file, for example:

  • diagnostics where configuration of the module as whole is considered
  • references from generated .tf.json files are completable within .tf files

Proposal

  • modify ParseConfiguration background operation so that it also parses .tf.json
    name := info.Name()
    if !strings.HasSuffix(name, ".tf") || IsIgnoredFile(name) {
    continue
    }
  • update any logic within hcl-lang to make sure that completion/hover/sem. tokens etc. for within these JSON files gracefully error out (i.e. not crash or error with weird errors), or are ignored
  • update any logic within hcl-lang to make sure references are collected and filtered correctly from JSON files
@radeksimko radeksimko changed the title Parse Terraform JSON (.tf.json) configuration Support Terraform JSON (*.tf.json) config files May 19, 2021
@radeksimko radeksimko self-assigned this Sep 22, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant