From 208949ac6bc94f161f313d737cac8c2084e48d96 Mon Sep 17 00:00:00 2001 From: rkoron007 Date: Wed, 19 Mar 2025 16:43:04 -0700 Subject: [PATCH 01/12] Add the check block reference --- website/data/language-nav-data.json | 13 +- website/docs/language/block/check.mdx | 241 +++++++++++++++++++++++++ website/docs/language/checks/index.mdx | 121 ------------- 3 files changed, 253 insertions(+), 122 deletions(-) create mode 100644 website/docs/language/block/check.mdx delete mode 100644 website/docs/language/checks/index.mdx diff --git a/website/data/language-nav-data.json b/website/data/language-nav-data.json index 06b7b94b65a7..779d2d7c8d38 100644 --- a/website/data/language-nav-data.json +++ b/website/data/language-nav-data.json @@ -332,7 +332,7 @@ } ] }, - { "title": "Checks", "path": "checks" }, + { "title": "Import", "routes": [ @@ -1109,5 +1109,16 @@ "path": "v1-compatibility-promises" }, { "divider": true }, + { "heading": "REFERENCE" }, + { + "title": "Configuration blocks", + "routes": [ + { + "title": "check", + "path": "block/check" + } + ] + }, + { "divider": true }, { "title": "Terraform Internals", "href": "/internals" } ] diff --git a/website/docs/language/block/check.mdx b/website/docs/language/block/check.mdx new file mode 100644 index 000000000000..17881df0ee7a --- /dev/null +++ b/website/docs/language/block/check.mdx @@ -0,0 +1,241 @@ +--- +page_title: Check block reference +description: How to use the `check` block to validate infrastructure outside of the usual resource lifecycle. +--- + +# `check` block + +The `check` block validates infrastructure outside the plan and apply lifecycle, allowing ongoing verification of your infrastructure. + +The `check` block executes as the last step of plan or apply operations after Terraform has planned or provisioned your infrastructure. When a `check` block's assertion fails, Terraform reports a warning and continues executing the current operation. + +## Background + +Terraform evaluates `check` blocks locally whenever you plan or apply your configuration. In HCP Terraform, you can enable health checks on a workspace to automatically and continuously execute checks defined in that workspace's configuration. Refer to [Continuous validation](/terraform/cloud-docs/workspaces/health#continuous-validation) for details. + +The `check` block is one of the Terraform configuration language's validation rules. Other validation rules run during other stages of a Terraform operation, and can block operations if they fail. However, the `check` block is the only validation rule that does not block operations, instead Terraform produces a warning and lets that operation continue. For information on other validation rules, refer to [Validate your configuration](/terraform/language/expressions/custom-conditions). + + + +## Configuration model + +The `check` block supports the following arguments: + +- [`check "