Skip to content

Docs/reference rewrites phrase 1 #530

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

Draft
wants to merge 46 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
b241d7f
Got check and variable plus output
rkoron007 Jun 9, 2025
58725a2
First try at porting work
rkoron007 Jun 9, 2025
bb10416
Forgot a page
rkoron007 Jun 9, 2025
87524e3
Fix all the links except resource
rkoron007 Jun 10, 2025
9ed571a
recreate PR from old repo
trujillo-adam Jun 10, 2025
0c284fc
Add variable page
rkoron007 Jun 12, 2025
c61607f
Add a variable page, fix links, and add notes where I will drop the u…
rkoron007 Jun 12, 2025
95a9c85
Fix more links
rkoron007 Jun 12, 2025
d539d09
Remove the old variable page
rkoron007 Jun 12, 2025
6c754d3
Add the rewritten `locals` block reference page (#494)
rkoron007 Jun 16, 2025
ba21a7d
sync with current iteration
trujillo-adam Jun 26, 2025
ec8df98
fix minor typos in resource block ref
trujillo-adam Jun 26, 2025
87504a9
adds data block reference
trujillo-adam Jun 27, 2025
aa9dc5a
commit changes from review
trujillo-adam Jun 30, 2025
a4f11e8
update data source usage page
trujillo-adam Jun 25, 2025
17d4990
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
43bf6c8
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
6f9be5d
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
2139a61
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
3f9f1c2
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
468e41f
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
ffb80a0
Update content/terraform/v1.12.x/docs/language/data-sources/index.mdx
trujillo-adam Jun 30, 2025
c39b860
Apply suggestions from code review
trujillo-adam Jun 30, 2025
330794a
Apply suggestions from code review
trujillo-adam Jun 30, 2025
4ca0814
Apply suggestions from code review
trujillo-adam Jun 30, 2025
e389805
Apply suggestions from code review
trujillo-adam Jun 30, 2025
921292e
updated dependencies section
trujillo-adam Jul 1, 2025
92787e3
tweaks to moved block and linked usage page
trujillo-adam Jun 24, 2025
8402881
Apply suggestions from code review
trujillo-adam Jul 1, 2025
2a6609e
apply feedback from review
trujillo-adam Jul 1, 2025
2d349ae
First try at porting work
rkoron007 Jun 9, 2025
797a088
Add a variable page, fix links, and add notes where I will drop the u…
rkoron007 Jun 12, 2025
ae0b37e
Add the rewritten `locals` block reference page (#494)
rkoron007 Jun 16, 2025
32ad0fa
added removed block reference
trujillo-adam Jun 19, 2025
ab99207
reverted prov connection settings partial
trujillo-adam Jul 1, 2025
b1c2e5a
First try at porting work
rkoron007 Jun 9, 2025
2247b0f
Add a variable page, fix links, and add notes where I will drop the u…
rkoron007 Jun 12, 2025
74d79d3
Add the rewritten `locals` block reference page (#494)
rkoron007 Jun 16, 2025
b9ee7d2
Apply suggestions from code review
trujillo-adam Jun 30, 2025
6e435a1
Apply suggestions from code review
trujillo-adam Jun 30, 2025
9ea2ab3
minor fixes
trujillo-adam Jul 2, 2025
264e080
fix typo
trujillo-adam Jul 2, 2025
34a657a
update page description
trujillo-adam Jul 2, 2025
1e6732d
added removed block reference (#508)
trujillo-adam Jul 2, 2025
dff0e98
normalize blocks nav
trujillo-adam Jul 2, 2025
03ff44e
normalize blocks nav (#535)
trujillo-adam Jul 2, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions content/terraform/v1.11.x/docs/language/ephemeral/index.mdx
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
---
page_title: Ephemeral block reference for the Terraform configuration language
page_title: Ephemeral block configuration reference
description: Learn to define ephemeral blocks in Terraform configurations to keep temporary and sensitive information out of Terraform state and plan files.
---

# Ephemeral block reference
# Ephemeral block configuration reference

Ephemeral resources are Terraform resources that are essentially temporary. Ephemeral resources have a unique lifecycle, and Terraform does not store them in its state. Each `ephemeral` block describes one or more ephemeral resources, such as a temporary password or connection to another system.
This topic provides reference information for the `ephemeral` block.

-> **Note**: Ephemeral resources are available in Terraform v1.10 and later.

## Lifecycle

The lifecycle of an `ephemeral` resource is different from other resources and data sources. Terraform performs the following lifecycle steps for each ephemeral resource in a configuration:

1. If Terraform needs to access the result of an ephemeral resource, it opens
that ephemeral resource. For example, if Terraform opens an ephemeral resource for a Vault secret, the Vault provider obtains a lease and returns the secret.
## Introduction

1. If Terraform needs access to the ephemeral resource for longer than the
remote system's enforced expiration time, Terraform asks the provider
to periodically renew it. For example, if Terraform renews a Vault secret `ephemeral` resource, the Vault provider calls Vault's lease renewal API endpoint to extend the expiration time.

1. Once Terraform no longer needs an ephemeral resource, Terraform closes
it. This happens after the providers that depend on an ephemeral resource
complete all of their work for the current Terraform run phase. For example, closing a Vault secret ephemeral resource means the Vault provider explicitly ends the lease, allowing Vault to immediately revoke the associated credentials.
Ephemeral resources are Terraform resources that are essentially temporary. Ephemeral resources have a unique lifecycle, and Terraform does not store them in its state. Each `ephemeral` block describes one or more ephemeral resources, such as a temporary password or connection to another system.

## Dependency graph

Expand Down Expand Up @@ -64,9 +53,9 @@ ephemeral resources:

* In a [write-only argument](/terraform/language/resources/ephemeral/write-only)
* In another ephemeral resource
* In [local values](/terraform/language/values/locals#ephemeral-values)
* In [ephemeral variables](/terraform/language/values/variables#exclude-values-from-state)
* In [ephemeral outputs](/terraform/language/values/outputs#ephemeral-avoid-storing-values-in-state-or-plan-files)
* In [local values](/terraform/language/block/locals)
* In [ephemeral variables](/terraform/language/block/variable#ephemeral)
* In [ephemeral outputs](/terraform/language/block/output#ephemeral)
* Configuring providers in the `provider` block
* In [provisioner](/terraform/language/resources/provisioners/syntax) and [connection](/terraform/language/resources/provisioners/connection) blocks

Expand Down
58 changes: 51 additions & 7 deletions content/terraform/v1.12.x/data/language-nav-data.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@
"routes": [
{ "title": "Overview", "path": "values" },
{ "title": "Input Variables", "path": "values/variables" },
{ "title": "Output Values", "path": "values/outputs" },
{ "title": "Local Values", "path": "values/locals" }
{ "title": "Output block", "href": "/terraform/language/block/output" },
{ "title": "Locals block", "href": "/terraform/language/block/locals" }
]
},
{
Expand Down Expand Up @@ -336,7 +336,13 @@
}
]
},
{ "title": "Checks", "path": "checks" },
{ "title": "Check block", "href": "/terraform/language/block/check" },
{
"title": "Testing and Validation",
"routes": [
{ "title": "Validate your configuration", "path": "test-and-validate/validate" }
]
},
{
"title": "Import",
"routes": [
Expand Down Expand Up @@ -379,10 +385,6 @@
"title": "Dynamic Blocks",
"path": "expressions/dynamic-blocks"
},
{
"title": "Custom Conditions",
"path": "expressions/custom-conditions"
},
{
"title": "Type Constraints",
"path": "expressions/type-constraints"
Expand Down Expand Up @@ -1117,5 +1119,47 @@
"path": "v1-compatibility-promises"
},
{ "divider": true },
{ "heading": "REFERENCE" },
{
"title": "Configuration blocks",
"routes": [
{
"title": "check",
"path": "block/check"
},
{
"title": "data",
"path": "block/data"
},
{
"title": "locals",
"path": "block/locals"
},
{
"title": "moved",
"path": "block/moved"
},
{
"title": "output",
"path": "block/output"
},
{
"title": "removed",
"path": "block/removed"
},
{
"title": "resource",
"path": "block/resource"
},
{
"title": "terraform",
"path": "block/terraform"
},
{
"title": "variable",
"path": "block/variable"
}
]
},
{ "title": "Terraform Internals", "href": "/internals" }
]
6 changes: 3 additions & 3 deletions content/terraform/v1.12.x/docs/cli/commands/import.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ The command-line flags are all optional. The following flags are available:
can be set multiple times. Variable values are interpreted as
[literal expressions](/terraform/language/expressions/types) in the
Terraform language, so list and map values can be specified via this flag.

<!-- TODO: add link to new variable usage page once done -->
- `-var-file=foo` - Set variables in the Terraform configuration from
a [variable file](/terraform/language/values/variables#variable-definitions-tfvars-files). If
a [variable file](/terraform/language/block/variable#variable-definitions-tfvars-files). If
`terraform.tfvars` or any `.auto.tfvars` files are present in the current
directory, they are automatically loaded. Terraform loads `terraform.tfvars`
directory, they are automatically loaded. Terraform loads `terraform.tfvars`
first and the `.auto.tfvars` files after in alphabetical order. Any files
specified by `-var-file` override any values set automatically from files in
the working directory. This flag can be used multiple times. This is only
Expand Down
21 changes: 11 additions & 10 deletions content/terraform/v1.12.x/docs/cli/commands/plan.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ description: >-
changes that Terraform will make to your infrastructure.
---

# `terraform plan` command
# `terraform plan` command

The `terraform plan` command creates an execution plan, which lets you preview
the changes that Terraform plans to make to your infrastructure.
the changes that Terraform plans to make to your infrastructure.

## Introduction
By default, Terraform performs the following operations when it creates a plan:
Expand Down Expand Up @@ -138,25 +138,25 @@ In addition to alternate [planning modes](#planning-modes), there are several op
-> **Note:** Use `-target=ADDRESS` in exceptional circumstances only, such as recovering from mistakes or working around Terraform limitations. Refer to [Resource Targeting](#resource-targeting) for more details.

- `-var 'NAME=VALUE'` - Sets a value for a single
[input variable](/terraform/language/values/variables) declared in the
[input variable](/terraform/language/block/variable) declared in the
root module of the configuration. Use this option multiple times to set
more than one variable. Refer to
[Input Variables on the Command Line](#input-variables-on-the-command-line) for more information.

<!-- TODO: add link to new variable usage page once done -->
- `-var-file=FILENAME` - Sets values for potentially many
[input variables](/terraform/language/values/variables) declared in the
[input variables](/terraform/language/block/variable) declared in the
root module of the configuration, using definitions from a
["tfvars" file](/terraform/language/values/variables#variable-definitions-tfvars-files).
["tfvars" file](/terraform/language/block/variable#variable-definitions-tfvars-files).
Use this option multiple times to include values from more than one file.

<!-- TODO: add link to new variable usage page once done -->
There are several other ways to set values for input variables in the root
module, aside from the `-var` and `-var-file` options. Refer to
[Assigning Values to Root Module Variables](/terraform/language/values/variables#assigning-values-to-root-module-variables) for more information.
[Assigning Values to Root Module Variables](/terraform/language/block/variable#assigning-values-to-root-module-variables) for more information.

### Input Variables on the Command Line

You can use the `-var` command line option to specify values for
[input variables](/terraform/language/values/variables) declared in your
[input variables](/terraform/language/block/variable) declared in your
root module.

However, to do so will require writing a command line that is parsable both
Expand Down Expand Up @@ -222,10 +222,11 @@ terraform plan -var 'name=["a", "b", "c"]'
terraform plan -var "name=[\"a\", \"b\", \"c\"]"
```

<!-- TODO: add link to new variable usage page once done -->
Similar constraints apply when setting input variables using environment
variables. For more information on the various methods for setting root module
input variables, see
[Assigning Values to Root Module Variables](/terraform/language/values/variables#assigning-values-to-root-module-variables).
[Assigning Values to Root Module Variables](/terraform/language/block/variable#assigning-values-to-root-module-variables).

### Resource Targeting

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
page_title: Terraform CLI environment variables reference
description: >-
Terraform environment variables let you customize the Terraform CLI's default behavior.
Terraform environment variables let you customize the Terraform CLI's default behavior.
Learn about the Terraform CLI environment variables.
---

Expand Down Expand Up @@ -61,7 +61,8 @@ export TF_VAR_alist='[1,2,3]'
export TF_VAR_amap='{ foo = "bar", baz = "qux" }'
```

For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/terraform/language/values/variables).
<!-- TODO: add link to new variable usage page once done -->
For more on how to use `TF_VAR_name` in context, check out the section on [Variable Configuration](/terraform/language/block/variable).

## TF_CLI_ARGS and TF_CLI_ARGS_name

Expand Down
4 changes: 2 additions & 2 deletions content/terraform/v1.12.x/docs/cli/inspect/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
page_title: Inspect infrastructure
page_title: Inspect infrastructure
description: >-
The terraform inspect commands return dependency information and outputs. Learn how to use terraform inspect commands
to understand your infrastructure.
Expand All @@ -20,7 +20,7 @@ or just to gain a deeper or more holistic understanding of your infrastructure.
- [The `terraform graph` command](/terraform/cli/commands/graph) creates a visual
representation of a configuration or a set of planned changes.
- [The `terraform output` command](/terraform/cli/commands/output) can get the
values for the top-level [output values](/terraform/language/values/outputs) of
values for the top-level [output values](/terraform/language/block/output) of
a configuration, which are often helpful when making use of the infrastructure
Terraform has provisioned.
- [The `terraform show` command](/terraform/cli/commands/show) can generate
Expand Down
18 changes: 9 additions & 9 deletions content/terraform/v1.12.x/docs/cli/test/index.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
page_title: Testing features in Terraform
page_title: Testing features in Terraform
description: >-
Learn about the terraform test command, which runs structured tests and validations for your configuration to ensure
correctness in your infrastructure.
Expand All @@ -13,14 +13,14 @@ This topic provides an overview of the testing features in Terraform to help you

Terraform provides the following types of testing capabilities:

1. Configuration and infrastructure validation as part of your regular Terraform operations. Refer to [Custom Conditions](/terraform/language/expressions/custom-conditions) and [Checks](/terraform/language/checks) to learn more about these types of testing capabilities.
1. Configuration and infrastructure validation as part of your regular Terraform operations. Refer to [Validate your configuration](/terraform/language/test-and-validate/validate) to learn more.
1. Traditional unit and integration testing on your configuration. Refer to the [`terraform test` command](/terraform/cli/commands/test) documentation to learn more about this testing capability.

### Additional testing and validation features
### Additional testing and validation features

- [Input Variable Validation](/terraform/language/expressions/custom-conditions#input-variable-validation)
- [Pre and Post-conditions](/terraform/language/expressions/custom-conditions#preconditions-and-postconditions)
- [Checks](/terraform/language/checks)
- [Input Variable Validation](/terraform/language/test-and-validate/validate#input-variable-validation)
- [Preconditions and postconditions](/terraform/language/test-and-validate/validate#preconditions-and-postconditions)
- [Checks](/terraform/language/block/check)

## How the `terraform test` command works

Expand All @@ -41,14 +41,14 @@ Terraform test files [have their own configuration syntax](/terraform/language/t

Validations allow you to verify aspects of your configuration and infrastructure as it is applied and created. HCP Terraform also supports automated [continuous validation](/terraform/cloud-docs/workspaces/health#continuous-validation).

The Terraform `test` command also executes any validations within your configuration as part of the tests it executes. For more information on the available validation, refer to [Checks](/terraform/language/checks) and [Custom Conditions](/terraform/language/expressions/custom-conditions).
The Terraform `test` command also executes any validations within your configuration as part of the tests it executes. Refer to [Validate your configuration](/terraform/language/test-and-validate/validate) to learn more.

## Tests versus validations

You can write many validations as test assertions, but there are specific use cases for both.

Validations are executed during Terraform plan and apply operations, and the Terraform `test` command also runs validations while executing tests. Therefore, use validations to validate aspects of your configuration that should always be true and could impact the valid execution of your infrastructure.
Terraform executes validations during plan and apply operations and when you run the `terraform test` command. Therefore, use validations to validate aspects of your configuration that should always be true and could impact the valid execution of your infrastructure.

Module authors should note that validations are executed and exposed to module users, so if they fail, ensure the failure messages are understandable and actionable.

In contrast, Terraform only executes tests when you run `terraform test`. Use tests to assert the correctness of any logical operations or specific behavior within your configuration. For example, you can test that Terraform creates conditional resources based on an input by setting the input controlling those resources to a certain value then verifying the resources Terraform creates.
By contrast, Terraform only executes tests when you run `terraform test`. Use tests to assert the correctness of any logical operations or specific behavior within your configuration. For example, you can test that Terraform creates conditional resources based on an input by setting the input controlling those resources to a certain value then verifying the resources Terraform creates.
2 changes: 1 addition & 1 deletion content/terraform/v1.12.x/docs/cli/workspaces/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Use the [`terraform workspace list`](/terraform/cli/commands/workspace/list), [`

Use [the `terraform workspace select` command](/terraform/cli/commands/workspace/select) to change the currently selected workspace. For a given working directory, you can only select one workspace at a time. Most Terraform commands only interact with the currently selected workspace. This includes [provisioning](/terraform/cli/run) and [state manipulation](/terraform/cli/state).

When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/terraform/language/values/variables) to differentiate each collection. For example, you might deploy test infrastructure to a different region.
When you provision infrastructure in each workspace, you usually need to manually specify different [input variables](/terraform/language/block/variable) to differentiate each collection. For example, you might deploy test infrastructure to a different region.


## Use Cases
Expand Down
Loading
Loading