Files
opentf/website/docs/cli/code/index.mdx
2024-04-24 13:24:30 +02:00

34 lines
1.6 KiB
Plaintext

---
description: >-
Learn commands that help validate, format, and upgrade code written in the
OpenTofu Configuration Language.
---
# Writing and Modifying OpenTofu Code
The [OpenTofu language](../../language/index.mdx) is OpenTofu's primary
user interface, and all of OpenTofu's workflows rely on configurations written
in the OpenTofu language.
OpenTofu CLI includes several commands to make OpenTofu code more convenient
to work with. Integrating these commands into your editing workflow can
potentially save you time and effort.
- [The `tofu console` command](../commands/console.mdx) starts an
interactive shell for evaluating OpenTofu
[expressions](../../language/expressions/index.mdx), which can be a faster way
to verify that a particular resource argument results in the value you expect.
- [The `tofu fmt` command](../commands/fmt.mdx) rewrites OpenTofu
configuration files to a canonical format and style, so you don't have to
waste time making minor adjustments for readability and consistency. It works
well as a pre-commit hook in your version control system.
- [The `tofu validate` command](../commands/validate.mdx) validates the
syntax and arguments of the OpenTofu configuration files in a directory,
including argument and attribute names and types for resources and modules.
The `plan` and `apply` commands automatically validate a configuration before
performing any other work, so `validate` isn't a crucial part of the core
workflow, but it can be very useful as a pre-commit hook or as part of a
continuous integration pipeline.