We previously added the -config mode for showing the entire assembled configuration tree, including the content of any descendent modules, but that mode requires first running "tofu init" to install all of the provider and module dependencies of the configuration. This new -module=DIR mode returns a subset of the same JSON representation for only a single module that can be generated without first installing any dependencies, making this mode more appropriate for situations like generating documentation for a single module when importing it into the OpenTofu Registry. The registry generation process does not want to endure the overhead of installing other providers and modules when all it actually needs is metadata about the top-level declarations in the module. To minimize the risk to the already-working full-config JSON representation while still reusing most of its code, the implementation details of package jsonconfig are a little awkward here. Since this code changes relatively infrequently and is implementing an external interface subject to compatibility constraints, and since this new behavior is relatively marginal and intended primarily for our own OpenTofu Registry purposes, this is a pragmatic tradeoff that is hopefully compensated for well enough by the code comments that aim to explain what's going on for the benefit of future maintainers. If we _do_ find ourselves making substantial changes to this code at a later date then we can consider a more significant restructure of the code at that point; the weird stuff is intentionally encapsulated inside package jsonconfig so it can change later without changing any callers. Signed-off-by: Martin Atkins <mart@degeneration.co.uk>
OpenTofu Documentation
This directory contains the portions of the OpenTofu website that pertain to the core functionality, excluding providers and the overall configuration.
Development server
You can start a local development server with Docker by running the following command from this (the website) directory:
docker compose up --build
The development server will be available on http://localhost:3000/docs/main/ .
Under Docs in the navigation bar, select Development version to see local changes.
Suggesting Changes
You can submit an issue with documentation requests or submit a pull request with suggested changes.
Click Edit this page at the bottom of any OpenTofu website page to go directly to the associated markdown file in GitHub.
Modifying Sidebar Navigation
You must update the sidebar navigation when you add or delete documentation .mdx files. If you do not update the navigation, the website deploy preview fails.
To update the sidebar navigation, you must edit the appropriate nav-data.json file. This repository contains the sidebar navigation files for the following documentation sets:
- OpenTofu Language:
language-nav-data.json - OpenTofu CLI:
cli-nav-data.json - Introduction to OpenTofu:
intro-nav-data.json
Previewing Changes
Currently, you can preview your changes through the opentofu/opentofu.org repository.
Follow the Getting Started guide.
Copyright headers for code examples
In order to not include copyright headers for code examples used in docs, please, add the files under examples folder. This way, it will be ignored on automated copyright headers check.