1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00

tofu: add page (#16031)

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
This commit is contained in:
Coba 2025-03-27 22:50:19 +01:00 committed by GitHub
parent e6f06f790d
commit b2854347d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 100 additions and 0 deletions

20
pages/common/tofu-fmt.md Normal file
View file

@ -0,0 +1,20 @@
# tofu fmt
> Format configuration according to OpenTofu language style conventions.
> More information: <https://opentofu.org/docs/cli/commands/fmt/>.
- Format the configuration in the current directory:
`tofu fmt`
- Format the configuration in the current directory and subdirectories:
`tofu fmt -recursive`
- Display diffs of formatting changes:
`tofu fmt -diff`
- Do not list files that were formatted to `stdout`:
`tofu fmt -list=false`

View file

@ -0,0 +1,20 @@
# tofu output
> Export structured data about your OpenTofu resources.
> More information: <https://opentofu.org/docs/cli/commands/output/>.
- With no additional arguments, `output` will display all outputs for the root module:
`tofu output`
- Output only a value with specific name:
`tofu output {{name}}`
- Convert the output value to a raw string (useful for shell scripts):
`tofu output -raw`
- Format the outputs as a JSON object, with a key per output (useful with `jq`):
`tofu output -json`

32
pages/common/tofu-plan.md Normal file
View file

@ -0,0 +1,32 @@
# tofu plan
> Generate and show OpenTofu execution plans.
> More information: <https://opentofu.org/docs/cli/commands/plan/>.
- Generate and show the execution plan in the currently directory:
`tofu plan`
- Show a plan to destroy all remote objects that currently exist:
`tofu plan -destroy`
- Show a plan to update the Tofu state and output values:
`tofu plan -refresh-only`
- Specify values for input variables:
`tofu plan -var '{{name1}}={{value1}}' -var '{{name2}}={{value2}}'`
- Focus Tofu's attention on only a subset of resources:
`tofu plan -target {{resource_type.resource_name[instance index]}}`
- Output a plan as JSON:
`tofu plan -json`
- Write a plan to a specific file:
`tofu plan -no-color > {{path/to/file}}`

28
pages/common/tofu.md Normal file
View file

@ -0,0 +1,28 @@
# tofu
> Create and deploy infrastructure as code to cloud providers. Open-source fork of Terraform.
> More information: <https://opentofu.org/>.
- Initialize a new or existing OpenTofu configuration:
`tofu init`
- Verify that the configuration files are syntactically valid:
`tofu validate`
- Format configuration according to OpenTofu language style conventions:
`tofu fmt`
- Generate and show an execution plan:
`tofu plan`
- Build or change infrastructure:
`tofu apply`
- Destroy Tofu-managed infrastructure:
`tofu destroy`