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

Add OpenTofu .tofu extension to HCL #7189

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

adalinesimonian
Copy link

Adds .tofu extension to HCL, as used by OpenTofu.

Description

OpenTofu supports .tf as used by Terraform, but uses .tofu to allow OpenTofu-specific behaviour to be ignored by Terraform. The project has also reserved any new OpenTofu syntax for compatibility reasons to .tofu files alone. New language-changing syntax that would require adjustments to syntax highlighting has not been introduced, so therefore I believe it is safe to simply add .tofu as an extension for HCL.

Adoption of .tofu seems to have been more rapid amongst end-users, who likely have private repositories. While there are still several hundred results on GitHub, most lengthy, good examples of HCL in use with the .tofu extension were likely going to be behind this wall. Therefore, I wrote a length-enough example that resembles code I have in production at my employer and with other projects. I am happy to have it licensed under Linguist's MIT licence.

Checklist:

  • I am adding a new extension to a language.

@adalinesimonian adalinesimonian requested a review from a team as a code owner January 2, 2025 21:53
@lildude lildude changed the title feat: Support OpenTofu .tofu extension for HCL Add OpenTofu .tofu extension to HCL Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants