-
Notifications
You must be signed in to change notification settings - Fork 561
Adding first-class support for .tofu
files.
#811
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
Comments
I just merged #833 which adds support for .tofu files. I think this is a good first step. Let's see how this works out, and what we need to improve in the wild with projects that used a mix of both file endings. |
I think I'm using this wrong, cause files with |
@muffl0n , you are not wrong on this. I've spent a bit of time today and as of now As of now, we are only able to read header and footer from As I've looked around, nothing else needs to be done within I am going to reopen this issue for further tracking and visibility. |
Apologies for the omission! |
What problem are you facing?
OpenTofu is adding support for
.tofu
files in addition to.tf
files. Terraform only supports.tf
files, and OpenTofu will support both. This will allow users to have tool-specific configurations in places where it matters (e.g., provider functions landing in Terraform 1.8 and OpenTofu 1.7, and wanting to gate-keep the CLI tool by version).If two files have the same name with each file extension (e.g.,
main.tf
andmain.tofu
), OpenTofu will executemain.tofu
and NOTmain.tf
, while Terraform will executemain.tf
.It's still all HCL syntax in these files.
How could terraform-docs help solve your problem?
I don't believe that generating two sets of documentation is the right approach — one for Terraform, and one for OpenTofu. Instead, I believe that in cases where
.tofu
files exist, the OpenTofu configuration should be provided in tandem with the Terraform configuration.For example, in the JSON output,
requirements
is an array of objects, with each object definingname
andversion
. Perhaps this could be modified to support"name": "opentofu"
with its version, and for any providers/modules, there is a newtool
key which contains an array of tool identifiers (e.g.,terraform
andopentofu
).This would allow flexibility in the future in case (God forbid) another fork happens in the community. This also shouldn't (AFAIK) require any backwards-incompatible changes.
This would also mean that for content, it would be useful to define
.IsTerraform
and.IsOpenTofu
variables, so that users can adjust the examples or other custom documentation to more specifically target each tool.Ways for readers to switch between the two flavors of tooling could be either a tabbed interface (and a nice touch would be like many API documentation websites where if you select a preferred language in a tabbed interface to view those examples, that all other examples switch to that same language too) — OR something simpler, but less "nice" like a
<select>
HTML field where you can select which version to view.The text was updated successfully, but these errors were encountered: