diff --git a/.changes/unreleased/ENHANCEMENTS-20250115-084326.yaml b/.changes/unreleased/ENHANCEMENTS-20250115-084326.yaml deleted file mode 100644 index 90048c33474f..000000000000 --- a/.changes/unreleased/ENHANCEMENTS-20250115-084326.yaml +++ /dev/null @@ -1,5 +0,0 @@ -kind: ENHANCEMENTS -body: '`terraform test`: Add new `state_key` attribute for `run` blocks, allowing test authors control over which internal state file should be used for the current test run.' -time: 2025-01-15T08:43:26.581346+01:00 -custom: - Issue: "36185" diff --git a/website/docs/language/tests/index.mdx b/website/docs/language/tests/index.mdx index 06247570c374..95ba62cbe1e0 100644 --- a/website/docs/language/tests/index.mdx +++ b/website/docs/language/tests/index.mdx @@ -581,7 +581,7 @@ While Terraform executes a `terraform test` command, Terraform maintains at leas There is always at least one state file that maintains the state of the main configuration under test. This state file is shared by all `run` blocks that do not have a `module` block specifying an alternate module to load. By default, there is also one state file per alternate module that Terraform loads. An alternate module state file is shared by all `run` blocks that execute the given module. -You can override this default behavior with the `state_key` attribute and force Terraform to use a specific state file for a given `run` block. This is useful when you want to share state between `run` blocks that do not reference the same module. The default state key is the `module` block's `source` attribute, or the empty string (`""`) if no alternate module is specified. +You can override this default behavior with the `state_key` attribute and force Terraform to use a specific state file for a given `run` block. This is useful when you want to share state between `run` blocks that do not reference the same module. The following example uses comments to explain where the state files for each `run` block originate using the default behavior. In the below example Terraform creates and manages a total of three state files. The first state file is for the main configuration under test, the second for the setup module, and the third for the loader module.