From 0b057a35e96619a0e55ab485fbe656b44967f8f7 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Date: Mon, 26 Aug 2024 15:23:54 -0700 Subject: [PATCH 1/3] add initial proprosal for the write configuration ia --- website/data/language-nav-data.json | 2108 ++++++++++------- ...uration.mdx => configure-remote-state.mdx} | 12 +- website/docs/language/configure-terraform.mdx | 139 ++ .../index.mdx => data-sources.mdx} | 0 .../docs/language/dynamic-configuration.mdx | 16 + .../language/expressions/function-calls.mdx | 114 - .../language/{files/index.mdx => files.mdx} | 0 ...erating-configuration.mdx => generate.mdx} | 0 website/docs/language/index.mdx | 82 +- website/docs/language/{values => }/locals.mdx | 0 .../language/modules/{syntax.mdx => use.mdx} | 0 .../{develop => write}/composition.mdx | 0 .../modules/{develop => write}/index.mdx | 0 .../modules/{develop => write}/providers.mdx | 0 .../modules/{develop => write}/publish.mdx | 0 .../{develop => write}/refactoring.mdx | 0 .../modules/{develop => write}/structure.mdx | 0 .../{values/outputs.mdx => output.mdx} | 0 .../requirements.mdx => provider.mdx} | 23 +- website/docs/language/providers/index.mdx | 115 - .../syntax.mdx => provisioner.mdx} | 46 + website/docs/language/refactor.mdx | 9 + .../backend}/azurerm.mdx | 0 .../backends => reference/backend}/consul.mdx | 0 .../backends => reference/backend}/cos.mdx | 0 .../backends => reference/backend}/gcs.mdx | 0 .../backends => reference/backend}/http.mdx | 0 .../backend}/kubernetes.mdx | 0 .../backends => reference/backend}/local.mdx | 0 .../backends => reference/backend}/oss.mdx | 0 .../backends => reference/backend}/pg.mdx | 0 .../backends => reference/backend}/remote.mdx | 0 .../backends => reference/backend}/s3.mdx | 0 .../{checks/index.mdx => reference/check.mdx} | 0 .../{settings => reference}/cloud.mdx | 0 .../expressions/conditionals.mdx | 0 .../expressions/custom-conditions.mdx | 0 .../expressions/dynamic-blocks.mdx | 0 .../{ => reference}/expressions/for.mdx | 0 .../{ => reference}/expressions/index.mdx | 2 + .../{ => reference}/expressions/operators.mdx | 0 .../expressions/references.mdx | 0 .../{ => reference}/expressions/splat.mdx | 0 .../{ => reference}/expressions/strings.mdx | 0 .../expressions/type-constraints.mdx | 0 .../{ => reference}/expressions/types.mdx | 0 .../expressions/version-constraints.mdx | 0 .../file}/dependency-lock.mdx | 0 .../{files => reference/file}/override.mdx | 0 .../{files => reference/file}/tests.mdx | 0 .../{ => reference}/functions/abs.mdx | 0 .../{ => reference}/functions/abspath.mdx | 0 .../{ => reference}/functions/alltrue.mdx | 0 .../{ => reference}/functions/anytrue.mdx | 0 .../functions/base64decode.mdx | 0 .../functions/base64encode.mdx | 0 .../{ => reference}/functions/base64gzip.mdx | 0 .../functions/base64sha256.mdx | 0 .../functions/base64sha512.mdx | 0 .../{ => reference}/functions/basename.mdx | 0 .../{ => reference}/functions/bcrypt.mdx | 0 .../{ => reference}/functions/can.mdx | 0 .../{ => reference}/functions/ceil.mdx | 0 .../{ => reference}/functions/chomp.mdx | 0 .../{ => reference}/functions/chunklist.mdx | 0 .../{ => reference}/functions/cidrhost.mdx | 0 .../{ => reference}/functions/cidrnetmask.mdx | 0 .../{ => reference}/functions/cidrsubnet.mdx | 0 .../{ => reference}/functions/cidrsubnets.mdx | 0 .../{ => reference}/functions/coalesce.mdx | 0 .../functions/coalescelist.mdx | 0 .../{ => reference}/functions/compact.mdx | 0 .../{ => reference}/functions/concat.mdx | 0 .../{ => reference}/functions/contains.mdx | 0 .../{ => reference}/functions/csvdecode.mdx | 0 .../{ => reference}/functions/dirname.mdx | 0 .../{ => reference}/functions/distinct.mdx | 0 .../{ => reference}/functions/element.mdx | 0 .../{ => reference}/functions/endswith.mdx | 0 .../{ => reference}/functions/file.mdx | 0 .../{ => reference}/functions/filebase64.mdx | 0 .../functions/filebase64sha256.mdx | 0 .../functions/filebase64sha512.mdx | 0 .../{ => reference}/functions/fileexists.mdx | 0 .../{ => reference}/functions/filemd5.mdx | 0 .../{ => reference}/functions/fileset.mdx | 0 .../{ => reference}/functions/filesha1.mdx | 0 .../{ => reference}/functions/filesha256.mdx | 0 .../{ => reference}/functions/filesha512.mdx | 0 .../{ => reference}/functions/flatten.mdx | 0 .../{ => reference}/functions/floor.mdx | 0 .../{ => reference}/functions/format.mdx | 0 .../{ => reference}/functions/formatdate.mdx | 0 .../{ => reference}/functions/formatlist.mdx | 0 .../{ => reference}/functions/indent.mdx | 0 .../{ => reference}/functions/index.mdx | 0 .../functions/index_function.mdx | 0 .../{ => reference}/functions/issensitive.mdx | 0 .../{ => reference}/functions/join.mdx | 0 .../{ => reference}/functions/jsondecode.mdx | 0 .../{ => reference}/functions/jsonencode.mdx | 0 .../{ => reference}/functions/keys.mdx | 0 .../{ => reference}/functions/length.mdx | 0 .../{ => reference}/functions/list.mdx | 0 .../{ => reference}/functions/log.mdx | 0 .../{ => reference}/functions/lookup.mdx | 0 .../{ => reference}/functions/lower.mdx | 0 .../{ => reference}/functions/map.mdx | 0 .../{ => reference}/functions/matchkeys.mdx | 0 .../{ => reference}/functions/max.mdx | 0 .../{ => reference}/functions/md5.mdx | 0 .../{ => reference}/functions/merge.mdx | 0 .../{ => reference}/functions/min.mdx | 0 .../functions/nonsensitive.mdx | 0 .../{ => reference}/functions/one.mdx | 0 .../{ => reference}/functions/parseint.mdx | 0 .../{ => reference}/functions/pathexpand.mdx | 0 .../functions/plantimestamp.mdx | 0 .../{ => reference}/functions/pow.mdx | 0 .../{ => reference}/functions/range.mdx | 0 .../{ => reference}/functions/regex.mdx | 0 .../{ => reference}/functions/regexall.mdx | 0 .../{ => reference}/functions/replace.mdx | 0 .../{ => reference}/functions/reverse.mdx | 0 .../{ => reference}/functions/rsadecrypt.mdx | 0 .../{ => reference}/functions/sensitive.mdx | 0 .../functions/setintersection.mdx | 0 .../{ => reference}/functions/setproduct.mdx | 0 .../{ => reference}/functions/setsubtract.mdx | 0 .../{ => reference}/functions/setunion.mdx | 0 .../{ => reference}/functions/sha1.mdx | 0 .../{ => reference}/functions/sha256.mdx | 0 .../{ => reference}/functions/sha512.mdx | 0 .../{ => reference}/functions/signum.mdx | 0 .../{ => reference}/functions/slice.mdx | 0 .../{ => reference}/functions/sort.mdx | 0 .../{ => reference}/functions/split.mdx | 0 .../{ => reference}/functions/startswith.mdx | 0 .../{ => reference}/functions/strcontains.mdx | 0 .../{ => reference}/functions/strrev.mdx | 0 .../{ => reference}/functions/substr.mdx | 0 .../{ => reference}/functions/sum.mdx | 0 .../functions/templatefile.mdx | 0 .../functions/templatestring.mdx | 0 .../functions/terraform-decode_tfvars.mdx | 0 .../functions/terraform-encode_expr.mdx | 0 .../functions/terraform-encode_tfvars.mdx | 0 .../functions/textdecodebase64.mdx | 0 .../functions/textencodebase64.mdx | 0 .../{ => reference}/functions/timeadd.mdx | 0 .../{ => reference}/functions/timecmp.mdx | 0 .../{ => reference}/functions/timestamp.mdx | 0 .../{ => reference}/functions/title.mdx | 0 .../{ => reference}/functions/tobool.mdx | 0 .../{ => reference}/functions/tolist.mdx | 0 .../{ => reference}/functions/tomap.mdx | 0 .../{ => reference}/functions/tonumber.mdx | 0 .../{ => reference}/functions/toset.mdx | 0 .../{ => reference}/functions/tostring.mdx | 0 .../{ => reference}/functions/transpose.mdx | 0 .../{ => reference}/functions/trim.mdx | 0 .../{ => reference}/functions/trimprefix.mdx | 0 .../{ => reference}/functions/trimspace.mdx | 0 .../{ => reference}/functions/trimsuffix.mdx | 0 .../{ => reference}/functions/try.mdx | 0 .../{ => reference}/functions/type.mdx | 0 .../{ => reference}/functions/upper.mdx | 0 .../{ => reference}/functions/urlencode.mdx | 0 .../{ => reference}/functions/uuid.mdx | 0 .../{ => reference}/functions/uuidv5.mdx | 0 .../{ => reference}/functions/values.mdx | 0 .../{ => reference}/functions/yamldecode.mdx | 0 .../{ => reference}/functions/yamlencode.mdx | 0 .../{ => reference}/functions/zipmap.mdx | 0 .../{ => reference}/meta-arguments/count.mdx | 0 .../meta-arguments/depends_on.mdx | 0 .../meta-arguments/for_each.mdx | 0 .../meta-arguments/lifecycle.mdx | 0 .../meta-arguments/module-providers.mdx | 0 .../meta-arguments/resource-provider.mdx | 0 .../docs/language/reference/module/index.mdx | 221 ++ .../module/source.mdx} | 0 .../docs/language/{ => reference}/moved.mdx | 0 .../providers.mdx} | 0 .../provisioners/connection.mdx | 0 .../provisioners/file.mdx | 0 .../provisioners/local-exec.mdx | 0 .../provisioners/remote-exec.mdx | 0 .../remote-state-data.mdx | 0 .../syntax.mdx => reference/resource.mdx} | 0 .../terraform-data.mdx | 0 .../index.mdx => reference/terraform.mdx} | 0 .../{tests => reference/test}/index.mdx | 0 .../mocking.mdx => reference/test/mock.mdx} | 0 website/docs/language/resource.mdx | 236 ++ website/docs/language/resources/behavior.mdx | 111 - website/docs/language/resources/index.mdx | 36 - .../resources/provisioners/null_resource.mdx | 50 - .../language/share-data-configuration.mdx | 209 ++ website/docs/language/state/backends.mdx | 72 - website/docs/language/state/import.mdx | 13 - website/docs/language/state/index.mdx | 83 - website/docs/language/state/locking.mdx | 40 - website/docs/language/state/purpose.mdx | 109 - website/docs/language/state/remote.mdx | 63 - .../docs/language/state/sensitive-data.mdx | 38 - website/docs/language/syntax/index.mdx | 2 +- .../{configuration.mdx => terraform.mdx} | 9 +- website/docs/language/validate/check.mdx | 9 + website/docs/language/validate/index.mdx | 9 + website/docs/language/validate/test.mdx | 739 ++++++ website/docs/language/values/index.mdx | 20 - .../variables.mdx => variable/index.mdx} | 0 website/docs/language/variable/precedence.mdx | 40 + website/docs/language/variable/sensitive.mdx | 10 + .../language/version/dependency-lock-file.mdx | 9 + website/docs/language/version/index.mdx | 9 + website/docs/language/version/vcs.mdx | 9 + .../docs/language/{state => }/workspaces.mdx | 0 219 files changed, 3088 insertions(+), 1724 deletions(-) rename website/docs/language/{settings/backends/configuration.mdx => configure-remote-state.mdx} (96%) create mode 100644 website/docs/language/configure-terraform.mdx rename website/docs/language/{data-sources/index.mdx => data-sources.mdx} (100%) create mode 100644 website/docs/language/dynamic-configuration.mdx delete mode 100644 website/docs/language/expressions/function-calls.mdx rename website/docs/language/{files/index.mdx => files.mdx} (100%) rename website/docs/language/import/{generating-configuration.mdx => generate.mdx} (100%) rename website/docs/language/{values => }/locals.mdx (100%) rename website/docs/language/modules/{syntax.mdx => use.mdx} (100%) rename website/docs/language/modules/{develop => write}/composition.mdx (100%) rename website/docs/language/modules/{develop => write}/index.mdx (100%) rename website/docs/language/modules/{develop => write}/providers.mdx (100%) rename website/docs/language/modules/{develop => write}/publish.mdx (100%) rename website/docs/language/modules/{develop => write}/refactoring.mdx (100%) rename website/docs/language/modules/{develop => write}/structure.mdx (100%) rename website/docs/language/{values/outputs.mdx => output.mdx} (100%) rename website/docs/language/{providers/requirements.mdx => provider.mdx} (93%) delete mode 100644 website/docs/language/providers/index.mdx rename website/docs/language/{resources/provisioners/syntax.mdx => provisioner.mdx} (90%) create mode 100644 website/docs/language/refactor.mdx rename website/docs/language/{settings/backends => reference/backend}/azurerm.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/consul.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/cos.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/gcs.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/http.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/kubernetes.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/local.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/oss.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/pg.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/remote.mdx (100%) rename website/docs/language/{settings/backends => reference/backend}/s3.mdx (100%) rename website/docs/language/{checks/index.mdx => reference/check.mdx} (100%) rename website/docs/language/{settings => reference}/cloud.mdx (100%) rename website/docs/language/{ => reference}/expressions/conditionals.mdx (100%) rename website/docs/language/{ => reference}/expressions/custom-conditions.mdx (100%) rename website/docs/language/{ => reference}/expressions/dynamic-blocks.mdx (100%) rename website/docs/language/{ => reference}/expressions/for.mdx (100%) rename website/docs/language/{ => reference}/expressions/index.mdx (93%) rename website/docs/language/{ => reference}/expressions/operators.mdx (100%) rename website/docs/language/{ => reference}/expressions/references.mdx (100%) rename website/docs/language/{ => reference}/expressions/splat.mdx (100%) rename website/docs/language/{ => reference}/expressions/strings.mdx (100%) rename website/docs/language/{ => reference}/expressions/type-constraints.mdx (100%) rename website/docs/language/{ => reference}/expressions/types.mdx (100%) rename website/docs/language/{ => reference}/expressions/version-constraints.mdx (100%) rename website/docs/language/{files => reference/file}/dependency-lock.mdx (100%) rename website/docs/language/{files => reference/file}/override.mdx (100%) rename website/docs/language/{files => reference/file}/tests.mdx (100%) rename website/docs/language/{ => reference}/functions/abs.mdx (100%) rename website/docs/language/{ => reference}/functions/abspath.mdx (100%) rename website/docs/language/{ => reference}/functions/alltrue.mdx (100%) rename website/docs/language/{ => reference}/functions/anytrue.mdx (100%) rename website/docs/language/{ => reference}/functions/base64decode.mdx (100%) rename website/docs/language/{ => reference}/functions/base64encode.mdx (100%) rename website/docs/language/{ => reference}/functions/base64gzip.mdx (100%) rename website/docs/language/{ => reference}/functions/base64sha256.mdx (100%) rename website/docs/language/{ => reference}/functions/base64sha512.mdx (100%) rename website/docs/language/{ => reference}/functions/basename.mdx (100%) rename website/docs/language/{ => reference}/functions/bcrypt.mdx (100%) rename website/docs/language/{ => reference}/functions/can.mdx (100%) rename website/docs/language/{ => reference}/functions/ceil.mdx (100%) rename website/docs/language/{ => reference}/functions/chomp.mdx (100%) rename website/docs/language/{ => reference}/functions/chunklist.mdx (100%) rename website/docs/language/{ => reference}/functions/cidrhost.mdx (100%) rename website/docs/language/{ => reference}/functions/cidrnetmask.mdx (100%) rename website/docs/language/{ => reference}/functions/cidrsubnet.mdx (100%) rename website/docs/language/{ => reference}/functions/cidrsubnets.mdx (100%) rename website/docs/language/{ => reference}/functions/coalesce.mdx (100%) rename website/docs/language/{ => reference}/functions/coalescelist.mdx (100%) rename website/docs/language/{ => reference}/functions/compact.mdx (100%) rename website/docs/language/{ => reference}/functions/concat.mdx (100%) rename website/docs/language/{ => reference}/functions/contains.mdx (100%) rename website/docs/language/{ => reference}/functions/csvdecode.mdx (100%) rename website/docs/language/{ => reference}/functions/dirname.mdx (100%) rename website/docs/language/{ => reference}/functions/distinct.mdx (100%) rename website/docs/language/{ => reference}/functions/element.mdx (100%) rename website/docs/language/{ => reference}/functions/endswith.mdx (100%) rename website/docs/language/{ => reference}/functions/file.mdx (100%) rename website/docs/language/{ => reference}/functions/filebase64.mdx (100%) rename website/docs/language/{ => reference}/functions/filebase64sha256.mdx (100%) rename website/docs/language/{ => reference}/functions/filebase64sha512.mdx (100%) rename website/docs/language/{ => reference}/functions/fileexists.mdx (100%) rename website/docs/language/{ => reference}/functions/filemd5.mdx (100%) rename website/docs/language/{ => reference}/functions/fileset.mdx (100%) rename website/docs/language/{ => reference}/functions/filesha1.mdx (100%) rename website/docs/language/{ => reference}/functions/filesha256.mdx (100%) rename website/docs/language/{ => reference}/functions/filesha512.mdx (100%) rename website/docs/language/{ => reference}/functions/flatten.mdx (100%) rename website/docs/language/{ => reference}/functions/floor.mdx (100%) rename website/docs/language/{ => reference}/functions/format.mdx (100%) rename website/docs/language/{ => reference}/functions/formatdate.mdx (100%) rename website/docs/language/{ => reference}/functions/formatlist.mdx (100%) rename website/docs/language/{ => reference}/functions/indent.mdx (100%) rename website/docs/language/{ => reference}/functions/index.mdx (100%) rename website/docs/language/{ => reference}/functions/index_function.mdx (100%) rename website/docs/language/{ => reference}/functions/issensitive.mdx (100%) rename website/docs/language/{ => reference}/functions/join.mdx (100%) rename website/docs/language/{ => reference}/functions/jsondecode.mdx (100%) rename website/docs/language/{ => reference}/functions/jsonencode.mdx (100%) rename website/docs/language/{ => reference}/functions/keys.mdx (100%) rename website/docs/language/{ => reference}/functions/length.mdx (100%) rename website/docs/language/{ => reference}/functions/list.mdx (100%) rename website/docs/language/{ => reference}/functions/log.mdx (100%) rename website/docs/language/{ => reference}/functions/lookup.mdx (100%) rename website/docs/language/{ => reference}/functions/lower.mdx (100%) rename website/docs/language/{ => reference}/functions/map.mdx (100%) rename website/docs/language/{ => reference}/functions/matchkeys.mdx (100%) rename website/docs/language/{ => reference}/functions/max.mdx (100%) rename website/docs/language/{ => reference}/functions/md5.mdx (100%) rename website/docs/language/{ => reference}/functions/merge.mdx (100%) rename website/docs/language/{ => reference}/functions/min.mdx (100%) rename website/docs/language/{ => reference}/functions/nonsensitive.mdx (100%) rename website/docs/language/{ => reference}/functions/one.mdx (100%) rename website/docs/language/{ => reference}/functions/parseint.mdx (100%) rename website/docs/language/{ => reference}/functions/pathexpand.mdx (100%) rename website/docs/language/{ => reference}/functions/plantimestamp.mdx (100%) rename website/docs/language/{ => reference}/functions/pow.mdx (100%) rename website/docs/language/{ => reference}/functions/range.mdx (100%) rename website/docs/language/{ => reference}/functions/regex.mdx (100%) rename website/docs/language/{ => reference}/functions/regexall.mdx (100%) rename website/docs/language/{ => reference}/functions/replace.mdx (100%) rename website/docs/language/{ => reference}/functions/reverse.mdx (100%) rename website/docs/language/{ => reference}/functions/rsadecrypt.mdx (100%) rename website/docs/language/{ => reference}/functions/sensitive.mdx (100%) rename website/docs/language/{ => reference}/functions/setintersection.mdx (100%) rename website/docs/language/{ => reference}/functions/setproduct.mdx (100%) rename website/docs/language/{ => reference}/functions/setsubtract.mdx (100%) rename website/docs/language/{ => reference}/functions/setunion.mdx (100%) rename website/docs/language/{ => reference}/functions/sha1.mdx (100%) rename website/docs/language/{ => reference}/functions/sha256.mdx (100%) rename website/docs/language/{ => reference}/functions/sha512.mdx (100%) rename website/docs/language/{ => reference}/functions/signum.mdx (100%) rename website/docs/language/{ => reference}/functions/slice.mdx (100%) rename website/docs/language/{ => reference}/functions/sort.mdx (100%) rename website/docs/language/{ => reference}/functions/split.mdx (100%) rename website/docs/language/{ => reference}/functions/startswith.mdx (100%) rename website/docs/language/{ => reference}/functions/strcontains.mdx (100%) rename website/docs/language/{ => reference}/functions/strrev.mdx (100%) rename website/docs/language/{ => reference}/functions/substr.mdx (100%) rename website/docs/language/{ => reference}/functions/sum.mdx (100%) rename website/docs/language/{ => reference}/functions/templatefile.mdx (100%) rename website/docs/language/{ => reference}/functions/templatestring.mdx (100%) rename website/docs/language/{ => reference}/functions/terraform-decode_tfvars.mdx (100%) rename website/docs/language/{ => reference}/functions/terraform-encode_expr.mdx (100%) rename website/docs/language/{ => reference}/functions/terraform-encode_tfvars.mdx (100%) rename website/docs/language/{ => reference}/functions/textdecodebase64.mdx (100%) rename website/docs/language/{ => reference}/functions/textencodebase64.mdx (100%) rename website/docs/language/{ => reference}/functions/timeadd.mdx (100%) rename website/docs/language/{ => reference}/functions/timecmp.mdx (100%) rename website/docs/language/{ => reference}/functions/timestamp.mdx (100%) rename website/docs/language/{ => reference}/functions/title.mdx (100%) rename website/docs/language/{ => reference}/functions/tobool.mdx (100%) rename website/docs/language/{ => reference}/functions/tolist.mdx (100%) rename website/docs/language/{ => reference}/functions/tomap.mdx (100%) rename website/docs/language/{ => reference}/functions/tonumber.mdx (100%) rename website/docs/language/{ => reference}/functions/toset.mdx (100%) rename website/docs/language/{ => reference}/functions/tostring.mdx (100%) rename website/docs/language/{ => reference}/functions/transpose.mdx (100%) rename website/docs/language/{ => reference}/functions/trim.mdx (100%) rename website/docs/language/{ => reference}/functions/trimprefix.mdx (100%) rename website/docs/language/{ => reference}/functions/trimspace.mdx (100%) rename website/docs/language/{ => reference}/functions/trimsuffix.mdx (100%) rename website/docs/language/{ => reference}/functions/try.mdx (100%) rename website/docs/language/{ => reference}/functions/type.mdx (100%) rename website/docs/language/{ => reference}/functions/upper.mdx (100%) rename website/docs/language/{ => reference}/functions/urlencode.mdx (100%) rename website/docs/language/{ => reference}/functions/uuid.mdx (100%) rename website/docs/language/{ => reference}/functions/uuidv5.mdx (100%) rename website/docs/language/{ => reference}/functions/values.mdx (100%) rename website/docs/language/{ => reference}/functions/yamldecode.mdx (100%) rename website/docs/language/{ => reference}/functions/yamlencode.mdx (100%) rename website/docs/language/{ => reference}/functions/zipmap.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/count.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/depends_on.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/for_each.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/lifecycle.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/module-providers.mdx (100%) rename website/docs/language/{ => reference}/meta-arguments/resource-provider.mdx (100%) create mode 100644 website/docs/language/reference/module/index.mdx rename website/docs/language/{modules/sources.mdx => reference/module/source.mdx} (100%) rename website/docs/language/{ => reference}/moved.mdx (100%) rename website/docs/language/{providers/configuration.mdx => reference/providers.mdx} (100%) rename website/docs/language/{resources => reference}/provisioners/connection.mdx (100%) rename website/docs/language/{resources => reference}/provisioners/file.mdx (100%) rename website/docs/language/{resources => reference}/provisioners/local-exec.mdx (100%) rename website/docs/language/{resources => reference}/provisioners/remote-exec.mdx (100%) rename website/docs/language/{state => reference}/remote-state-data.mdx (100%) rename website/docs/language/{resources/syntax.mdx => reference/resource.mdx} (100%) rename website/docs/language/{resources => reference}/terraform-data.mdx (100%) rename website/docs/language/{settings/index.mdx => reference/terraform.mdx} (100%) rename website/docs/language/{tests => reference/test}/index.mdx (100%) rename website/docs/language/{tests/mocking.mdx => reference/test/mock.mdx} (100%) create mode 100644 website/docs/language/resource.mdx delete mode 100644 website/docs/language/resources/behavior.mdx delete mode 100644 website/docs/language/resources/index.mdx delete mode 100644 website/docs/language/resources/provisioners/null_resource.mdx create mode 100644 website/docs/language/share-data-configuration.mdx delete mode 100644 website/docs/language/state/backends.mdx delete mode 100644 website/docs/language/state/import.mdx delete mode 100644 website/docs/language/state/index.mdx delete mode 100644 website/docs/language/state/locking.mdx delete mode 100644 website/docs/language/state/purpose.mdx delete mode 100644 website/docs/language/state/remote.mdx delete mode 100644 website/docs/language/state/sensitive-data.mdx rename website/docs/language/syntax/{configuration.mdx => terraform.mdx} (96%) create mode 100644 website/docs/language/validate/check.mdx create mode 100644 website/docs/language/validate/index.mdx create mode 100644 website/docs/language/validate/test.mdx delete mode 100644 website/docs/language/values/index.mdx rename website/docs/language/{values/variables.mdx => variable/index.mdx} (100%) create mode 100644 website/docs/language/variable/precedence.mdx create mode 100644 website/docs/language/variable/sensitive.mdx create mode 100644 website/docs/language/version/dependency-lock-file.mdx create mode 100644 website/docs/language/version/index.mdx create mode 100644 website/docs/language/version/vcs.mdx rename website/docs/language/{state => }/workspaces.mdx (100%) diff --git a/website/data/language-nav-data.json b/website/data/language-nav-data.json index cf4ae9b5195e..9118b3fd2f69 100644 --- a/website/data/language-nav-data.json +++ b/website/data/language-nav-data.json @@ -1,1114 +1,1612 @@ [ - { "heading": "Terraform Language" }, - { "title": "Overview", "path": "" }, { - "title": "Attributes as Blocks - Configuration Language", - "path": "attr-as-blocks", - "hidden": true + "heading": "Terraform Language" }, - { - "title": "Style Guide", - "path": "style" + { + "title": "Overview", + "path": "" }, { - "title": "Files and Directories", + "title": "Syntax", "routes": [ - { "title": "Overview", "path": "files" }, - { "title": "Override Files", "path": "files/override" }, - { "title": "Dependency Lock File", "path": "files/dependency-lock" }, - { "title": "Test Files", "path": "files/tests" } + { + "title": "Overview", + "path": "syntax" + }, + { + "title": "Terraform syntax", + "path": "syntax/terraform" + }, + { + "title": "JSON Syntax", + "path": "syntax/json" + } ] }, { - "title": "Syntax", + "title": "File structure", + "path": "files" + }, + { + "title": "Style guide", + "path": "style" + }, + { + "heading": "Fundamentals" + }, + { + "title": "Define resources", + "path": "resource" + }, + { + "title": "Define data sources", + "path": "data-sources" + }, + { + "title": "Define providers", + "path": "provider" + }, + { + "title": "Define variables", "routes": [ - { "title": "Overview", "path": "syntax" }, { - "title": "Configuration Syntax", - "path": "syntax/configuration" + "title": "Overview", + "path": "variable" }, { - "title": "JSON Configuration Syntax", - "path": "syntax/json" + "title": "Variable precedence", + "path": "variable/precedence" + }, + { + "title": "Sensitive data", + "path": "variable/sensitive" } ] }, { - "title": "Resources", + "title": "Define locals", + "path": "locals" + }, + { + "title": "Define outputs", + "path": "output" + }, + { + "title": "Define and write modules", "routes": [ - { "title": "Overview", "path": "resources" }, - { "title": "Resource Blocks", "path": "resources/syntax" }, { - "title": "Resource Behavior", - "path": "resources/behavior" + "title": "Overview", + "path": "modules" }, { - "title": "Meta-Arguments", - "routes": [ - { - "title": "depends_on", - "href": "/language/meta-arguments/depends_on" - }, - { - "title": "count", - "href": "/language/meta-arguments/count" - }, - { - "title": "for_each", - "href": "/language/meta-arguments/for_each" - }, - { - "title": "provider", - "href": "/language/meta-arguments/resource-provider" - }, - { - "title": "lifecycle", - "href": "/language/meta-arguments/lifecycle" - } - ] + "title": "Use modules", + "path": "modules/use" }, { - "title": "Provisioners", + "title": "Write modules", "routes": [ { - "title": "Declaring Provisioners", - "path": "resources/provisioners/syntax" + "title": "Overview", + "path": "modules/write" }, { - "title": "Provisioner Connections", - "path": "resources/provisioners/connection" + "title": "Standard module structure", + "path": "modules/write/structure" }, { - "title": "Provisioners Without a Resource", - "path": "resources/provisioners/null_resource" + "title": "Providers within modules", + "path": "modules/write/providers" }, { - "title": "file", - "path": "resources/provisioners/file" + "title": "Best Practices: Module composition", + "path": "modules/write/composition" }, { - "title": "local-exec", - "path": "resources/provisioners/local-exec" + "title": "Publish modules", + "path": "modules/write/publish" }, { - "title": "remote-exec", - "path": "resources/provisioners/remote-exec" + "title": "Refactor modules", + "path": "modules/write/refactoring" } ] - }, - { - "title": "The terraform_data Resource Type", - "path": "resources/terraform-data" } ] }, - { "title": "Data Sources", "path": "data-sources" }, { - "title": "Meta-Arguments", - "hidden": true, + "heading": "Advanced" + }, + { + "title": "Configure remote state", + "path": "configure-remote-state" + }, + { + "title": "Version configuration", "routes": [ { - "title": "count", - "path": "meta-arguments/count" - }, - { - "title": "depends_on", - "path": "meta-arguments/depends_on" + "title": "Overview", + "path": "version" }, { - "title": "for_each", - "path": "meta-arguments/for_each" + "title": "Dependency lock file", + "path": "version/dependency-lock-file" }, { - "title": "lifecycle", - "path": "meta-arguments/lifecycle" - }, + "title": "Version source control (VCS)", + "path": "version/vcs" + } + ] + }, + { + "title": "Write dynamic configuration", + "path": "dynamic-configuration" + }, + { + "title": "Import existing resources", + "routes": [ { - "title": "providers", - "path": "meta-arguments/module-providers" + "title": "Overview", + "path": "import" }, { - "title": "provider", - "path": "meta-arguments/resource-provider" + "title": "Generate configuration", + "path": "import/generate" } ] }, - { - "title": "Providers", + "title": "Refactor configuration", + "path": "refactor" + }, + { + "title": "Share data between configurations", + "path": "share-data-configuration" + }, + { + "title": "Validate configuration", "routes": [ - { "title": "Overview", "path": "providers" }, { - "title": "Provider Configuration", - "path": "providers/configuration" + "title": "Overview", + "path": "validate" }, { - "title": "Provider Requirements", - "path": "providers/requirements" + "title": "Checks", + "path": "validate/check" }, { - "title": "Dependency Lock File", - "href": "/language/files/dependency-lock" + "title": "Test", + "path": "validate/test" } ] }, { - "title": "Variables and Outputs", - "routes": [ - { "title": "Overview", "path": "values" }, - { "title": "Input Variables", "path": "values/variables" }, - { "title": "Output Values", "path": "values/outputs" }, - { "title": "Local Values", "path": "values/locals" } - ] + "title": "Configure Terraform settings", + "path": "configure-terraform" + }, + { + "title": "Define workspaces", + "path": "workspaces" + }, + { + "title": "Define provisioners", + "path": "provisioner" + }, + { + "divider": true + }, + { + "title": "Upgrade to Terraform v1.9", + "path": "upgrade-guides" + }, + { + "title": "v1.x compatibility promises", + "path": "v1-compatibility-promises" }, { - "title": "Modules", + "divider": true + }, + { + "title": "Reference", "routes": [ - { "title": "Overview", "path": "modules" }, - - { "title": "Module Blocks", "path": "modules/syntax" }, - { "title": "Module Sources", "path": "modules/sources" }, { - "title": "Meta-Arguments", + "title": "Resource block", + "path": "reference/resource" + }, + { + "title": "terraform_data Resource Type", + "path": "reference/terraform-data" + }, + { + "title": "Provider block", + "path": "reference/providers" + }, + { + "title": "Module block", + "routes": [ + { + "title": "Module block", + "path": "reference/module" + }, + { + "title": "Module Sources", + "path": "reference/module/source" + } + ] + }, + { + "title": "Moved block", + "path": "reference/moved" + }, + { + "title": "Check block", + "path": "reference/check" + }, + { + "title": "Terraform block", + "path": "reference/terraform" + }, + { + "title": "cloud block", + "path": "reference/cloud" + }, + { + "title": "backend block", "routes": [ { - "title": "providers", - "href": "/language/meta-arguments/module-providers" + "title": "local", + "path": "reference/backend/local" + }, + { + "title": "remote", + "path": "reference/backend/remote" + }, + { + "title": "azurerm", + "path": "reference/backend/azurerm" + }, + { + "title": "consul", + "path": "reference/backend/consul" + }, + { + "title": "cos", + "path": "reference/backend/cos" + }, + { + "title": "gcs", + "path": "reference/backend/gcs" + }, + { + "title": "http", + "path": "reference/backend/http" + }, + { + "title": "Kubernetes", + "path": "reference/backend/kubernetes" + }, + { + "title": "oss", + "path": "reference/backend/oss" + }, + { + "title": "pg", + "path": "reference/backend/pg" + }, + { + "title": "s3", + "path": "reference/backend/s3" + } + ] + }, + { + "title": "terraform_remote_state data source", + "path": "reference/remote-state-data" + }, + { + "title": "Tests", + "routes": [ + { + "title": "run block", + "path": "reference/test" + }, + { + "title": "mock block", + "path": "reference/test/mock" + } + ] + }, + { + "title": "Files", + "routes": [ + { + "title": "Override Files", + "path": "reference/file/override" + }, + { + "title": "Dependency Lock File", + "path": "reference/file/dependency-lock" + }, + { + "title": "Test Files", + "path": "reference/file/tests" + } + ] + }, + { + "title": "Expressions", + "routes": [ + { + "title": "Overview", + "path": "reference/expressions" + }, + { + "title": "Types and Values", + "path": "reference/expressions/types" + }, + { + "title": "Strings and Templates", + "path": "reference/expressions/strings" + }, + { + "title": "References to Values", + "path": "reference/expressions/references" + }, + { + "title": "Operators", + "path": "reference/expressions/operators" + }, + { + "title": "Conditional Expressions", + "path": "reference/expressions/conditionals" + }, + { + "title": "For Expressions", + "path": "reference/expressions/for" + }, + { + "title": "Splat Expressions", + "path": "reference/expressions/splat" + }, + { + "title": "Dynamic Blocks", + "path": "reference/expressions/dynamic-blocks" + }, + { + "title": "Custom Conditions", + "path": "reference/expressions/custom-conditions" + }, + { + "title": "Type Constraints", + "path": "reference/expressions/type-constraints" + }, + { + "title": "Version Constraints", + "path": "reference/expressions/version-constraints" + } + ] + }, + { + "title": "Functions", + "routes": [ + { + "title": "Overview", + "path": "reference/functions" + }, + { + "title": "Numeric Functions", + "routes": [ + { + "title": "abs", + "href": "/language/functions/abs" + }, + { + "title": "ceil", + "href": "/language/functions/ceil" + }, + { + "title": "floor", + "href": "/language/functions/floor" + }, + { + "title": "log", + "href": "/language/functions/log" + }, + { + "title": "max", + "href": "/language/functions/max" + }, + { + "title": "min", + "href": "/language/functions/min" + }, + { + "title": "parseint", + "href": "/language/functions/parseint" + }, + { + "title": "pow", + "href": "/language/functions/pow" + }, + { + "title": "signum", + "href": "/language/functions/signum" + } + ] + }, + { + "title": "String Functions", + "routes": [ + { + "title": "chomp", + "href": "/language/functions/chomp" + }, + { + "title": "endswith", + "href": "/language/functions/endswith" + }, + { + "title": "format", + "href": "/language/functions/format" + }, + { + "title": "formatlist", + "href": "/language/functions/formatlist" + }, + { + "title": "indent", + "href": "/language/functions/indent" + }, + { + "title": "join", + "href": "/language/functions/join" + }, + { + "title": "lower", + "href": "/language/functions/lower" + }, + { + "title": "regex", + "href": "/language/functions/regex" + }, + { + "title": "regexall", + "href": "/language/functions/regexall" + }, + { + "title": "replace", + "href": "/language/functions/replace" + }, + { + "title": "split", + "href": "/language/functions/split" + }, + { + "title": "startswith", + "href": "/language/functions/startswith" + }, + { + "title": "strcontains", + "href": "/language/functions/strcontains" + }, + { + "title": "strrev", + "href": "/language/functions/strrev" + }, + { + "title": "substr", + "href": "/language/functions/substr" + }, + { + "title": "templatestring", + "href": "/language/functions/templatestring" + }, + { + "title": "title", + "href": "/language/functions/title" + }, + { + "title": "trim", + "href": "/language/functions/trim" + }, + { + "title": "trimprefix", + "href": "/language/functions/trimprefix" + }, + { + "title": "trimsuffix", + "href": "/language/functions/trimsuffix" + }, + { + "title": "trimspace", + "href": "/language/functions/trimspace" + }, + { + "title": "upper", + "href": "/language/functions/upper" + } + ] + }, + { + "title": "Collection Functions", + "routes": [ + { + "title": "alltrue", + "href": "/language/functions/alltrue" + }, + { + "title": "anytrue", + "href": "/language/functions/anytrue" + }, + { + "title": "chunklist", + "href": "/language/functions/chunklist" + }, + { + "title": "coalesce", + "href": "/language/functions/coalesce" + }, + { + "title": "coalescelist", + "href": "/language/functions/coalescelist" + }, + { + "title": "compact", + "href": "/language/functions/compact" + }, + { + "title": "concat", + "href": "/language/functions/concat" + }, + { + "title": "contains", + "href": "/language/functions/contains" + }, + { + "title": "distinct", + "href": "/language/functions/distinct" + }, + { + "title": "element", + "href": "/language/functions/element" + }, + { + "title": "flatten", + "href": "/language/functions/flatten" + }, + { + "title": "index", + "href": "/language/functions/index_function" + }, + { + "title": "keys", + "href": "/language/functions/keys" + }, + { + "title": "length", + "href": "/language/functions/length" + }, + { + "title": "list", + "href": "/language/functions/list" + }, + { + "title": "lookup", + "href": "/language/functions/lookup" + }, + { + "title": "map", + "href": "/language/functions/map" + }, + { + "title": "matchkeys", + "href": "/language/functions/matchkeys" + }, + { + "title": "merge", + "href": "/language/functions/merge" + }, + { + "title": "one", + "href": "/language/functions/one" + }, + { + "title": "range", + "href": "/language/functions/range" + }, + { + "title": "reverse", + "href": "/language/functions/reverse" + }, + { + "title": "setintersection", + "href": "/language/functions/setintersection" + }, + { + "title": "setproduct", + "href": "/language/functions/setproduct" + }, + { + "title": "setsubtract", + "href": "/language/functions/setsubtract" + }, + { + "title": "setunion", + "href": "/language/functions/setunion" + }, + { + "title": "slice", + "href": "/language/functions/slice" + }, + { + "title": "sort", + "href": "/language/functions/sort" + }, + { + "title": "sum", + "href": "/language/functions/sum" + }, + { + "title": "transpose", + "href": "/language/functions/transpose" + }, + { + "title": "values", + "href": "/language/functions/values" + }, + { + "title": "zipmap", + "href": "/language/functions/zipmap" + } + ] + }, + { + "title": "Encoding Functions", + "routes": [ + { + "title": "base64decode", + "href": "/language/functions/base64decode" + }, + { + "title": "base64encode", + "href": "/language/functions/base64encode" + }, + { + "title": "base64gzip", + "href": "/language/functions/base64gzip" + }, + { + "title": "csvdecode", + "href": "/language/functions/csvdecode" + }, + { + "title": "jsondecode", + "href": "/language/functions/jsondecode" + }, + { + "title": "jsonencode", + "href": "/language/functions/jsonencode" + }, + { + "title": "textdecodebase64", + "href": "/language/functions/textdecodebase64" + }, + { + "title": "textencodebase64", + "href": "/language/functions/textencodebase64" + }, + { + "title": "urlencode", + "href": "/language/functions/urlencode" + }, + { + "title": "yamldecode", + "href": "/language/functions/yamldecode" + }, + { + "title": "yamlencode", + "href": "/language/functions/yamlencode" + } + ] + }, + { + "title": "Filesystem Functions", + "routes": [ + { + "title": "abspath", + "href": "/language/functions/abspath" + }, + { + "title": "dirname", + "href": "/language/functions/dirname" + }, + { + "title": "pathexpand", + "href": "/language/functions/pathexpand" + }, + { + "title": "basename", + "href": "/language/functions/basename" + }, + { + "title": "file", + "href": "/language/functions/file" + }, + { + "title": "fileexists", + "href": "/language/functions/fileexists" + }, + { + "title": "fileset", + "href": "/language/functions/fileset" + }, + { + "title": "filebase64", + "href": "/language/functions/filebase64" + }, + { + "title": "templatefile", + "href": "/language/functions/templatefile" + } + ] + }, + { + "title": "Date and Time Functions", + "routes": [ + { + "title": "formatdate", + "href": "/language/functions/formatdate" + }, + { + "title": "plantimestamp", + "href": "/language/functions/plantimestamp" + }, + { + "title": "timeadd", + "href": "/language/functions/timeadd" + }, + { + "title": "timecmp", + "href": "/language/functions/timecmp" + }, + { + "title": "timestamp", + "href": "/language/functions/timestamp" + } + ] + }, + { + "title": "Hash and Crypto Functions", + "routes": [ + { + "title": "base64sha256", + "href": "/language/functions/base64sha256" + }, + { + "title": "base64sha512", + "href": "/language/functions/base64sha512" + }, + { + "title": "bcrypt", + "href": "/language/functions/bcrypt" + }, + { + "title": "filebase64sha256", + "href": "/language/functions/filebase64sha256" + }, + { + "title": "filebase64sha512", + "href": "/language/functions/filebase64sha512" + }, + { + "title": "filemd5", + "href": "/language/functions/filemd5" + }, + { + "title": "filesha1", + "href": "/language/functions/filesha1" + }, + { + "title": "filesha256", + "href": "/language/functions/filesha256" + }, + { + "title": "filesha512", + "href": "/language/functions/filesha512" + }, + { + "title": "md5", + "href": "/language/functions/md5" + }, + { + "title": "rsadecrypt", + "href": "/language/functions/rsadecrypt" + }, + { + "title": "sha1", + "href": "/language/functions/sha1" + }, + { + "title": "sha256", + "href": "/language/functions/sha256" + }, + { + "title": "sha512", + "href": "/language/functions/sha512" + }, + { + "title": "uuid", + "href": "/language/functions/uuid" + }, + { + "title": "uuidv5", + "href": "/language/functions/uuidv5" + } + ] + }, + { + "title": "IP Network Functions", + "routes": [ + { + "title": "cidrhost", + "href": "/language/functions/cidrhost" + }, + { + "title": "cidrnetmask", + "href": "/language/functions/cidrnetmask" + }, + { + "title": "cidrsubnet", + "href": "/language/functions/cidrsubnet" + }, + { + "title": "cidrsubnets", + "href": "/language/functions/cidrsubnets" + } + ] + }, + { + "title": "Type Conversion Functions", + "routes": [ + { + "title": "can", + "href": "/language/functions/can" + }, + { + "title": "issensitive", + "href": "/language/functions/issensitive" + }, + { + "title": "nonsensitive", + "href": "/language/functions/nonsensitive" + }, + { + "title": "sensitive", + "href": "/language/functions/sensitive" + }, + { + "title": "tobool", + "href": "/language/functions/tobool" + }, + { + "title": "tolist", + "href": "/language/functions/tolist" + }, + { + "title": "tomap", + "href": "/language/functions/tomap" + }, + { + "title": "tonumber", + "href": "/language/functions/tonumber" + }, + { + "title": "toset", + "href": "/language/functions/toset" + }, + { + "title": "tostring", + "href": "/language/functions/tostring" + }, + { + "title": "try", + "href": "/language/functions/try" + }, + { + "title": "type", + "href": "/language/functions/type" + } + ] + }, + { + "title": "Terraform-specific Functions", + "routes": [ + { + "title": "provider::terraform::encode_tfvars", + "href": "/language/functions/terraform-encode_tfvars" + }, + { + "title": "provider::terraform::decode_tfvars", + "href": "/language/functions/terraform-decode_tfvars" + }, + { + "title": "provider::terraform::encode_expr", + "href": "/language/functions/terraform-encode_expr" + } + ] }, { - "title": "depends_on", - "href": "/language/meta-arguments/depends_on" + "title": "abs", + "path": "reference/functions/abs", + "hidden": true }, { - "title": "count", - "href": "/language/meta-arguments/count" + "title": "abspath", + "path": "reference/functions/abspath", + "hidden": true }, { - "title": "for_each", - "href": "/language/meta-arguments/for_each" - } - ] - }, - { - "title": "Module Development", - "routes": [ - { "title": "Overview", "path": "modules/develop" }, + "title": "alltrue", + "path": "reference/functions/alltrue", + "hidden": true + }, { - "title": "Standard Module Structure", - "path": "modules/develop/structure" + "title": "anytrue", + "path": "reference/functions/anytrue", + "hidden": true }, { - "title": "Providers Within Modules", - "path": "modules/develop/providers" + "title": "base64decode", + "path": "reference/functions/base64decode", + "hidden": true }, { - "title": "Best Practices: Module Composition", - "path": "modules/develop/composition" + "title": "base64encode", + "path": "reference/functions/base64encode", + "hidden": true }, { - "title": "Publishing Modules", - "path": "modules/develop/publish" + "title": "base64gzip", + "path": "reference/functions/base64gzip", + "hidden": true }, { - "title": "Refactoring Modules", - "path": "modules/develop/refactoring" - } - ] - } - ] - }, - { - "title": "Moved block", - "path": "moved" - }, - { "title": "Checks", "path": "checks" }, - { - "title": "Import", - "routes": [ - { "title": "Overview", "path": "import" }, - { - "title": "Generating Configuration", - "path": "import/generating-configuration" - } - ] - }, - { - "title": "Expressions", - "routes": [ - { "title": "Overview", "path": "expressions" }, - { "title": "Types and Values", "path": "expressions/types" }, - { - "title": "Strings and Templates", - "path": "expressions/strings" - }, - { - "title": "References to Values", - "path": "expressions/references" - }, - { "title": "Operators", "path": "expressions/operators" }, - { - "title": "Function Calls", - "path": "expressions/function-calls" - }, - { - "title": "Conditional Expressions", - "path": "expressions/conditionals" - }, - { "title": "For Expressions", "path": "expressions/for" }, - { - "title": "Splat Expressions", - "path": "expressions/splat" - }, - - { - "title": "Dynamic Blocks", - "path": "expressions/dynamic-blocks" - }, - { - "title": "Custom Conditions", - "path": "expressions/custom-conditions" - }, - { - "title": "Type Constraints", - "path": "expressions/type-constraints" - }, - { - "title": "Version Constraints", - "path": "expressions/version-constraints" - } - ] - }, - { - "title": "Functions", - "routes": [ - { "title": "Overview", "path": "functions" }, - { - "title": "Numeric Functions", - "routes": [ - { "title": "abs", "href": "/language/functions/abs" }, - { "title": "ceil", "href": "/language/functions/ceil" }, + "title": "base64sha256", + "path": "reference/functions/base64sha256", + "hidden": true + }, { - "title": "floor", - "href": "/language/functions/floor" + "title": "base64sha512", + "path": "reference/functions/base64sha512", + "hidden": true }, - { "title": "log", "href": "/language/functions/log" }, - { "title": "max", "href": "/language/functions/max" }, - { "title": "min", "href": "/language/functions/min" }, { - "title": "parseint", - "href": "/language/functions/parseint" + "title": "basename", + "path": "reference/functions/basename", + "hidden": true }, - { "title": "pow", "href": "/language/functions/pow" }, { - "title": "signum", - "href": "/language/functions/signum" - } - ] - }, - { - "title": "String Functions", - "routes": [ + "title": "bcrypt", + "path": "reference/functions/bcrypt", + "hidden": true + }, { - "title": "chomp", - "href": "/language/functions/chomp" + "title": "can", + "path": "reference/functions/can", + "hidden": true }, { - "title": "endswith", - "href": "/language/functions/endswith" + "title": "ceil", + "path": "reference/functions/ceil", + "hidden": true }, { - "title": "format", - "href": "/language/functions/format" + "title": "chomp", + "path": "reference/functions/chomp", + "hidden": true }, { - "title": "formatlist", - "href": "/language/functions/formatlist" + "title": "chunklist", + "path": "reference/functions/chunklist", + "hidden": true }, { - "title": "indent", - "href": "/language/functions/indent" + "title": "cidrhost", + "path": "reference/functions/cidrhost", + "hidden": true }, - { "title": "join", "href": "/language/functions/join" }, { - "title": "lower", - "href": "/language/functions/lower" + "title": "cidrnetmask", + "path": "reference/functions/cidrnetmask", + "hidden": true }, { - "title": "regex", - "href": "/language/functions/regex" + "title": "cidrsubnet", + "path": "reference/functions/cidrsubnet", + "hidden": true }, { - "title": "regexall", - "href": "/language/functions/regexall" + "title": "cidrsubnets", + "path": "reference/functions/cidrsubnets", + "hidden": true }, { - "title": "replace", - "href": "/language/functions/replace" + "title": "coalesce", + "path": "reference/functions/coalesce", + "hidden": true }, { - "title": "split", - "href": "/language/functions/split" + "title": "coalescelist", + "path": "reference/functions/coalescelist", + "hidden": true }, { - "title": "startswith", - "href": "/language/functions/startswith" + "title": "compact", + "path": "reference/functions/compact", + "hidden": true }, { - "title": "strcontains", - "href": "/language/functions/strcontains" + "title": "concat", + "path": "reference/functions/concat", + "hidden": true }, { - "title": "strrev", - "href": "/language/functions/strrev" + "title": "contains", + "path": "reference/functions/contains", + "hidden": true }, { - "title": "substr", - "href": "/language/functions/substr" + "title": "csvdecode", + "path": "reference/functions/csvdecode", + "hidden": true }, { - "title": "templatestring", - "href": "/language/functions/templatestring" + "title": "dirname", + "path": "reference/functions/dirname", + "hidden": true }, { - "title": "title", - "href": "/language/functions/title" + "title": "distinct", + "path": "reference/functions/distinct", + "hidden": true }, - { "title": "trim", "href": "/language/functions/trim" }, { - "title": "trimprefix", - "href": "/language/functions/trimprefix" + "title": "element", + "path": "reference/functions/element", + "hidden": true }, { - "title": "trimsuffix", - "href": "/language/functions/trimsuffix" + "title": "endswith", + "path": "reference/functions/endswith", + "hidden": true }, { - "title": "trimspace", - "href": "/language/functions/trimspace" + "title": "file", + "path": "reference/functions/file", + "hidden": true }, - { "title": "upper", "href": "/language/functions/upper" } - ] - }, - { - "title": "Collection Functions", - "routes": [ { - "title": "alltrue", - "href": "/language/functions/alltrue" + "title": "filebase64", + "path": "reference/functions/filebase64", + "hidden": true }, { - "title": "anytrue", - "href": "/language/functions/anytrue" + "title": "filebase64sha256", + "path": "reference/functions/filebase64sha256", + "hidden": true }, { - "title": "chunklist", - "href": "/language/functions/chunklist" + "title": "filebase64sha512", + "path": "reference/functions/filebase64sha512", + "hidden": true }, { - "title": "coalesce", - "href": "/language/functions/coalesce" + "title": "fileexists", + "path": "reference/functions/fileexists", + "hidden": true }, { - "title": "coalescelist", - "href": "/language/functions/coalescelist" + "title": "filemd5", + "path": "reference/functions/filemd5", + "hidden": true }, { - "title": "compact", - "href": "/language/functions/compact" + "title": "fileset", + "path": "reference/functions/fileset", + "hidden": true }, { - "title": "concat", - "href": "/language/functions/concat" + "title": "filesha1", + "path": "reference/functions/filesha1", + "hidden": true }, { - "title": "contains", - "href": "/language/functions/contains" + "title": "filesha256", + "path": "reference/functions/filesha256", + "hidden": true }, { - "title": "distinct", - "href": "/language/functions/distinct" + "title": "filesha512", + "path": "reference/functions/filesha512", + "hidden": true }, { - "title": "element", - "href": "/language/functions/element" + "title": "flatten", + "path": "reference/functions/flatten", + "hidden": true }, { - "title": "flatten", - "href": "/language/functions/flatten" + "title": "floor", + "path": "reference/functions/floor", + "hidden": true }, { - "title": "index", - "href": "/language/functions/index_function" + "title": "format", + "path": "reference/functions/format", + "hidden": true }, - { "title": "keys", "href": "/language/functions/keys" }, { - "title": "length", - "href": "/language/functions/length" + "title": "formatdate", + "path": "reference/functions/formatdate", + "hidden": true }, - { "title": "list", "href": "/language/functions/list" }, { - "title": "lookup", - "href": "/language/functions/lookup" + "title": "formatlist", + "path": "reference/functions/formatlist", + "hidden": true }, - { "title": "map", "href": "/language/functions/map" }, { - "title": "matchkeys", - "href": "/language/functions/matchkeys" + "title": "indent", + "path": "reference/functions/indent", + "hidden": true }, { - "title": "merge", - "href": "/language/functions/merge" + "title": "index", + "path": "reference/functions/index_function", + "hidden": true }, - { "title": "one", "href": "/language/functions/one" }, { - "title": "range", - "href": "/language/functions/range" + "title": "issensitive", + "path": "reference/functions/issensitive", + "hidden": true }, { - "title": "reverse", - "href": "/language/functions/reverse" + "title": "join", + "path": "reference/functions/join", + "hidden": true }, { - "title": "setintersection", - "href": "/language/functions/setintersection" + "title": "jsondecode", + "path": "reference/functions/jsondecode", + "hidden": true }, { - "title": "setproduct", - "href": "/language/functions/setproduct" + "title": "jsonencode", + "path": "reference/functions/jsonencode", + "hidden": true }, { - "title": "setsubtract", - "href": "/language/functions/setsubtract" + "title": "keys", + "path": "reference/functions/keys", + "hidden": true }, { - "title": "setunion", - "href": "/language/functions/setunion" + "title": "length", + "path": "reference/functions/length", + "hidden": true }, { - "title": "slice", - "href": "/language/functions/slice" + "title": "list", + "path": "reference/functions/list", + "hidden": true }, - { "title": "sort", "href": "/language/functions/sort" }, - { "title": "sum", "href": "/language/functions/sum" }, { - "title": "transpose", - "href": "/language/functions/transpose" + "title": "log", + "path": "reference/functions/log", + "hidden": true }, { - "title": "values", - "href": "/language/functions/values" + "title": "lookup", + "path": "reference/functions/lookup", + "hidden": true }, { - "title": "zipmap", - "href": "/language/functions/zipmap" - } - ] - }, - { - "title": "Encoding Functions", - "routes": [ + "title": "lower", + "path": "reference/functions/lower", + "hidden": true + }, { - "title": "base64decode", - "href": "/language/functions/base64decode" + "title": "map", + "path": "reference/functions/map", + "hidden": true }, { - "title": "base64encode", - "href": "/language/functions/base64encode" + "title": "matchkeys", + "path": "reference/functions/matchkeys", + "hidden": true }, { - "title": "base64gzip", - "href": "/language/functions/base64gzip" + "title": "max", + "path": "reference/functions/max", + "hidden": true }, { - "title": "csvdecode", - "href": "/language/functions/csvdecode" + "title": "md5", + "path": "reference/functions/md5", + "hidden": true }, { - "title": "jsondecode", - "href": "/language/functions/jsondecode" + "title": "merge", + "path": "reference/functions/merge", + "hidden": true }, { - "title": "jsonencode", - "href": "/language/functions/jsonencode" + "title": "min", + "path": "reference/functions/min", + "hidden": true }, { - "title": "textdecodebase64", - "href": "/language/functions/textdecodebase64" + "title": "nonsensitive", + "path": "reference/functions/nonsensitive", + "hidden": true }, { - "title": "textencodebase64", - "href": "/language/functions/textencodebase64" + "title": "one", + "path": "reference/functions/one", + "hidden": true }, { - "title": "urlencode", - "href": "/language/functions/urlencode" + "title": "parseint", + "path": "reference/functions/parseint", + "hidden": true }, { - "title": "yamldecode", - "href": "/language/functions/yamldecode" + "title": "pathexpand", + "path": "reference/functions/pathexpand", + "hidden": true }, { - "title": "yamlencode", - "href": "/language/functions/yamlencode" - } - ] - }, - { - "title": "Filesystem Functions", - "routes": [ + "title": "plantimestamp", + "path": "reference/functions/plantimestamp", + "hidden": true + }, { - "title": "abspath", - "href": "/language/functions/abspath" + "title": "pow", + "path": "reference/functions/pow", + "hidden": true }, { - "title": "dirname", - "href": "/language/functions/dirname" + "title": "range", + "path": "reference/functions/range", + "hidden": true }, { - "title": "pathexpand", - "href": "/language/functions/pathexpand" + "title": "regex", + "path": "reference/functions/regex", + "hidden": true }, { - "title": "basename", - "href": "/language/functions/basename" + "title": "regexall", + "path": "reference/functions/regexall", + "hidden": true }, - { "title": "file", "href": "/language/functions/file" }, { - "title": "fileexists", - "href": "/language/functions/fileexists" + "title": "replace", + "path": "reference/functions/replace", + "hidden": true }, { - "title": "fileset", - "href": "/language/functions/fileset" + "title": "reverse", + "path": "reference/functions/reverse", + "hidden": true }, { - "title": "filebase64", - "href": "/language/functions/filebase64" + "title": "rsadecrypt", + "path": "reference/functions/rsadecrypt", + "hidden": true }, { - "title": "templatefile", - "href": "/language/functions/templatefile" - } - ] - }, - { - "title": "Date and Time Functions", - "routes": [ + "title": "sensitive", + "path": "reference/functions/sensitive", + "hidden": true + }, { - "title": "formatdate", - "href": "/language/functions/formatdate" + "title": "setintersection", + "path": "reference/functions/setintersection", + "hidden": true }, { - "title": "plantimestamp", - "href": "/language/functions/plantimestamp" + "title": "setproduct", + "path": "reference/functions/setproduct", + "hidden": true }, { - "title": "timeadd", - "href": "/language/functions/timeadd" + "title": "setsubtract", + "path": "reference/functions/setsubtract", + "hidden": true }, { - "title": "timecmp", - "href": "/language/functions/timecmp" + "title": "setunion", + "path": "reference/functions/setunion", + "hidden": true }, { - "title": "timestamp", - "href": "/language/functions/timestamp" - } - ] - }, - { - "title": "Hash and Crypto Functions", - "routes": [ + "title": "sha1", + "path": "reference/functions/sha1", + "hidden": true + }, { - "title": "base64sha256", - "href": "/language/functions/base64sha256" + "title": "sha256", + "path": "reference/functions/sha256", + "hidden": true }, { - "title": "base64sha512", - "href": "/language/functions/base64sha512" + "title": "sha512", + "path": "reference/functions/sha512", + "hidden": true }, { - "title": "bcrypt", - "href": "/language/functions/bcrypt" + "title": "signum", + "path": "reference/functions/signum", + "hidden": true }, { - "title": "filebase64sha256", - "href": "/language/functions/filebase64sha256" + "title": "slice", + "path": "reference/functions/slice", + "hidden": true }, { - "title": "filebase64sha512", - "href": "/language/functions/filebase64sha512" + "title": "sort", + "path": "reference/functions/sort", + "hidden": true }, { - "title": "filemd5", - "href": "/language/functions/filemd5" + "title": "split", + "path": "reference/functions/split", + "hidden": true }, { - "title": "filesha1", - "href": "/language/functions/filesha1" + "title": "startswith", + "path": "reference/functions/startswith", + "hidden": true }, { - "title": "filesha256", - "href": "/language/functions/filesha256" + "title": "strcontains", + "path": "reference/functions/strcontains", + "hidden": true }, { - "title": "filesha512", - "href": "/language/functions/filesha512" + "title": "strrev", + "path": "reference/functions/strrev", + "hidden": true }, - { "title": "md5", "href": "/language/functions/md5" }, { - "title": "rsadecrypt", - "href": "/language/functions/rsadecrypt" + "title": "substr", + "path": "reference/functions/substr", + "hidden": true }, - { "title": "sha1", "href": "/language/functions/sha1" }, { - "title": "sha256", - "href": "/language/functions/sha256" + "title": "sum", + "path": "reference/functions/sum", + "hidden": true }, { - "title": "sha512", - "href": "/language/functions/sha512" + "title": "templatefile", + "path": "reference/functions/templatefile", + "hidden": true }, - { "title": "uuid", "href": "/language/functions/uuid" }, { - "title": "uuidv5", - "href": "/language/functions/uuidv5" - } - ] - }, - { - "title": "IP Network Functions", - "routes": [ + "title": "templatestring", + "path": "reference/functions/templatestring", + "hidden": true + }, { - "title": "cidrhost", - "href": "/language/functions/cidrhost" + "title": "terraform-encode_tfvars", + "path": "reference/functions/terraform-encode_tfvars", + "hidden": true }, { - "title": "cidrnetmask", - "href": "/language/functions/cidrnetmask" + "title": "terraform-decode_tfvars", + "path": "reference/functions/terraform-decode_tfvars", + "hidden": true }, { - "title": "cidrsubnet", - "href": "/language/functions/cidrsubnet" + "title": "terraform-encode_expr", + "path": "reference/functions/terraform-encode_expr", + "hidden": true }, { - "title": "cidrsubnets", - "href": "/language/functions/cidrsubnets" - } - ] - }, - { - "title": "Type Conversion Functions", - "routes": [ - { "title": "can", "href": "/language/functions/can" }, + "title": "textdecodebase64", + "path": "reference/functions/textdecodebase64", + "hidden": true + }, { - "title": "issensitive", - "href": "/language/functions/issensitive" + "title": "textencodebase64", + "path": "reference/functions/textencodebase64", + "hidden": true }, { - "title": "nonsensitive", - "href": "/language/functions/nonsensitive" + "title": "timeadd", + "path": "reference/functions/timeadd", + "hidden": true }, { - "title": "sensitive", - "href": "/language/functions/sensitive" + "title": "timecmp", + "path": "reference/functions/timecmp", + "hidden": true }, { - "title": "tobool", - "href": "/language/functions/tobool" + "title": "timestamp", + "path": "reference/functions/timestamp", + "hidden": true }, { - "title": "tolist", - "href": "/language/functions/tolist" + "title": "title", + "path": "reference/functions/title", + "hidden": true }, { - "title": "tomap", - "href": "/language/functions/tomap" + "title": "tobool", + "path": "reference/functions/tobool", + "hidden": true }, { - "title": "tonumber", - "href": "/language/functions/tonumber" + "title": "tolist", + "path": "reference/functions/tolist", + "hidden": true }, { - "title": "toset", - "href": "/language/functions/toset" + "title": "tomap", + "path": "reference/functions/tomap", + "hidden": true }, { - "title": "tostring", - "href": "/language/functions/tostring" + "title": "tonumber", + "path": "reference/functions/tonumber", + "hidden": true }, - { "title": "try", "href": "/language/functions/try" }, - { "title": "type", "href": "/language/functions/type" } - ] - }, - { - "title": "Terraform-specific Functions", - "routes": [ - { "title": "provider::terraform::encode_tfvars", "href": "/language/functions/terraform-encode_tfvars" }, - { "title": "provider::terraform::decode_tfvars", "href": "/language/functions/terraform-decode_tfvars" }, - { "title": "provider::terraform::encode_expr", "href": "/language/functions/terraform-encode_expr" } - ] - }, - { "title": "abs", "path": "functions/abs", "hidden": true }, - { "title": "abspath", "path": "functions/abspath", "hidden": true }, - { "title": "alltrue", "path": "functions/alltrue", "hidden": true }, - { "title": "anytrue", "path": "functions/anytrue", "hidden": true }, - { - "title": "base64decode", - "path": "functions/base64decode", - "hidden": true - }, - { - "title": "base64encode", - "path": "functions/base64encode", - "hidden": true - }, - { "title": "base64gzip", "path": "functions/base64gzip", "hidden": true }, - { - "title": "base64sha256", - "path": "functions/base64sha256", - "hidden": true - }, - { - "title": "base64sha512", - "path": "functions/base64sha512", - "hidden": true - }, - { "title": "basename", "path": "functions/basename", "hidden": true }, - { "title": "bcrypt", "path": "functions/bcrypt", "hidden": true }, - { "title": "can", "path": "functions/can", "hidden": true }, - { "title": "ceil", "path": "functions/ceil", "hidden": true }, - { "title": "chomp", "path": "functions/chomp", "hidden": true }, - { "title": "chunklist", "path": "functions/chunklist", "hidden": true }, - { "title": "cidrhost", "path": "functions/cidrhost", "hidden": true }, - { - "title": "cidrnetmask", - "path": "functions/cidrnetmask", - "hidden": true - }, - { "title": "cidrsubnet", "path": "functions/cidrsubnet", "hidden": true }, - { - "title": "cidrsubnets", - "path": "functions/cidrsubnets", - "hidden": true - }, - { "title": "coalesce", "path": "functions/coalesce", "hidden": true }, - { - "title": "coalescelist", - "path": "functions/coalescelist", - "hidden": true - }, - { "title": "compact", "path": "functions/compact", "hidden": true }, - { "title": "concat", "path": "functions/concat", "hidden": true }, - { "title": "contains", "path": "functions/contains", "hidden": true }, - { "title": "csvdecode", "path": "functions/csvdecode", "hidden": true }, - { "title": "dirname", "path": "functions/dirname", "hidden": true }, - { "title": "distinct", "path": "functions/distinct", "hidden": true }, - { "title": "element", "path": "functions/element", "hidden": true }, - { "title": "endswith", "path": "functions/endswith", "hidden": true }, - { "title": "file", "path": "functions/file", "hidden": true }, - { "title": "filebase64", "path": "functions/filebase64", "hidden": true }, - { - "title": "filebase64sha256", - "path": "functions/filebase64sha256", - "hidden": true - }, - { - "title": "filebase64sha512", - "path": "functions/filebase64sha512", - "hidden": true - }, - { "title": "fileexists", "path": "functions/fileexists", "hidden": true }, - { "title": "filemd5", "path": "functions/filemd5", "hidden": true }, - { "title": "fileset", "path": "functions/fileset", "hidden": true }, - { "title": "filesha1", "path": "functions/filesha1", "hidden": true }, - { "title": "filesha256", "path": "functions/filesha256", "hidden": true }, - { "title": "filesha512", "path": "functions/filesha512", "hidden": true }, - { "title": "flatten", "path": "functions/flatten", "hidden": true }, - { "title": "floor", "path": "functions/floor", "hidden": true }, - { "title": "format", "path": "functions/format", "hidden": true }, - { "title": "formatdate", "path": "functions/formatdate", "hidden": true }, - { "title": "formatlist", "path": "functions/formatlist", "hidden": true }, - { "title": "indent", "path": "functions/indent", "hidden": true }, - { "title": "index", "path": "functions/index_function", "hidden": true }, - { - "title": "issensitive", - "path": "functions/issensitive", - "hidden": true - }, - { "title": "join", "path": "functions/join", "hidden": true }, - { "title": "jsondecode", "path": "functions/jsondecode", "hidden": true }, - { "title": "jsonencode", "path": "functions/jsonencode", "hidden": true }, - { "title": "keys", "path": "functions/keys", "hidden": true }, - { "title": "length", "path": "functions/length", "hidden": true }, - { "title": "list", "path": "functions/list", "hidden": true }, - { "title": "log", "path": "functions/log", "hidden": true }, - { "title": "lookup", "path": "functions/lookup", "hidden": true }, - { "title": "lower", "path": "functions/lower", "hidden": true }, - { "title": "map", "path": "functions/map", "hidden": true }, - { "title": "matchkeys", "path": "functions/matchkeys", "hidden": true }, - { "title": "max", "path": "functions/max", "hidden": true }, - { "title": "md5", "path": "functions/md5", "hidden": true }, - { "title": "merge", "path": "functions/merge", "hidden": true }, - { "title": "min", "path": "functions/min", "hidden": true }, - { - "title": "nonsensitive", - "path": "functions/nonsensitive", - "hidden": true - }, - { "title": "one", "path": "functions/one", "hidden": true }, - { "title": "parseint", "path": "functions/parseint", "hidden": true }, - { "title": "pathexpand", "path": "functions/pathexpand", "hidden": true }, - { "title": "plantimestamp", "path": "functions/plantimestamp", "hidden": true }, - { "title": "pow", "path": "functions/pow", "hidden": true }, - { "title": "range", "path": "functions/range", "hidden": true }, - { "title": "regex", "path": "functions/regex", "hidden": true }, - { "title": "regexall", "path": "functions/regexall", "hidden": true }, - { "title": "replace", "path": "functions/replace", "hidden": true }, - { "title": "reverse", "path": "functions/reverse", "hidden": true }, - { "title": "rsadecrypt", "path": "functions/rsadecrypt", "hidden": true }, - { "title": "sensitive", "path": "functions/sensitive", "hidden": true }, - { - "title": "setintersection", - "path": "functions/setintersection", - "hidden": true - }, - { "title": "setproduct", "path": "functions/setproduct", "hidden": true }, - { - "title": "setsubtract", - "path": "functions/setsubtract", - "hidden": true - }, - { "title": "setunion", "path": "functions/setunion", "hidden": true }, - { "title": "sha1", "path": "functions/sha1", "hidden": true }, - { "title": "sha256", "path": "functions/sha256", "hidden": true }, - { "title": "sha512", "path": "functions/sha512", "hidden": true }, - { "title": "signum", "path": "functions/signum", "hidden": true }, - { "title": "slice", "path": "functions/slice", "hidden": true }, - { "title": "sort", "path": "functions/sort", "hidden": true }, - { "title": "split", "path": "functions/split", "hidden": true }, - { "title": "startswith", "path": "functions/startswith", "hidden": true }, - { "title": "strcontains", "path": "functions/strcontains", "hidden": true}, - { "title": "strrev", "path": "functions/strrev", "hidden": true }, - { "title": "substr", "path": "functions/substr", "hidden": true }, - { "title": "sum", "path": "functions/sum", "hidden": true }, - { - "title": "templatefile", - "path": "functions/templatefile", - "hidden": true - }, - { - "title": "templatestring", - "path": "functions/templatestring", - "hidden": true - }, - { "title": "terraform-encode_tfvars", "path": "functions/terraform-encode_tfvars", "hidden": true }, - { "title": "terraform-decode_tfvars", "path": "functions/terraform-decode_tfvars", "hidden": true }, - { "title": "terraform-encode_expr", "path": "functions/terraform-encode_expr", "hidden": true }, - { - "title": "textdecodebase64", - "path": "functions/textdecodebase64", - "hidden": true - }, - { - "title": "textencodebase64", - "path": "functions/textencodebase64", - "hidden": true - }, - { "title": "timeadd", "path": "functions/timeadd", "hidden": true }, - { "title": "timecmp", "path": "functions/timecmp", "hidden": true }, - { "title": "timestamp", "path": "functions/timestamp", "hidden": true }, - { "title": "title", "path": "functions/title", "hidden": true }, - { "title": "tobool", "path": "functions/tobool", "hidden": true }, - { "title": "tolist", "path": "functions/tolist", "hidden": true }, - { "title": "tomap", "path": "functions/tomap", "hidden": true }, - { "title": "tonumber", "path": "functions/tonumber", "hidden": true }, - { "title": "toset", "path": "functions/toset", "hidden": true }, - { "title": "tostring", "path": "functions/tostring", "hidden": true }, - { "title": "transpose", "path": "functions/transpose", "hidden": true }, - { "title": "trim", "path": "functions/trim", "hidden": true }, - { "title": "trimprefix", "path": "functions/trimprefix", "hidden": true }, - { "title": "trimspace", "path": "functions/trimspace", "hidden": true }, - { "title": "trimsuffix", "path": "functions/trimsuffix", "hidden": true }, - { "title": "try", "path": "functions/try", "hidden": true }, - { "title": "type", "path": "functions/type", "hidden": true }, - { "title": "upper", "path": "functions/upper", "hidden": true }, - { "title": "urlencode", "path": "functions/urlencode", "hidden": true }, - { "title": "uuid", "path": "functions/uuid", "hidden": true }, - { "title": "uuidv5", "path": "functions/uuidv5", "hidden": true }, - { "title": "values", "path": "functions/values", "hidden": true }, - { "title": "yamldecode", "path": "functions/yamldecode", "hidden": true }, - { "title": "yamlencode", "path": "functions/yamlencode", "hidden": true }, - { "title": "zipmap", "path": "functions/zipmap", "hidden": true } - ] - }, - { - "title": "Terraform Settings", - "routes": [ - { "title": "Overview", "path": "settings" }, - { "title": "HCP Terraform", "path": "settings/cloud" }, - { - "title": "Backends", - "routes": [ { - "title": "Backend Configuration", - "path": "settings/backends/configuration" + "title": "toset", + "path": "reference/functions/toset", + "hidden": true }, { - "title": "Available Backends", - "routes": [ - { - "title": "local", - "href": "/language/settings/backends/local" - }, - { - "title": "remote", - "href": "/language/settings/backends/remote" - }, - { - "title": "azurerm", - "href": "/language/settings/backends/azurerm" - }, - { - "title": "consul", - "href": "/language/settings/backends/consul" - }, - { - "title": "cos", - "href": "/language/settings/backends/cos" - }, - { - "title": "gcs", - "href": "/language/settings/backends/gcs" - }, - { - "title": "http", - "href": "/language/settings/backends/http" - }, - { - "title": "Kubernetes", - "href": "/language/settings/backends/kubernetes" - }, - { - "title": "oss", - "href": "/language/settings/backends/oss" - }, - { - "title": "pg", - "href": "/language/settings/backends/pg" - }, - { - "title": "s3", - "href": "/language/settings/backends/s3" - } - ] + "title": "tostring", + "path": "reference/functions/tostring", + "hidden": true }, { - "title": "local", - "hidden": true, - "path": "settings/backends/local" + "title": "transpose", + "path": "reference/functions/transpose", + "hidden": true }, { - "title": "remote", - "hidden": true, - "path": "settings/backends/remote" + "title": "trim", + "path": "reference/functions/trim", + "hidden": true }, { - "title": "azurerm", - "hidden": true, - "path": "settings/backends/azurerm" + "title": "trimprefix", + "path": "reference/functions/trimprefix", + "hidden": true }, { - "title": "consul", - "hidden": true, - "path": "settings/backends/consul" + "title": "trimspace", + "path": "reference/functions/trimspace", + "hidden": true }, { - "title": "cos", - "hidden": true, - "path": "settings/backends/cos" + "title": "trimsuffix", + "path": "reference/functions/trimsuffix", + "hidden": true }, { - "title": "gcs", - "hidden": true, - "path": "settings/backends/gcs" + "title": "try", + "path": "reference/functions/try", + "hidden": true }, { - "title": "http", - "hidden": true, - "path": "settings/backends/http" + "title": "type", + "path": "reference/functions/type", + "hidden": true }, { - "title": "Kubernetes", - "hidden": true, - "path": "settings/backends/kubernetes" + "title": "upper", + "path": "reference/functions/upper", + "hidden": true }, { - "title": "oss", - "hidden": true, - "path": "settings/backends/oss" + "title": "urlencode", + "path": "reference/functions/urlencode", + "hidden": true }, { - "title": "pg", - "hidden": true, - "path": "settings/backends/pg" + "title": "uuid", + "path": "reference/functions/uuid", + "hidden": true }, { - "title": "s3", - "hidden": true, - "path": "settings/backends/s3" + "title": "uuidv5", + "path": "reference/functions/uuidv5", + "hidden": true + }, + { + "title": "values", + "path": "reference/functions/values", + "hidden": true + }, + { + "title": "yamldecode", + "path": "reference/functions/yamldecode", + "hidden": true + }, + { + "title": "yamlencode", + "path": "reference/functions/yamlencode", + "hidden": true + }, + { + "title": "zipmap", + "path": "reference/functions/zipmap", + "hidden": true } ] - } - ] - }, - { - "title": "State", - "routes": [ - { "title": "Overview", "path": "state" }, - { "title": "Purpose", "path": "state/purpose" }, - { - "title": "The terraform_remote_state Data Source", - "path": "state/remote-state-data" - }, - { - "title": "Backends: State Storage and Locking", - "path": "state/backends" }, { - "title": "Import Existing Resources", - "path": "state/import" - }, - { "title": "Locking", "path": "state/locking" }, - { "title": "Workspaces", "path": "state/workspaces" }, - { "title": "Remote State", "path": "state/remote" }, - { - "title": "Sensitive Data", - "path": "state/sensitive-data" - } - ] - }, - { - "title": "Tests", - "routes": [ - { - "title": "Overview", - "path": "tests" + "title": "Meta-Arguments", + "hidden": true, + "routes": [ + { + "title": "count", + "path": "reference/meta-arguments/count" + }, + { + "title": "depends_on", + "path": "reference/meta-arguments/depends_on" + }, + { + "title": "for_each", + "path": "reference/meta-arguments/for_each" + }, + { + "title": "lifecycle", + "path": "reference/meta-arguments/lifecycle" + }, + { + "title": "provider", + "path": "reference/meta-arguments/resource-provider" + }, + { + "title": "providers", + "path": "reference/meta-arguments/module-providers" + } + ] }, { - "title": "Mocks", - "path": "tests/mocking" + "title": "Provisioners", + "routes": [ + { + "title": "Provisioner connections", + "path": "reference/provisioners/connection" + }, + { + "title": "file", + "path": "reference/provisioners/file" + }, + { + "title": "local-exec", + "path": "reference/provisioners/local-exec" + }, + { + "title": "remote-exec", + "path": "reference/provisioners/remote-exec" + } + ] } ] }, { - "title": "Upgrading to Terraform v1.9", - "path": "upgrade-guides" - }, - { - "title": "v1.x Compatibility Promises", - "path": "v1-compatibility-promises" - }, - { "divider": true }, - { "title": "Terraform Internals", "href": "/internals" } -] + "title": "Attributes as Blocks - Configuration Language", + "path": "attr-as-blocks", + "hidden": true + } +] \ No newline at end of file diff --git a/website/docs/language/settings/backends/configuration.mdx b/website/docs/language/configure-remote-state.mdx similarity index 96% rename from website/docs/language/settings/backends/configuration.mdx rename to website/docs/language/configure-remote-state.mdx index c4bea3ec2312..b1ca16f1bf3c 100644 --- a/website/docs/language/settings/backends/configuration.mdx +++ b/website/docs/language/configure-remote-state.mdx @@ -1,10 +1,16 @@ --- -page_title: Backend Configuration - Configuration Language +page_title: Configure remote state description: >- - Use the `backend` block to control where Terraform stores state. Learn about the available state backends, the backend block, initializing backends, partial backend configuration, changing backend configuration, and unconfiguring a backend. + The nested `cloud` block configures Terraform's integration with HCP Terraform. --- -# Backend Configuration +# Configure remote state + +Should be an overview page showing you how to connect your Terraform configuration to HCP Terraform and other backends. + +PLACEHOLDER: Also include information from: https://developer.hashicorp.com/terraform/language/settings/backends/configuration + +## Backend Configuration A backend defines where Terraform stores its [state](/terraform/language/state) data files. diff --git a/website/docs/language/configure-terraform.mdx b/website/docs/language/configure-terraform.mdx new file mode 100644 index 000000000000..c3e8c30f297c --- /dev/null +++ b/website/docs/language/configure-terraform.mdx @@ -0,0 +1,139 @@ +--- +page_title: Terraform Settings - Configuration Language +description: >- + The terraform block allows you to configure Terraform behavior, including the + Terraform version, backend, integration with HCP Terraform, and required + providers. +--- + +# Configure Terraform + +The special `terraform` configuration block type is used to configure some +behaviors of Terraform itself, such as requiring a minimum Terraform version to +apply your configuration. + +## Terraform Block Syntax + +Terraform settings are gathered together into `terraform` blocks: + +```hcl +terraform { + # ... +} +``` + +Each `terraform` block can contain a number of settings related to Terraform's +behavior. Within a `terraform` block, only constant values can be used; +arguments may not refer to named objects such as resources, input variables, +etc, and may not use any of the Terraform language built-in functions. + +The various options supported within a `terraform` block are described in the +following sections. + +## Configuring HCP Terraform + +The nested `cloud` block configures HCP Terraform for enabling its +[CLI-driven run workflow](/terraform/cloud-docs/run/cli). + +- Refer to [HCP Terraform Configuration](/terraform/language/settings/cloud) for a summary of the `cloud` block's syntax. + +- Refer to [Using HCP Terraform](/terraform/cli/cloud) in the + Terraform CLI documentation for complete details about how to initialize and configure the HCP Terraform CLI integration. + +## Configuring a Terraform Backend + +The nested `backend` block configures which state backend Terraform should use. + +The syntax and behavior of the `backend` block is described in [Backend +Configuration](/terraform/language/settings/backends/configuration). + +## Specifying a Required Terraform Version + +> **Hands-on:** Try the [Manage Terraform Versions](/terraform/tutorials/configuration-language/versions) or [Manage Terraform Versions in HCP Terraform](/terraform/tutorials/cloud/cloud-versions) tutorials. + +The `required_version` setting accepts a [version constraint +string,](/terraform/language/expressions/version-constraints) which specifies which versions of Terraform +can be used with your configuration. + +If the running version of Terraform doesn't match the constraints specified, +Terraform will produce an error and exit without taking any further actions. + +When you use [child modules](/terraform/language/modules), each module can specify its own +version requirements. The requirements of all modules in the tree must be +satisfied. + +Use Terraform version constraints in a collaborative environment to +ensure that everyone is using a specific Terraform version, or using at least +a minimum Terraform version that has behavior expected by the configuration. + +The `required_version` setting applies only to the version of Terraform CLI. +Terraform's resource types are implemented by provider plugins, +whose release cycles are independent of Terraform CLI and of each other. +Use [the `required_providers` block](/terraform/language/providers/requirements) to manage +the expected versions for each provider you use. + +## Specifying Provider Requirements + +[inpage-source]: #specifying-provider-requirements + +The `required_providers` block specifies all of the providers required by the +current module, mapping each local provider name to a source address and a +version constraint. + +```hcl +terraform { + required_providers { + aws = { + version = ">= 2.7.0" + source = "hashicorp/aws" + } + } +} +``` + +For more information, see [Provider Requirements](/terraform/language/providers/requirements). + +## Experimental Language Features + +The Terraform team will sometimes introduce new language features initially via +an opt-in experiment, so that the community can try the new feature and give +feedback on it prior to it becoming a backward-compatibility constraint. + +In releases where experimental features are available, you can enable them on +a per-module basis by setting the `experiments` argument inside a `terraform` +block: + +```hcl +terraform { + experiments = [example] +} +``` + +The above would opt in to an experiment named `example`, assuming such an +experiment were available in the current Terraform version. + +Experiments are subject to arbitrary changes in later releases and, depending on +the outcome of the experiment, may change drastically before final release or +may not be released in stable form at all. Such breaking changes may appear +even in minor and patch releases. We do not recommend using experimental +features in Terraform modules intended for production use. + +In order to make that explicit and to avoid module callers inadvertently +depending on an experimental feature, any module with experiments enabled will +generate a warning on every `terraform plan` or `terraform apply`. If you +want to try experimental features in a shared module, we recommend enabling the +experiment only in alpha or beta releases of the module. + +The introduction and completion of experiments is reported in +[Terraform's changelog](https://github.com/hashicorp/terraform/blob/main/CHANGELOG.md), +so you can watch the release notes there to discover which experiment keywords, +if any, are available in a particular Terraform release. + +## Passing Metadata to Providers + +The `terraform` block can have a nested `provider_meta` block for each +provider a module is using, if the provider defines a schema for it. This +allows the provider to receive module-specific information, and is primarily +intended for modules distributed by the same vendor as the associated provider. + +For more information, see [Provider Metadata](/terraform/internals/provider-meta). diff --git a/website/docs/language/data-sources/index.mdx b/website/docs/language/data-sources.mdx similarity index 100% rename from website/docs/language/data-sources/index.mdx rename to website/docs/language/data-sources.mdx diff --git a/website/docs/language/dynamic-configuration.mdx b/website/docs/language/dynamic-configuration.mdx new file mode 100644 index 000000000000..0e05ea3b0f99 --- /dev/null +++ b/website/docs/language/dynamic-configuration.mdx @@ -0,0 +1,16 @@ +--- +page_title: Write dynamic configuration +description: >- + An introduction to the built-in functions that you can use to transform and + combine values in expressions. +--- + +# Write dynamic configuration + +Link out to Terraform expressions and functions. Should include how expressions and functions are similar and different. The main source of this information should come from the following pages: + +- https://developer.hashicorp.com/terraform/language/expressions +- https://developer.hashicorp.com/terraform/language/expressions/function-calls +- https://developer.hashicorp.com/terraform/language/functions + +Potentially link out to troubleshooting docs too since you may want to experiment with Terraform console and create plan runs before you actually apply the configuration. \ No newline at end of file diff --git a/website/docs/language/expressions/function-calls.mdx b/website/docs/language/expressions/function-calls.mdx deleted file mode 100644 index b12f6674138e..000000000000 --- a/website/docs/language/expressions/function-calls.mdx +++ /dev/null @@ -1,114 +0,0 @@ ---- -page_title: Function Calls - Configuration Language -description: >- - Functions transform and combine values. Learn about Terraform's built-in - functions. ---- - -# Function Calls - -> **Hands-on:** Try the [Perform Dynamic Operations with Functions](/terraform/tutorials/configuration-language/functions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. - -The Terraform language has a number of -[built-in functions](/terraform/language/functions) that can be used -in expressions to transform and combine values. These -are similar to the operators but all follow a common syntax: - -```hcl -(, ) -``` - -The function name specifies which function to call. Each defined function -expects a specific number of arguments with specific value types, and returns a -specific value type as a result. - -Some functions take an arbitrary number of arguments. For example, the `min` -function takes any amount of number arguments and returns the one that is -numerically smallest: - -```hcl -min(55, 3453, 2) -``` - -A function call expression evaluates to the function's return value. - -## Available Functions - -For a full list of available functions, see -[the function reference](/terraform/language/functions). - -## Expanding Function Arguments - -If the arguments to pass to a function are available in a list or tuple value, -that value can be _expanded_ into separate arguments. Provide the list value as -an argument and follow it with the `...` symbol: - -```hcl -min([55, 2453, 2]...) -``` - -The expansion symbol is three periods (`...`), not a Unicode ellipsis character -(`…`). Expansion is a special syntax that is only available in function calls. - -## Using Sensitive Data as Function Arguments - -When using sensitive data, such as [an input variable](/terraform/language/values/variables#suppressing-values-in-cli-output) -or [an output defined](/terraform/language/values/outputs#sensitive-suppressing-values-in-cli-output) as sensitive -as function arguments, the result of the function call will be marked as sensitive. - -This is a conservative behavior that is true irrespective of the function being -called. For example, passing an object containing a sensitive input variable to -the `keys()` function will result in a list that is sensitive: - -```shell -> local.baz -{ - "a" = (sensitive value) - "b" = "dog" -} -> keys(local.baz) -(sensitive value) -``` - -## When Terraform Calls Functions - -Most of Terraform's built-in functions are, in programming language terms, -[pure functions](https://en.wikipedia.org/wiki/Pure_function). This means that -their result is based only on their arguments and so it doesn't make any -practical difference when Terraform would call them. - -However, a small subset of functions interact with outside state and so for -those it can be helpful to know when Terraform will call them in relation to -other events that occur in a Terraform run. - -The small set of special functions includes -[`file`](/terraform/language/functions/file), -[`templatefile`](/terraform/language/functions/templatefile), -[`timestamp`](/terraform/language/functions/timestamp), -and [`uuid`](/terraform/language/functions/uuid). -If you are not working with these functions then you don't need -to read this section, although the information here may still be interesting -background information. - -The `file` and `templatefile` functions are intended for reading files that -are included as a static part of the configuration and so Terraform will -execute these functions as part of initial configuration validation, before -taking any other actions with the configuration. That means you cannot use -either function to read files that your configuration might generate -dynamically on disk as part of the plan or apply steps. - -The `timestamp` function returns a representation of the current system time -at the point when Terraform calls it, and the `uuid` function returns a random -result which differs on each call. Without any special behavior, these would -both cause the final configuration during the apply step not to match the -actions shown in the plan, which violates the Terraform execution model. - -For that reason, Terraform arranges for both of those functions to produce -[unknown value](/terraform/language/expressions/references#values-not-yet-known) results during the -plan step, with the real result being decided only during the apply step. -For `timestamp` in particular, this means that the recorded time will be -the instant when Terraform began applying the change, rather than when -Terraform _planned_ the change. - -For more details on the behavior of these functions, refer to their own -documentation pages. diff --git a/website/docs/language/files/index.mdx b/website/docs/language/files.mdx similarity index 100% rename from website/docs/language/files/index.mdx rename to website/docs/language/files.mdx diff --git a/website/docs/language/import/generating-configuration.mdx b/website/docs/language/import/generate.mdx similarity index 100% rename from website/docs/language/import/generating-configuration.mdx rename to website/docs/language/import/generate.mdx diff --git a/website/docs/language/index.mdx b/website/docs/language/index.mdx index fdaef99afc17..6f7b1d59dc66 100644 --- a/website/docs/language/index.mdx +++ b/website/docs/language/index.mdx @@ -1,33 +1,56 @@ --- -page_title: Overview - Configuration Language +page_title: Overview - Write Terraform configuration description: >- Use the Terraform configuration language to describe the infrastructure that Terraform manages. --- -# Terraform Language Documentation +# Write Terraform configuration + +Rewrite so this page is more general to writing Terraform configuration. This page should have a high level overview of the Terraform workflow (write configuration, plan/apply configuration). + +This page should then be an overview page for this entire content as a whole. As a result, it should have a sections for: + +- High level information + - Syntax (HCL, JSON, CDKTF) + - File structure + - Style guide +- The fundamentals of Terraform configurations + - Resources, data sources, providers + - Variables, locals, outputs + - Modules +- Advanced Terraform configuration + - Meta-arguments (`depends_on`, `count`, `for_each`, `provider`, `lifecycle`) + - Functions and expressions + - Import existing resources + - Version configuration + - Dependency lock file + - Validate configuration + - Checks and tests + - Refactor configuration + - Troubleshoot configuration + - Provisioners +- Reference + - Files + - Override + - Dependency lock + - Test + +The goal of this layout is that: + +- **Fundamentals**: give you the tools necessary to write and define ~90% of the Terraform configuration out there. It might not be the most efficient way to write configuration, but it just works (TM). +- **Advanced**: will let you level up from the fundamentals. These should be high level pages (most of these should be single pages overview and usage docs). Once users read this, we expect them to go to the respective reference docs for more information. -This is the documentation for Terraform's configuration language. It is relevant -to users of [Terraform CLI](/terraform/cli), -[HCP Terraform](https://cloud.hashicorp.com/products/terraform), and -[Terraform Enterprise](/terraform/enterprise). Terraform's language is -its primary user interface. Configuration files you write in Terraform -language tell Terraform what plugins to install, what infrastructure to create, -and what data to fetch. Terraform language also lets you define dependencies -between resources and create multiple similar resources from a single -configuration block. +--- + +This is the documentation for Terraform's configuration language. It is relevant to users of [Terraform CLI](/terraform/cli), [HCP Terraform](https://cloud.hashicorp.com/products/terraform), and [Terraform Enterprise](/terraform/enterprise). Terraform's language is its primary user interface. Configuration files you write in Terraform language tell Terraform what plugins to install, what infrastructure to create, and what data to fetch. Terraform language also lets you define dependencies between resources and create multiple similar resources from a single configuration block. > **Hands-on:** Try the [Write Terraform Configuration](/terraform/tutorials/configuration-language) tutorials. ## About the Terraform Language -The main purpose of the Terraform language is declaring -[resources](/terraform/language/resources), which represent infrastructure objects. All other -language features exist only to make the definition of resources more flexible -and convenient. +The main purpose of the Terraform language is declaring [resources](/terraform/language/resources), which represent infrastructure objects. All other language features exist only to make the definition of resources more flexible and convenient. -A _Terraform configuration_ is a complete document in the Terraform language -that tells Terraform how to manage a given collection of infrastructure. A -configuration can consist of multiple files and directories. +A _Terraform configuration_ is a complete document in the Terraform language that tells Terraform how to manage a given collection of infrastructure. A configuration can consist of multiple files and directories. The syntax of the Terraform language consists of only a few basic elements: @@ -42,30 +65,15 @@ resource "aws_vpc" "main" { } ``` -- _Blocks_ are containers for other content and usually represent the - configuration of some kind of object, like a resource. Blocks have a - _block type,_ can have zero or more _labels,_ and have a _body_ that contains - any number of arguments and nested blocks. Most of Terraform's features are - controlled by top-level blocks in a configuration file. +- _Blocks_ are containers for other content and usually represent the configuration of some kind of object, like a resource. Blocks have a _block type,_ can have zero or more _labels,_ and have a _body_ that contains any number of arguments and nested blocks. Most of Terraform's features are controlled by top-level blocks in a configuration file. - _Arguments_ assign a value to a name. They appear within blocks. -- _Expressions_ represent a value, either literally or by referencing and - combining other values. They appear as values for arguments, or within other - expressions. +- _Expressions_ represent a value, either literally or by referencing and combining other values. They appear as values for arguments, or within other expressions. -The Terraform language is declarative, describing an intended goal rather than -the steps to reach that goal. The ordering of blocks and the files they are -organized into are generally not significant; Terraform only considers implicit -and explicit relationships between resources when determining an order of -operations. +The Terraform language is declarative, describing an intended goal rather than the steps to reach that goal. The ordering of blocks and the files they are organized into are generally not significant; Terraform only considers implicit and explicit relationships between resources when determining an order of operations. ### Example -The following example describes a simple network topology for Amazon Web -Services, just to give a sense of the overall structure and syntax of the -Terraform language. Similar configurations can be created for other virtual -network services, using resource types defined by other providers, and a -practical network configuration will often contain additional elements not -shown here. +The following example describes a simple network topology for Amazon Web Services, just to give a sense of the overall structure and syntax of the Terraform language. Similar configurations can be created for other virtual network services, using resource types defined by other providers, and a practical network configuration will often contain additional elements not shown here. ```hcl terraform { diff --git a/website/docs/language/values/locals.mdx b/website/docs/language/locals.mdx similarity index 100% rename from website/docs/language/values/locals.mdx rename to website/docs/language/locals.mdx diff --git a/website/docs/language/modules/syntax.mdx b/website/docs/language/modules/use.mdx similarity index 100% rename from website/docs/language/modules/syntax.mdx rename to website/docs/language/modules/use.mdx diff --git a/website/docs/language/modules/develop/composition.mdx b/website/docs/language/modules/write/composition.mdx similarity index 100% rename from website/docs/language/modules/develop/composition.mdx rename to website/docs/language/modules/write/composition.mdx diff --git a/website/docs/language/modules/develop/index.mdx b/website/docs/language/modules/write/index.mdx similarity index 100% rename from website/docs/language/modules/develop/index.mdx rename to website/docs/language/modules/write/index.mdx diff --git a/website/docs/language/modules/develop/providers.mdx b/website/docs/language/modules/write/providers.mdx similarity index 100% rename from website/docs/language/modules/develop/providers.mdx rename to website/docs/language/modules/write/providers.mdx diff --git a/website/docs/language/modules/develop/publish.mdx b/website/docs/language/modules/write/publish.mdx similarity index 100% rename from website/docs/language/modules/develop/publish.mdx rename to website/docs/language/modules/write/publish.mdx diff --git a/website/docs/language/modules/develop/refactoring.mdx b/website/docs/language/modules/write/refactoring.mdx similarity index 100% rename from website/docs/language/modules/develop/refactoring.mdx rename to website/docs/language/modules/write/refactoring.mdx diff --git a/website/docs/language/modules/develop/structure.mdx b/website/docs/language/modules/write/structure.mdx similarity index 100% rename from website/docs/language/modules/develop/structure.mdx rename to website/docs/language/modules/write/structure.mdx diff --git a/website/docs/language/values/outputs.mdx b/website/docs/language/output.mdx similarity index 100% rename from website/docs/language/values/outputs.mdx rename to website/docs/language/output.mdx diff --git a/website/docs/language/providers/requirements.mdx b/website/docs/language/provider.mdx similarity index 93% rename from website/docs/language/providers/requirements.mdx rename to website/docs/language/provider.mdx index cc782ea03eeb..dcb12f805775 100644 --- a/website/docs/language/providers/requirements.mdx +++ b/website/docs/language/provider.mdx @@ -1,11 +1,13 @@ --- -page_title: Provider Requirements - Configuration Language +page_title: Define provider block description: >- Providers are plugins that allow Terraform to interact with services, cloud providers, and other APIs. Learn how to declare providers in a configuration. --- -# Provider Requirements +# Define provider block + +This used to be the [Providers requirements](https://developer.hashicorp.com/terraform/language/providers/requirements) page. I heavily recommend we move the original [`langauge/provider/index`](https://developer.hashicorp.com/terraform/language/providers) to the `/terraform/intro` docs as part of "Concepts", since it covers more what providers are. These pages should be specific to defining Terraform provider blocks. Any deep dive to what providers are should be linked out to a more general provider page. Terraform relies on plugins called "providers" to interact with remote systems. Terraform configurations must declare which providers they require, so that @@ -48,10 +50,10 @@ Each argument in the `required_providers` block enables one provider. The key determines the provider's [local name](#local-names) (its unique identifier within this module), and the value is an object with the following elements: -* `source` - the global [source address](#source-addresses) for the +- `source` - the global [source address](#source-addresses) for the provider you intend to use, such as `hashicorp/aws`. -* `version` - a [version constraint](#version-constraints) specifying +- `version` - a [version constraint](#version-constraints) specifying which subset of available provider versions the module is compatible with. -> **Note:** The `name = { source, version }` syntax for `required_providers` @@ -65,8 +67,8 @@ Requirements](#v0-12-compatible-provider-requirements) below. Each provider has two identifiers: -* A unique _source address,_ which is only used when requiring a provider. -* A _local name,_ which is used everywhere else in a Terraform module. +- A unique _source address,_ which is only used when requiring a provider. +- A _local name,_ which is used everywhere else in a Terraform module. -> **Note:** Prior to Terraform 0.13, providers only had local names, since Terraform could only automatically download providers distributed by HashiCorp. @@ -118,6 +120,7 @@ follows: `[/]/` Examples of valid provider source address formats include: + - `NAMESPACE/TYPE` - `HOSTNAME/NAMESPACE/TYPE` @@ -402,21 +405,21 @@ When writing a module that is compatible with both Terraform v0.12.26 and Terraform v0.13.0 or later, you must follow the following additional rules so that both versions will select the same provider to install: -* Use only providers that can be automatically installed by Terraform v0.12. +- Use only providers that can be automatically installed by Terraform v0.12. Third-party providers, such as community providers in the Terraform Registry, cannot be selected by Terraform v0.12 because it does not support the hierarchical source address namespace. -* Ensure that your chosen local name exactly matches the "type" portion of the +- Ensure that your chosen local name exactly matches the "type" portion of the source address given in the `source` argument, such as both being "aws" in the examples above, because Terraform v0.12 will use the local name to determine which provider plugin to download and install. -* If the provider belongs to the `hashicorp` namespace, as with the +- If the provider belongs to the `hashicorp` namespace, as with the `hashicorp/aws` provider shown above, omit the `source` argument and allow Terraform v0.13 to select the `hashicorp` namespace by default. -* Provider type names must always be written in lowercase. Terraform v0.13 +- Provider type names must always be written in lowercase. Terraform v0.13 treats provider source addresses as case-insensitive, but Terraform v0.12 considers its legacy-style provider names to be case-sensitive. Using lowercase will ensure that the name is selectable by both Terraform major diff --git a/website/docs/language/providers/index.mdx b/website/docs/language/providers/index.mdx deleted file mode 100644 index 621a4854eee7..000000000000 --- a/website/docs/language/providers/index.mdx +++ /dev/null @@ -1,115 +0,0 @@ ---- -page_title: Providers - Configuration Language -description: >- - An overview of how to install and use providers, Terraform plugins that - interact with services, cloud providers, and other APIs. ---- - -# Providers - -> **Hands-on:** Try the [Perform CRUD Operations with Providers](/terraform/tutorials/configuration-language/provider-use?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. - -Terraform relies on plugins called providers to interact with cloud providers, -SaaS providers, and other APIs. - -Terraform configurations must declare which providers they require so that -Terraform can install and use them. Additionally, some providers require -configuration (like endpoint URLs or cloud regions) before they can be used. - -## What Providers Do - -Each provider adds a set of [resource types](/terraform/language/resources) -and/or [data sources](/terraform/language/data-sources) that Terraform can -manage. - -Every resource type is implemented by a provider; without providers, Terraform -can't manage any kind of infrastructure. - -Most providers configure a specific infrastructure platform (either cloud or -self-hosted). Providers can also offer local utilities for tasks like -generating random numbers for unique resource names. - -## Where Providers Come From - -Providers are distributed separately from Terraform itself, and each provider -has its own release cadence and version numbers. - -The [Terraform Registry](https://registry.terraform.io/browse/providers) -is the main directory of publicly available Terraform providers, and hosts -providers for most major infrastructure platforms. - -## Provider Documentation - -Each provider has its own documentation, describing its resource -types and their arguments. - -The [Terraform Registry](https://registry.terraform.io/browse/providers) -includes documentation for a wide range of providers developed by HashiCorp, third-party vendors, and our Terraform community. Use the -"Documentation" link in a provider's header to browse its documentation. - -Provider documentation in the Registry is versioned; you can use the version -menu in the header to change which version you're viewing. - -For details about writing, generating, and previewing provider documentation, -see the [provider publishing documentation](/terraform/registry/providers/docs). - -## How to Use Providers - -Providers are released separately from Terraform itself and have their own version numbers. In production we recommend constraining the acceptable provider versions in the configuration's provider requirements block, to make sure that `terraform init` does not install newer versions of the provider that are incompatible with the configuration. - -To use resources from a given provider, you need to include some information -about it in your configuration. See the following pages for details: - -- [Provider Requirements](/terraform/language/providers/requirements) - documents how to declare providers so Terraform can install them. - -- [Provider Configuration](/terraform/language/providers/configuration) - documents how to configure settings for providers. - -- [Dependency Lock File](/terraform/language/files/dependency-lock) - documents an additional HCL file that can be included with a configuration, - which tells Terraform to always use a specific set of provider versions. - -## Provider Installation - -- HCP Terraform and Terraform Enterprise install providers as part of every run. - -- Terraform CLI finds and installs providers when - [initializing a working directory](/terraform/cli/init). It can - automatically download providers from a Terraform registry, or load them from - a local mirror or cache. If you are using a persistent working directory, you - must reinitialize whenever you change a configuration's providers. - - To save time and bandwidth, Terraform CLI supports an optional plugin - cache. You can enable the cache using the `plugin_cache_dir` setting in - [the CLI configuration file](/terraform/cli/config/config-file). - -To ensure Terraform always installs the same provider versions for a given -configuration, you can use Terraform CLI to create a -[dependency lock file](/terraform/language/files/dependency-lock) -and commit it to version control along with your configuration. If a lock file -is present, HCP Terraform, CLI, and Enterprise will all obey it when -installing providers. - -> **Hands-on:** Try the [Lock and Upgrade Provider Versions](/terraform/tutorials/configuration-language/provider-versioning?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. - -## How to Find Providers - -To find providers for the infrastructure platforms you use, browse -[the providers section of the Terraform Registry](https://registry.terraform.io/browse/providers). - -Some providers on the Registry are developed and published by HashiCorp, some -are published by platform maintainers, and some are published by users and -volunteers. The provider listings use the following badges to indicate who -develops and maintains a given provider. - - -

- -## How to Develop Providers - -Providers are written in Go, using the Terraform Plugin SDK. For more -information on developing providers, see: - -- The [Plugin Development](/terraform/plugin) documentation -- The [Call APIs with Terraform Providers](/terraform/tutorials/providers-plugin-framework?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials diff --git a/website/docs/language/resources/provisioners/syntax.mdx b/website/docs/language/provisioner.mdx similarity index 90% rename from website/docs/language/resources/provisioners/syntax.mdx rename to website/docs/language/provisioner.mdx index d3a042ec70ee..c829469e8bfb 100644 --- a/website/docs/language/resources/provisioners/syntax.mdx +++ b/website/docs/language/provisioner.mdx @@ -336,3 +336,49 @@ resource "aws_instance" "web" { } } ``` + +## Provisioners without a resource + +PLACEHOLDER (source from: https://developer.hashicorp.com/terraform/language/resources/provisioners/null_resource) + +If you need to run provisioners that aren't directly associated with a specific +resource, you can associate them with a `terraform_data`. + +Instances of [`terraform_data`](/terraform/language/resources/terraform-data) are treated +like normal resources, but they don't do anything. Like with any other resource +type, you can configure [provisioners](/terraform/language/resources/provisioners/syntax) +and [connection details](/terraform/language/resources/provisioners/connection) on a +`terraform_data` resource. You can also use its `input` argument, `triggers_replace` argument, and any +meta-arguments to control exactly where in the dependency graph its +provisioners will run. + +~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to +[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. + +## Example usage + +```hcl +resource "aws_instance" "cluster" { + count = 3 + + # ... +} + +resource "terraform_data" "cluster" { + # Replacement of any instance of the cluster requires re-provisioning + triggers_replace = aws_instance.cluster[*].id + + # Bootstrap script can run on any instance of the cluster + # So we just choose the first in this case + connection { + host = aws_instance.cluster[0].public_ip + } + + provisioner "remote-exec" { + # Bootstrap script called with private_ip of each node in the cluster + inline = [ + "bootstrap-cluster.sh ${join(" ", aws_instance.cluster[*].private_ip)}", + ] + } +} +``` diff --git a/website/docs/language/refactor.mdx b/website/docs/language/refactor.mdx new file mode 100644 index 000000000000..8937c7eed35a --- /dev/null +++ b/website/docs/language/refactor.mdx @@ -0,0 +1,9 @@ +--- +page_title: Refactor configuration +description: >- + Import and manage existing resources with Terraform using configuration-driven import. +--- + +# Refactor configuration + +PLACEHOLDER \ No newline at end of file diff --git a/website/docs/language/settings/backends/azurerm.mdx b/website/docs/language/reference/backend/azurerm.mdx similarity index 100% rename from website/docs/language/settings/backends/azurerm.mdx rename to website/docs/language/reference/backend/azurerm.mdx diff --git a/website/docs/language/settings/backends/consul.mdx b/website/docs/language/reference/backend/consul.mdx similarity index 100% rename from website/docs/language/settings/backends/consul.mdx rename to website/docs/language/reference/backend/consul.mdx diff --git a/website/docs/language/settings/backends/cos.mdx b/website/docs/language/reference/backend/cos.mdx similarity index 100% rename from website/docs/language/settings/backends/cos.mdx rename to website/docs/language/reference/backend/cos.mdx diff --git a/website/docs/language/settings/backends/gcs.mdx b/website/docs/language/reference/backend/gcs.mdx similarity index 100% rename from website/docs/language/settings/backends/gcs.mdx rename to website/docs/language/reference/backend/gcs.mdx diff --git a/website/docs/language/settings/backends/http.mdx b/website/docs/language/reference/backend/http.mdx similarity index 100% rename from website/docs/language/settings/backends/http.mdx rename to website/docs/language/reference/backend/http.mdx diff --git a/website/docs/language/settings/backends/kubernetes.mdx b/website/docs/language/reference/backend/kubernetes.mdx similarity index 100% rename from website/docs/language/settings/backends/kubernetes.mdx rename to website/docs/language/reference/backend/kubernetes.mdx diff --git a/website/docs/language/settings/backends/local.mdx b/website/docs/language/reference/backend/local.mdx similarity index 100% rename from website/docs/language/settings/backends/local.mdx rename to website/docs/language/reference/backend/local.mdx diff --git a/website/docs/language/settings/backends/oss.mdx b/website/docs/language/reference/backend/oss.mdx similarity index 100% rename from website/docs/language/settings/backends/oss.mdx rename to website/docs/language/reference/backend/oss.mdx diff --git a/website/docs/language/settings/backends/pg.mdx b/website/docs/language/reference/backend/pg.mdx similarity index 100% rename from website/docs/language/settings/backends/pg.mdx rename to website/docs/language/reference/backend/pg.mdx diff --git a/website/docs/language/settings/backends/remote.mdx b/website/docs/language/reference/backend/remote.mdx similarity index 100% rename from website/docs/language/settings/backends/remote.mdx rename to website/docs/language/reference/backend/remote.mdx diff --git a/website/docs/language/settings/backends/s3.mdx b/website/docs/language/reference/backend/s3.mdx similarity index 100% rename from website/docs/language/settings/backends/s3.mdx rename to website/docs/language/reference/backend/s3.mdx diff --git a/website/docs/language/checks/index.mdx b/website/docs/language/reference/check.mdx similarity index 100% rename from website/docs/language/checks/index.mdx rename to website/docs/language/reference/check.mdx diff --git a/website/docs/language/settings/cloud.mdx b/website/docs/language/reference/cloud.mdx similarity index 100% rename from website/docs/language/settings/cloud.mdx rename to website/docs/language/reference/cloud.mdx diff --git a/website/docs/language/expressions/conditionals.mdx b/website/docs/language/reference/expressions/conditionals.mdx similarity index 100% rename from website/docs/language/expressions/conditionals.mdx rename to website/docs/language/reference/expressions/conditionals.mdx diff --git a/website/docs/language/expressions/custom-conditions.mdx b/website/docs/language/reference/expressions/custom-conditions.mdx similarity index 100% rename from website/docs/language/expressions/custom-conditions.mdx rename to website/docs/language/reference/expressions/custom-conditions.mdx diff --git a/website/docs/language/expressions/dynamic-blocks.mdx b/website/docs/language/reference/expressions/dynamic-blocks.mdx similarity index 100% rename from website/docs/language/expressions/dynamic-blocks.mdx rename to website/docs/language/reference/expressions/dynamic-blocks.mdx diff --git a/website/docs/language/expressions/for.mdx b/website/docs/language/reference/expressions/for.mdx similarity index 100% rename from website/docs/language/expressions/for.mdx rename to website/docs/language/reference/expressions/for.mdx diff --git a/website/docs/language/expressions/index.mdx b/website/docs/language/reference/expressions/index.mdx similarity index 93% rename from website/docs/language/expressions/index.mdx rename to website/docs/language/reference/expressions/index.mdx index 8817589cd881..3eb5cae56107 100644 --- a/website/docs/language/expressions/index.mdx +++ b/website/docs/language/reference/expressions/index.mdx @@ -7,6 +7,8 @@ description: >- # Expressions +Make this even shorter. Should prob just include a sentence or two on what Terraform expressions specifically are, link out to the overview page (define dynamic configuration) and the section breakdown at the bottom of this page. + > **Hands-on:** Try the [Create Dynamic Expressions](/terraform/tutorials/configuration-language/expressions?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorial. _Expressions_ refer to or compute values within a configuration. diff --git a/website/docs/language/expressions/operators.mdx b/website/docs/language/reference/expressions/operators.mdx similarity index 100% rename from website/docs/language/expressions/operators.mdx rename to website/docs/language/reference/expressions/operators.mdx diff --git a/website/docs/language/expressions/references.mdx b/website/docs/language/reference/expressions/references.mdx similarity index 100% rename from website/docs/language/expressions/references.mdx rename to website/docs/language/reference/expressions/references.mdx diff --git a/website/docs/language/expressions/splat.mdx b/website/docs/language/reference/expressions/splat.mdx similarity index 100% rename from website/docs/language/expressions/splat.mdx rename to website/docs/language/reference/expressions/splat.mdx diff --git a/website/docs/language/expressions/strings.mdx b/website/docs/language/reference/expressions/strings.mdx similarity index 100% rename from website/docs/language/expressions/strings.mdx rename to website/docs/language/reference/expressions/strings.mdx diff --git a/website/docs/language/expressions/type-constraints.mdx b/website/docs/language/reference/expressions/type-constraints.mdx similarity index 100% rename from website/docs/language/expressions/type-constraints.mdx rename to website/docs/language/reference/expressions/type-constraints.mdx diff --git a/website/docs/language/expressions/types.mdx b/website/docs/language/reference/expressions/types.mdx similarity index 100% rename from website/docs/language/expressions/types.mdx rename to website/docs/language/reference/expressions/types.mdx diff --git a/website/docs/language/expressions/version-constraints.mdx b/website/docs/language/reference/expressions/version-constraints.mdx similarity index 100% rename from website/docs/language/expressions/version-constraints.mdx rename to website/docs/language/reference/expressions/version-constraints.mdx diff --git a/website/docs/language/files/dependency-lock.mdx b/website/docs/language/reference/file/dependency-lock.mdx similarity index 100% rename from website/docs/language/files/dependency-lock.mdx rename to website/docs/language/reference/file/dependency-lock.mdx diff --git a/website/docs/language/files/override.mdx b/website/docs/language/reference/file/override.mdx similarity index 100% rename from website/docs/language/files/override.mdx rename to website/docs/language/reference/file/override.mdx diff --git a/website/docs/language/files/tests.mdx b/website/docs/language/reference/file/tests.mdx similarity index 100% rename from website/docs/language/files/tests.mdx rename to website/docs/language/reference/file/tests.mdx diff --git a/website/docs/language/functions/abs.mdx b/website/docs/language/reference/functions/abs.mdx similarity index 100% rename from website/docs/language/functions/abs.mdx rename to website/docs/language/reference/functions/abs.mdx diff --git a/website/docs/language/functions/abspath.mdx b/website/docs/language/reference/functions/abspath.mdx similarity index 100% rename from website/docs/language/functions/abspath.mdx rename to website/docs/language/reference/functions/abspath.mdx diff --git a/website/docs/language/functions/alltrue.mdx b/website/docs/language/reference/functions/alltrue.mdx similarity index 100% rename from website/docs/language/functions/alltrue.mdx rename to website/docs/language/reference/functions/alltrue.mdx diff --git a/website/docs/language/functions/anytrue.mdx b/website/docs/language/reference/functions/anytrue.mdx similarity index 100% rename from website/docs/language/functions/anytrue.mdx rename to website/docs/language/reference/functions/anytrue.mdx diff --git a/website/docs/language/functions/base64decode.mdx b/website/docs/language/reference/functions/base64decode.mdx similarity index 100% rename from website/docs/language/functions/base64decode.mdx rename to website/docs/language/reference/functions/base64decode.mdx diff --git a/website/docs/language/functions/base64encode.mdx b/website/docs/language/reference/functions/base64encode.mdx similarity index 100% rename from website/docs/language/functions/base64encode.mdx rename to website/docs/language/reference/functions/base64encode.mdx diff --git a/website/docs/language/functions/base64gzip.mdx b/website/docs/language/reference/functions/base64gzip.mdx similarity index 100% rename from website/docs/language/functions/base64gzip.mdx rename to website/docs/language/reference/functions/base64gzip.mdx diff --git a/website/docs/language/functions/base64sha256.mdx b/website/docs/language/reference/functions/base64sha256.mdx similarity index 100% rename from website/docs/language/functions/base64sha256.mdx rename to website/docs/language/reference/functions/base64sha256.mdx diff --git a/website/docs/language/functions/base64sha512.mdx b/website/docs/language/reference/functions/base64sha512.mdx similarity index 100% rename from website/docs/language/functions/base64sha512.mdx rename to website/docs/language/reference/functions/base64sha512.mdx diff --git a/website/docs/language/functions/basename.mdx b/website/docs/language/reference/functions/basename.mdx similarity index 100% rename from website/docs/language/functions/basename.mdx rename to website/docs/language/reference/functions/basename.mdx diff --git a/website/docs/language/functions/bcrypt.mdx b/website/docs/language/reference/functions/bcrypt.mdx similarity index 100% rename from website/docs/language/functions/bcrypt.mdx rename to website/docs/language/reference/functions/bcrypt.mdx diff --git a/website/docs/language/functions/can.mdx b/website/docs/language/reference/functions/can.mdx similarity index 100% rename from website/docs/language/functions/can.mdx rename to website/docs/language/reference/functions/can.mdx diff --git a/website/docs/language/functions/ceil.mdx b/website/docs/language/reference/functions/ceil.mdx similarity index 100% rename from website/docs/language/functions/ceil.mdx rename to website/docs/language/reference/functions/ceil.mdx diff --git a/website/docs/language/functions/chomp.mdx b/website/docs/language/reference/functions/chomp.mdx similarity index 100% rename from website/docs/language/functions/chomp.mdx rename to website/docs/language/reference/functions/chomp.mdx diff --git a/website/docs/language/functions/chunklist.mdx b/website/docs/language/reference/functions/chunklist.mdx similarity index 100% rename from website/docs/language/functions/chunklist.mdx rename to website/docs/language/reference/functions/chunklist.mdx diff --git a/website/docs/language/functions/cidrhost.mdx b/website/docs/language/reference/functions/cidrhost.mdx similarity index 100% rename from website/docs/language/functions/cidrhost.mdx rename to website/docs/language/reference/functions/cidrhost.mdx diff --git a/website/docs/language/functions/cidrnetmask.mdx b/website/docs/language/reference/functions/cidrnetmask.mdx similarity index 100% rename from website/docs/language/functions/cidrnetmask.mdx rename to website/docs/language/reference/functions/cidrnetmask.mdx diff --git a/website/docs/language/functions/cidrsubnet.mdx b/website/docs/language/reference/functions/cidrsubnet.mdx similarity index 100% rename from website/docs/language/functions/cidrsubnet.mdx rename to website/docs/language/reference/functions/cidrsubnet.mdx diff --git a/website/docs/language/functions/cidrsubnets.mdx b/website/docs/language/reference/functions/cidrsubnets.mdx similarity index 100% rename from website/docs/language/functions/cidrsubnets.mdx rename to website/docs/language/reference/functions/cidrsubnets.mdx diff --git a/website/docs/language/functions/coalesce.mdx b/website/docs/language/reference/functions/coalesce.mdx similarity index 100% rename from website/docs/language/functions/coalesce.mdx rename to website/docs/language/reference/functions/coalesce.mdx diff --git a/website/docs/language/functions/coalescelist.mdx b/website/docs/language/reference/functions/coalescelist.mdx similarity index 100% rename from website/docs/language/functions/coalescelist.mdx rename to website/docs/language/reference/functions/coalescelist.mdx diff --git a/website/docs/language/functions/compact.mdx b/website/docs/language/reference/functions/compact.mdx similarity index 100% rename from website/docs/language/functions/compact.mdx rename to website/docs/language/reference/functions/compact.mdx diff --git a/website/docs/language/functions/concat.mdx b/website/docs/language/reference/functions/concat.mdx similarity index 100% rename from website/docs/language/functions/concat.mdx rename to website/docs/language/reference/functions/concat.mdx diff --git a/website/docs/language/functions/contains.mdx b/website/docs/language/reference/functions/contains.mdx similarity index 100% rename from website/docs/language/functions/contains.mdx rename to website/docs/language/reference/functions/contains.mdx diff --git a/website/docs/language/functions/csvdecode.mdx b/website/docs/language/reference/functions/csvdecode.mdx similarity index 100% rename from website/docs/language/functions/csvdecode.mdx rename to website/docs/language/reference/functions/csvdecode.mdx diff --git a/website/docs/language/functions/dirname.mdx b/website/docs/language/reference/functions/dirname.mdx similarity index 100% rename from website/docs/language/functions/dirname.mdx rename to website/docs/language/reference/functions/dirname.mdx diff --git a/website/docs/language/functions/distinct.mdx b/website/docs/language/reference/functions/distinct.mdx similarity index 100% rename from website/docs/language/functions/distinct.mdx rename to website/docs/language/reference/functions/distinct.mdx diff --git a/website/docs/language/functions/element.mdx b/website/docs/language/reference/functions/element.mdx similarity index 100% rename from website/docs/language/functions/element.mdx rename to website/docs/language/reference/functions/element.mdx diff --git a/website/docs/language/functions/endswith.mdx b/website/docs/language/reference/functions/endswith.mdx similarity index 100% rename from website/docs/language/functions/endswith.mdx rename to website/docs/language/reference/functions/endswith.mdx diff --git a/website/docs/language/functions/file.mdx b/website/docs/language/reference/functions/file.mdx similarity index 100% rename from website/docs/language/functions/file.mdx rename to website/docs/language/reference/functions/file.mdx diff --git a/website/docs/language/functions/filebase64.mdx b/website/docs/language/reference/functions/filebase64.mdx similarity index 100% rename from website/docs/language/functions/filebase64.mdx rename to website/docs/language/reference/functions/filebase64.mdx diff --git a/website/docs/language/functions/filebase64sha256.mdx b/website/docs/language/reference/functions/filebase64sha256.mdx similarity index 100% rename from website/docs/language/functions/filebase64sha256.mdx rename to website/docs/language/reference/functions/filebase64sha256.mdx diff --git a/website/docs/language/functions/filebase64sha512.mdx b/website/docs/language/reference/functions/filebase64sha512.mdx similarity index 100% rename from website/docs/language/functions/filebase64sha512.mdx rename to website/docs/language/reference/functions/filebase64sha512.mdx diff --git a/website/docs/language/functions/fileexists.mdx b/website/docs/language/reference/functions/fileexists.mdx similarity index 100% rename from website/docs/language/functions/fileexists.mdx rename to website/docs/language/reference/functions/fileexists.mdx diff --git a/website/docs/language/functions/filemd5.mdx b/website/docs/language/reference/functions/filemd5.mdx similarity index 100% rename from website/docs/language/functions/filemd5.mdx rename to website/docs/language/reference/functions/filemd5.mdx diff --git a/website/docs/language/functions/fileset.mdx b/website/docs/language/reference/functions/fileset.mdx similarity index 100% rename from website/docs/language/functions/fileset.mdx rename to website/docs/language/reference/functions/fileset.mdx diff --git a/website/docs/language/functions/filesha1.mdx b/website/docs/language/reference/functions/filesha1.mdx similarity index 100% rename from website/docs/language/functions/filesha1.mdx rename to website/docs/language/reference/functions/filesha1.mdx diff --git a/website/docs/language/functions/filesha256.mdx b/website/docs/language/reference/functions/filesha256.mdx similarity index 100% rename from website/docs/language/functions/filesha256.mdx rename to website/docs/language/reference/functions/filesha256.mdx diff --git a/website/docs/language/functions/filesha512.mdx b/website/docs/language/reference/functions/filesha512.mdx similarity index 100% rename from website/docs/language/functions/filesha512.mdx rename to website/docs/language/reference/functions/filesha512.mdx diff --git a/website/docs/language/functions/flatten.mdx b/website/docs/language/reference/functions/flatten.mdx similarity index 100% rename from website/docs/language/functions/flatten.mdx rename to website/docs/language/reference/functions/flatten.mdx diff --git a/website/docs/language/functions/floor.mdx b/website/docs/language/reference/functions/floor.mdx similarity index 100% rename from website/docs/language/functions/floor.mdx rename to website/docs/language/reference/functions/floor.mdx diff --git a/website/docs/language/functions/format.mdx b/website/docs/language/reference/functions/format.mdx similarity index 100% rename from website/docs/language/functions/format.mdx rename to website/docs/language/reference/functions/format.mdx diff --git a/website/docs/language/functions/formatdate.mdx b/website/docs/language/reference/functions/formatdate.mdx similarity index 100% rename from website/docs/language/functions/formatdate.mdx rename to website/docs/language/reference/functions/formatdate.mdx diff --git a/website/docs/language/functions/formatlist.mdx b/website/docs/language/reference/functions/formatlist.mdx similarity index 100% rename from website/docs/language/functions/formatlist.mdx rename to website/docs/language/reference/functions/formatlist.mdx diff --git a/website/docs/language/functions/indent.mdx b/website/docs/language/reference/functions/indent.mdx similarity index 100% rename from website/docs/language/functions/indent.mdx rename to website/docs/language/reference/functions/indent.mdx diff --git a/website/docs/language/functions/index.mdx b/website/docs/language/reference/functions/index.mdx similarity index 100% rename from website/docs/language/functions/index.mdx rename to website/docs/language/reference/functions/index.mdx diff --git a/website/docs/language/functions/index_function.mdx b/website/docs/language/reference/functions/index_function.mdx similarity index 100% rename from website/docs/language/functions/index_function.mdx rename to website/docs/language/reference/functions/index_function.mdx diff --git a/website/docs/language/functions/issensitive.mdx b/website/docs/language/reference/functions/issensitive.mdx similarity index 100% rename from website/docs/language/functions/issensitive.mdx rename to website/docs/language/reference/functions/issensitive.mdx diff --git a/website/docs/language/functions/join.mdx b/website/docs/language/reference/functions/join.mdx similarity index 100% rename from website/docs/language/functions/join.mdx rename to website/docs/language/reference/functions/join.mdx diff --git a/website/docs/language/functions/jsondecode.mdx b/website/docs/language/reference/functions/jsondecode.mdx similarity index 100% rename from website/docs/language/functions/jsondecode.mdx rename to website/docs/language/reference/functions/jsondecode.mdx diff --git a/website/docs/language/functions/jsonencode.mdx b/website/docs/language/reference/functions/jsonencode.mdx similarity index 100% rename from website/docs/language/functions/jsonencode.mdx rename to website/docs/language/reference/functions/jsonencode.mdx diff --git a/website/docs/language/functions/keys.mdx b/website/docs/language/reference/functions/keys.mdx similarity index 100% rename from website/docs/language/functions/keys.mdx rename to website/docs/language/reference/functions/keys.mdx diff --git a/website/docs/language/functions/length.mdx b/website/docs/language/reference/functions/length.mdx similarity index 100% rename from website/docs/language/functions/length.mdx rename to website/docs/language/reference/functions/length.mdx diff --git a/website/docs/language/functions/list.mdx b/website/docs/language/reference/functions/list.mdx similarity index 100% rename from website/docs/language/functions/list.mdx rename to website/docs/language/reference/functions/list.mdx diff --git a/website/docs/language/functions/log.mdx b/website/docs/language/reference/functions/log.mdx similarity index 100% rename from website/docs/language/functions/log.mdx rename to website/docs/language/reference/functions/log.mdx diff --git a/website/docs/language/functions/lookup.mdx b/website/docs/language/reference/functions/lookup.mdx similarity index 100% rename from website/docs/language/functions/lookup.mdx rename to website/docs/language/reference/functions/lookup.mdx diff --git a/website/docs/language/functions/lower.mdx b/website/docs/language/reference/functions/lower.mdx similarity index 100% rename from website/docs/language/functions/lower.mdx rename to website/docs/language/reference/functions/lower.mdx diff --git a/website/docs/language/functions/map.mdx b/website/docs/language/reference/functions/map.mdx similarity index 100% rename from website/docs/language/functions/map.mdx rename to website/docs/language/reference/functions/map.mdx diff --git a/website/docs/language/functions/matchkeys.mdx b/website/docs/language/reference/functions/matchkeys.mdx similarity index 100% rename from website/docs/language/functions/matchkeys.mdx rename to website/docs/language/reference/functions/matchkeys.mdx diff --git a/website/docs/language/functions/max.mdx b/website/docs/language/reference/functions/max.mdx similarity index 100% rename from website/docs/language/functions/max.mdx rename to website/docs/language/reference/functions/max.mdx diff --git a/website/docs/language/functions/md5.mdx b/website/docs/language/reference/functions/md5.mdx similarity index 100% rename from website/docs/language/functions/md5.mdx rename to website/docs/language/reference/functions/md5.mdx diff --git a/website/docs/language/functions/merge.mdx b/website/docs/language/reference/functions/merge.mdx similarity index 100% rename from website/docs/language/functions/merge.mdx rename to website/docs/language/reference/functions/merge.mdx diff --git a/website/docs/language/functions/min.mdx b/website/docs/language/reference/functions/min.mdx similarity index 100% rename from website/docs/language/functions/min.mdx rename to website/docs/language/reference/functions/min.mdx diff --git a/website/docs/language/functions/nonsensitive.mdx b/website/docs/language/reference/functions/nonsensitive.mdx similarity index 100% rename from website/docs/language/functions/nonsensitive.mdx rename to website/docs/language/reference/functions/nonsensitive.mdx diff --git a/website/docs/language/functions/one.mdx b/website/docs/language/reference/functions/one.mdx similarity index 100% rename from website/docs/language/functions/one.mdx rename to website/docs/language/reference/functions/one.mdx diff --git a/website/docs/language/functions/parseint.mdx b/website/docs/language/reference/functions/parseint.mdx similarity index 100% rename from website/docs/language/functions/parseint.mdx rename to website/docs/language/reference/functions/parseint.mdx diff --git a/website/docs/language/functions/pathexpand.mdx b/website/docs/language/reference/functions/pathexpand.mdx similarity index 100% rename from website/docs/language/functions/pathexpand.mdx rename to website/docs/language/reference/functions/pathexpand.mdx diff --git a/website/docs/language/functions/plantimestamp.mdx b/website/docs/language/reference/functions/plantimestamp.mdx similarity index 100% rename from website/docs/language/functions/plantimestamp.mdx rename to website/docs/language/reference/functions/plantimestamp.mdx diff --git a/website/docs/language/functions/pow.mdx b/website/docs/language/reference/functions/pow.mdx similarity index 100% rename from website/docs/language/functions/pow.mdx rename to website/docs/language/reference/functions/pow.mdx diff --git a/website/docs/language/functions/range.mdx b/website/docs/language/reference/functions/range.mdx similarity index 100% rename from website/docs/language/functions/range.mdx rename to website/docs/language/reference/functions/range.mdx diff --git a/website/docs/language/functions/regex.mdx b/website/docs/language/reference/functions/regex.mdx similarity index 100% rename from website/docs/language/functions/regex.mdx rename to website/docs/language/reference/functions/regex.mdx diff --git a/website/docs/language/functions/regexall.mdx b/website/docs/language/reference/functions/regexall.mdx similarity index 100% rename from website/docs/language/functions/regexall.mdx rename to website/docs/language/reference/functions/regexall.mdx diff --git a/website/docs/language/functions/replace.mdx b/website/docs/language/reference/functions/replace.mdx similarity index 100% rename from website/docs/language/functions/replace.mdx rename to website/docs/language/reference/functions/replace.mdx diff --git a/website/docs/language/functions/reverse.mdx b/website/docs/language/reference/functions/reverse.mdx similarity index 100% rename from website/docs/language/functions/reverse.mdx rename to website/docs/language/reference/functions/reverse.mdx diff --git a/website/docs/language/functions/rsadecrypt.mdx b/website/docs/language/reference/functions/rsadecrypt.mdx similarity index 100% rename from website/docs/language/functions/rsadecrypt.mdx rename to website/docs/language/reference/functions/rsadecrypt.mdx diff --git a/website/docs/language/functions/sensitive.mdx b/website/docs/language/reference/functions/sensitive.mdx similarity index 100% rename from website/docs/language/functions/sensitive.mdx rename to website/docs/language/reference/functions/sensitive.mdx diff --git a/website/docs/language/functions/setintersection.mdx b/website/docs/language/reference/functions/setintersection.mdx similarity index 100% rename from website/docs/language/functions/setintersection.mdx rename to website/docs/language/reference/functions/setintersection.mdx diff --git a/website/docs/language/functions/setproduct.mdx b/website/docs/language/reference/functions/setproduct.mdx similarity index 100% rename from website/docs/language/functions/setproduct.mdx rename to website/docs/language/reference/functions/setproduct.mdx diff --git a/website/docs/language/functions/setsubtract.mdx b/website/docs/language/reference/functions/setsubtract.mdx similarity index 100% rename from website/docs/language/functions/setsubtract.mdx rename to website/docs/language/reference/functions/setsubtract.mdx diff --git a/website/docs/language/functions/setunion.mdx b/website/docs/language/reference/functions/setunion.mdx similarity index 100% rename from website/docs/language/functions/setunion.mdx rename to website/docs/language/reference/functions/setunion.mdx diff --git a/website/docs/language/functions/sha1.mdx b/website/docs/language/reference/functions/sha1.mdx similarity index 100% rename from website/docs/language/functions/sha1.mdx rename to website/docs/language/reference/functions/sha1.mdx diff --git a/website/docs/language/functions/sha256.mdx b/website/docs/language/reference/functions/sha256.mdx similarity index 100% rename from website/docs/language/functions/sha256.mdx rename to website/docs/language/reference/functions/sha256.mdx diff --git a/website/docs/language/functions/sha512.mdx b/website/docs/language/reference/functions/sha512.mdx similarity index 100% rename from website/docs/language/functions/sha512.mdx rename to website/docs/language/reference/functions/sha512.mdx diff --git a/website/docs/language/functions/signum.mdx b/website/docs/language/reference/functions/signum.mdx similarity index 100% rename from website/docs/language/functions/signum.mdx rename to website/docs/language/reference/functions/signum.mdx diff --git a/website/docs/language/functions/slice.mdx b/website/docs/language/reference/functions/slice.mdx similarity index 100% rename from website/docs/language/functions/slice.mdx rename to website/docs/language/reference/functions/slice.mdx diff --git a/website/docs/language/functions/sort.mdx b/website/docs/language/reference/functions/sort.mdx similarity index 100% rename from website/docs/language/functions/sort.mdx rename to website/docs/language/reference/functions/sort.mdx diff --git a/website/docs/language/functions/split.mdx b/website/docs/language/reference/functions/split.mdx similarity index 100% rename from website/docs/language/functions/split.mdx rename to website/docs/language/reference/functions/split.mdx diff --git a/website/docs/language/functions/startswith.mdx b/website/docs/language/reference/functions/startswith.mdx similarity index 100% rename from website/docs/language/functions/startswith.mdx rename to website/docs/language/reference/functions/startswith.mdx diff --git a/website/docs/language/functions/strcontains.mdx b/website/docs/language/reference/functions/strcontains.mdx similarity index 100% rename from website/docs/language/functions/strcontains.mdx rename to website/docs/language/reference/functions/strcontains.mdx diff --git a/website/docs/language/functions/strrev.mdx b/website/docs/language/reference/functions/strrev.mdx similarity index 100% rename from website/docs/language/functions/strrev.mdx rename to website/docs/language/reference/functions/strrev.mdx diff --git a/website/docs/language/functions/substr.mdx b/website/docs/language/reference/functions/substr.mdx similarity index 100% rename from website/docs/language/functions/substr.mdx rename to website/docs/language/reference/functions/substr.mdx diff --git a/website/docs/language/functions/sum.mdx b/website/docs/language/reference/functions/sum.mdx similarity index 100% rename from website/docs/language/functions/sum.mdx rename to website/docs/language/reference/functions/sum.mdx diff --git a/website/docs/language/functions/templatefile.mdx b/website/docs/language/reference/functions/templatefile.mdx similarity index 100% rename from website/docs/language/functions/templatefile.mdx rename to website/docs/language/reference/functions/templatefile.mdx diff --git a/website/docs/language/functions/templatestring.mdx b/website/docs/language/reference/functions/templatestring.mdx similarity index 100% rename from website/docs/language/functions/templatestring.mdx rename to website/docs/language/reference/functions/templatestring.mdx diff --git a/website/docs/language/functions/terraform-decode_tfvars.mdx b/website/docs/language/reference/functions/terraform-decode_tfvars.mdx similarity index 100% rename from website/docs/language/functions/terraform-decode_tfvars.mdx rename to website/docs/language/reference/functions/terraform-decode_tfvars.mdx diff --git a/website/docs/language/functions/terraform-encode_expr.mdx b/website/docs/language/reference/functions/terraform-encode_expr.mdx similarity index 100% rename from website/docs/language/functions/terraform-encode_expr.mdx rename to website/docs/language/reference/functions/terraform-encode_expr.mdx diff --git a/website/docs/language/functions/terraform-encode_tfvars.mdx b/website/docs/language/reference/functions/terraform-encode_tfvars.mdx similarity index 100% rename from website/docs/language/functions/terraform-encode_tfvars.mdx rename to website/docs/language/reference/functions/terraform-encode_tfvars.mdx diff --git a/website/docs/language/functions/textdecodebase64.mdx b/website/docs/language/reference/functions/textdecodebase64.mdx similarity index 100% rename from website/docs/language/functions/textdecodebase64.mdx rename to website/docs/language/reference/functions/textdecodebase64.mdx diff --git a/website/docs/language/functions/textencodebase64.mdx b/website/docs/language/reference/functions/textencodebase64.mdx similarity index 100% rename from website/docs/language/functions/textencodebase64.mdx rename to website/docs/language/reference/functions/textencodebase64.mdx diff --git a/website/docs/language/functions/timeadd.mdx b/website/docs/language/reference/functions/timeadd.mdx similarity index 100% rename from website/docs/language/functions/timeadd.mdx rename to website/docs/language/reference/functions/timeadd.mdx diff --git a/website/docs/language/functions/timecmp.mdx b/website/docs/language/reference/functions/timecmp.mdx similarity index 100% rename from website/docs/language/functions/timecmp.mdx rename to website/docs/language/reference/functions/timecmp.mdx diff --git a/website/docs/language/functions/timestamp.mdx b/website/docs/language/reference/functions/timestamp.mdx similarity index 100% rename from website/docs/language/functions/timestamp.mdx rename to website/docs/language/reference/functions/timestamp.mdx diff --git a/website/docs/language/functions/title.mdx b/website/docs/language/reference/functions/title.mdx similarity index 100% rename from website/docs/language/functions/title.mdx rename to website/docs/language/reference/functions/title.mdx diff --git a/website/docs/language/functions/tobool.mdx b/website/docs/language/reference/functions/tobool.mdx similarity index 100% rename from website/docs/language/functions/tobool.mdx rename to website/docs/language/reference/functions/tobool.mdx diff --git a/website/docs/language/functions/tolist.mdx b/website/docs/language/reference/functions/tolist.mdx similarity index 100% rename from website/docs/language/functions/tolist.mdx rename to website/docs/language/reference/functions/tolist.mdx diff --git a/website/docs/language/functions/tomap.mdx b/website/docs/language/reference/functions/tomap.mdx similarity index 100% rename from website/docs/language/functions/tomap.mdx rename to website/docs/language/reference/functions/tomap.mdx diff --git a/website/docs/language/functions/tonumber.mdx b/website/docs/language/reference/functions/tonumber.mdx similarity index 100% rename from website/docs/language/functions/tonumber.mdx rename to website/docs/language/reference/functions/tonumber.mdx diff --git a/website/docs/language/functions/toset.mdx b/website/docs/language/reference/functions/toset.mdx similarity index 100% rename from website/docs/language/functions/toset.mdx rename to website/docs/language/reference/functions/toset.mdx diff --git a/website/docs/language/functions/tostring.mdx b/website/docs/language/reference/functions/tostring.mdx similarity index 100% rename from website/docs/language/functions/tostring.mdx rename to website/docs/language/reference/functions/tostring.mdx diff --git a/website/docs/language/functions/transpose.mdx b/website/docs/language/reference/functions/transpose.mdx similarity index 100% rename from website/docs/language/functions/transpose.mdx rename to website/docs/language/reference/functions/transpose.mdx diff --git a/website/docs/language/functions/trim.mdx b/website/docs/language/reference/functions/trim.mdx similarity index 100% rename from website/docs/language/functions/trim.mdx rename to website/docs/language/reference/functions/trim.mdx diff --git a/website/docs/language/functions/trimprefix.mdx b/website/docs/language/reference/functions/trimprefix.mdx similarity index 100% rename from website/docs/language/functions/trimprefix.mdx rename to website/docs/language/reference/functions/trimprefix.mdx diff --git a/website/docs/language/functions/trimspace.mdx b/website/docs/language/reference/functions/trimspace.mdx similarity index 100% rename from website/docs/language/functions/trimspace.mdx rename to website/docs/language/reference/functions/trimspace.mdx diff --git a/website/docs/language/functions/trimsuffix.mdx b/website/docs/language/reference/functions/trimsuffix.mdx similarity index 100% rename from website/docs/language/functions/trimsuffix.mdx rename to website/docs/language/reference/functions/trimsuffix.mdx diff --git a/website/docs/language/functions/try.mdx b/website/docs/language/reference/functions/try.mdx similarity index 100% rename from website/docs/language/functions/try.mdx rename to website/docs/language/reference/functions/try.mdx diff --git a/website/docs/language/functions/type.mdx b/website/docs/language/reference/functions/type.mdx similarity index 100% rename from website/docs/language/functions/type.mdx rename to website/docs/language/reference/functions/type.mdx diff --git a/website/docs/language/functions/upper.mdx b/website/docs/language/reference/functions/upper.mdx similarity index 100% rename from website/docs/language/functions/upper.mdx rename to website/docs/language/reference/functions/upper.mdx diff --git a/website/docs/language/functions/urlencode.mdx b/website/docs/language/reference/functions/urlencode.mdx similarity index 100% rename from website/docs/language/functions/urlencode.mdx rename to website/docs/language/reference/functions/urlencode.mdx diff --git a/website/docs/language/functions/uuid.mdx b/website/docs/language/reference/functions/uuid.mdx similarity index 100% rename from website/docs/language/functions/uuid.mdx rename to website/docs/language/reference/functions/uuid.mdx diff --git a/website/docs/language/functions/uuidv5.mdx b/website/docs/language/reference/functions/uuidv5.mdx similarity index 100% rename from website/docs/language/functions/uuidv5.mdx rename to website/docs/language/reference/functions/uuidv5.mdx diff --git a/website/docs/language/functions/values.mdx b/website/docs/language/reference/functions/values.mdx similarity index 100% rename from website/docs/language/functions/values.mdx rename to website/docs/language/reference/functions/values.mdx diff --git a/website/docs/language/functions/yamldecode.mdx b/website/docs/language/reference/functions/yamldecode.mdx similarity index 100% rename from website/docs/language/functions/yamldecode.mdx rename to website/docs/language/reference/functions/yamldecode.mdx diff --git a/website/docs/language/functions/yamlencode.mdx b/website/docs/language/reference/functions/yamlencode.mdx similarity index 100% rename from website/docs/language/functions/yamlencode.mdx rename to website/docs/language/reference/functions/yamlencode.mdx diff --git a/website/docs/language/functions/zipmap.mdx b/website/docs/language/reference/functions/zipmap.mdx similarity index 100% rename from website/docs/language/functions/zipmap.mdx rename to website/docs/language/reference/functions/zipmap.mdx diff --git a/website/docs/language/meta-arguments/count.mdx b/website/docs/language/reference/meta-arguments/count.mdx similarity index 100% rename from website/docs/language/meta-arguments/count.mdx rename to website/docs/language/reference/meta-arguments/count.mdx diff --git a/website/docs/language/meta-arguments/depends_on.mdx b/website/docs/language/reference/meta-arguments/depends_on.mdx similarity index 100% rename from website/docs/language/meta-arguments/depends_on.mdx rename to website/docs/language/reference/meta-arguments/depends_on.mdx diff --git a/website/docs/language/meta-arguments/for_each.mdx b/website/docs/language/reference/meta-arguments/for_each.mdx similarity index 100% rename from website/docs/language/meta-arguments/for_each.mdx rename to website/docs/language/reference/meta-arguments/for_each.mdx diff --git a/website/docs/language/meta-arguments/lifecycle.mdx b/website/docs/language/reference/meta-arguments/lifecycle.mdx similarity index 100% rename from website/docs/language/meta-arguments/lifecycle.mdx rename to website/docs/language/reference/meta-arguments/lifecycle.mdx diff --git a/website/docs/language/meta-arguments/module-providers.mdx b/website/docs/language/reference/meta-arguments/module-providers.mdx similarity index 100% rename from website/docs/language/meta-arguments/module-providers.mdx rename to website/docs/language/reference/meta-arguments/module-providers.mdx diff --git a/website/docs/language/meta-arguments/resource-provider.mdx b/website/docs/language/reference/meta-arguments/resource-provider.mdx similarity index 100% rename from website/docs/language/meta-arguments/resource-provider.mdx rename to website/docs/language/reference/meta-arguments/resource-provider.mdx diff --git a/website/docs/language/reference/module/index.mdx b/website/docs/language/reference/module/index.mdx new file mode 100644 index 000000000000..e23e26ada9bf --- /dev/null +++ b/website/docs/language/reference/module/index.mdx @@ -0,0 +1,221 @@ +--- +page_title: Modules - Configuration Language +description: >- + Modules are containers for multiple resources that are used together in + configurations. Learn how to call one module from another and access module + output. +--- + +# Module Blocks + +> **Hands-on:** Try the [Reuse Configuration with Modules](/terraform/tutorials/modules?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. + +A _module_ is a container for multiple resources that are used together. + +Every Terraform configuration has at least one module, known as its +_root module_, which consists of the resources defined in the `.tf` files in +the main working directory. + +A module can call other modules, which lets you include the child module's +resources into the configuration in a concise way. Modules +can also be called multiple times, either within the same configuration or +in separate configurations, allowing resource configurations to be packaged +and re-used. + +This page describes how to call one module from another. For more information +about creating re-usable child modules, see [Module Development](/terraform/language/modules/develop). + +## Calling a Child Module + +To _call_ a module means to include the contents of that module into the +configuration with specific values for its +[input variables](/terraform/language/values/variables). Modules are called +from within other modules using `module` blocks: + +```hcl +module "servers" { + source = "./app-cluster" + + servers = 5 +} +``` + +A module that includes a `module` block like this is the _calling module_ of the +child module. + +The label immediately after the `module` keyword is a local name, which the +calling module can use to refer to this instance of the module. + +Within the block body (between `{` and `}`) are the arguments for the module. +Module calls use the following kinds of arguments: + +- The `source` argument is mandatory for all modules. + +- The `version` argument is recommended for modules from a registry. + +- Most other arguments correspond to [input variables](/terraform/language/values/variables) + defined by the module. (The `servers` argument in the example above is one of + these.) + +- Terraform defines a few other meta-arguments that can be used with all + modules, including `for_each` and `depends_on`. + +### Source + +All modules **require** a `source` argument, which is a meta-argument defined by +Terraform. Its value is either the path to a local directory containing the +module's configuration files, or a remote module source that Terraform should +download and use. This value must be a literal string with no template +sequences; arbitrary expressions are not allowed. For more information on +possible values for this argument, see [Module Sources](/terraform/language/modules/sources). + +The same source address can be specified in multiple `module` blocks to create +multiple copies of the resources defined within, possibly with different +variable values. + +After adding, removing, or modifying `module` blocks, you must re-run +`terraform init` to allow Terraform the opportunity to adjust the installed +modules. By default this command will not upgrade an already-installed module; +use the `-upgrade` option to instead upgrade to the newest available version. + +### Version + +When using modules installed from a module registry, we recommend explicitly +constraining the acceptable version numbers to avoid unexpected or unwanted +changes. + +Use the `version` argument in the `module` block to specify versions: + +```shell +module "consul" { + source = "hashicorp/consul/aws" + version = "0.0.5" + + servers = 3 +} +``` + +The `version` argument accepts a [version constraint string](/terraform/language/expressions/version-constraints). +Terraform will use the newest installed version of the module that meets the +constraint; if no acceptable versions are installed, it will download the newest +version that meets the constraint. + +Version constraints are supported only for modules installed from a module +registry, such as the public [Terraform Registry](https://registry.terraform.io/) +or [HCP Terraform's private module registry](/terraform/cloud-docs/registry). +Other module sources can provide their own versioning mechanisms within the +source string itself, or might not support versions at all. In particular, +modules sourced from local file paths do not support `version`; since +they're loaded from the same source repository, they always share the same +version as their caller. + +### Meta-arguments + +Along with `source` and `version`, Terraform defines a few more +optional meta-arguments that have special meaning across all modules, +described in more detail in the following pages: + +- `count` - Creates multiple instances of a module from a single `module` block. + See [the `count` page](/terraform/language/meta-arguments/count) + for details. + +- `for_each` - Creates multiple instances of a module from a single `module` + block. See + [the `for_each` page](/terraform/language/meta-arguments/for_each) + for details. + +- `providers` - Passes provider configurations to a child module. See + [the `providers` page](/terraform/language/meta-arguments/module-providers) + for details. If not specified, the child module inherits all of the default + (un-aliased) provider configurations from the calling module. + +- `depends_on` - Creates explicit dependencies between the entire + module and the listed targets. See + [the `depends_on` page](/terraform/language/meta-arguments/depends_on) + for details. + +Terraform does not use the `lifecycle` argument. However, the `lifecycle` block is reserved for future versions. + +## Accessing Module Output Values + +The resources defined in a module are encapsulated, so the calling module +cannot access their attributes directly. However, the child module can +declare [output values](/terraform/language/values/outputs) to selectively +export certain values to be accessed by the calling module. + +For example, if the `./app-cluster` module referenced in the example above +exported an output value named `instance_ids` then the calling module +can reference that result using the expression `module.servers.instance_ids`: + +```hcl +resource "aws_elb" "example" { + # ... + + instances = module.servers.instance_ids +} +``` + +For more information about referring to named values, see +[Expressions](/terraform/language/expressions). + +## Transferring Resource State Into Modules + +Moving `resource` blocks from one module into several child modules causes +Terraform to see the new location as an entirely different resource. As a +result, Terraform plans to destroy all resource instances at the old address +and create new instances at the new address. + +To preserve existing objects, you can use +[refactoring blocks](/terraform/language/modules/develop/refactoring) to record the old and new +addresses for each resource instance. This directs Terraform to treat existing +objects at the old addresses as if they had originally been created at the +corresponding new addresses. + +## Replacing resources within a module + +You may have an object that needs to be replaced with a new object for a reason +that isn't automatically visible to Terraform, such as if a particular virtual +machine is running on degraded underlying hardware. In this case, you can use +[the `-replace=...` planning option](/terraform/cli/commands/plan#replace-address) +to force Terraform to propose replacing that object. + +If the object belongs to a resource within a nested module, specify the full +path to that resource including all of the nested module steps leading to it. +For example: + +```shellsession +$ terraform plan -replace=module.example.aws_instance.example +``` + +The above selects a `resource "aws_instance" "example"` declared inside a +`module "example"` child module declared inside your root module. + +Because replacing is a very disruptive action, Terraform only allows selecting +individual resource instances. There is no syntax to force replacing _all_ +resource instances belonging to a particular module. + +## Removing Modules + +-> **Note:** The `removed` block is available in Terraform v1.7 and later. For earlier Terraform versions, you can use the [`terraform state rm` CLI command](/terraform/cli/commands/state/rm) as a separate step. + +To remove a module from Terraform, simply delete the module call from your Terraform configuration. + +By default, after you remove the `module` block, Terraform will plan to destroy any resources it is managing that were declared in that module. This is because when you remove the module call, that module's configuration is no longer included in your Terraform configuration. + +Sometimes you may wish to remove a module from your Terraform configuration without destroying the real infrastructure objects it manages. In this case, the resources will be removed from the [Terraform state](/terraform/language/state), but the real infrastructure objects will not be destroyed. + +To declare that a module was removed from Terraform configuration but that its managed objects should not be destroyed, remove the `module` block from your configuration and replace it with a `removed` block: + +```hcl +removed { + from = module.example + + lifecycle { + destroy = false + } +} +``` + +The `from` argument is the address of the module you want to remove, without any instance keys (such as "module.example[1]"). + +The `lifecycle` block is required. The `destroy` argument determines whether Terraform will attempt to destroy the objects managed by the module or not. A value of `false` means that Terraform will remove the resources from state without destroying them. diff --git a/website/docs/language/modules/sources.mdx b/website/docs/language/reference/module/source.mdx similarity index 100% rename from website/docs/language/modules/sources.mdx rename to website/docs/language/reference/module/source.mdx diff --git a/website/docs/language/moved.mdx b/website/docs/language/reference/moved.mdx similarity index 100% rename from website/docs/language/moved.mdx rename to website/docs/language/reference/moved.mdx diff --git a/website/docs/language/providers/configuration.mdx b/website/docs/language/reference/providers.mdx similarity index 100% rename from website/docs/language/providers/configuration.mdx rename to website/docs/language/reference/providers.mdx diff --git a/website/docs/language/resources/provisioners/connection.mdx b/website/docs/language/reference/provisioners/connection.mdx similarity index 100% rename from website/docs/language/resources/provisioners/connection.mdx rename to website/docs/language/reference/provisioners/connection.mdx diff --git a/website/docs/language/resources/provisioners/file.mdx b/website/docs/language/reference/provisioners/file.mdx similarity index 100% rename from website/docs/language/resources/provisioners/file.mdx rename to website/docs/language/reference/provisioners/file.mdx diff --git a/website/docs/language/resources/provisioners/local-exec.mdx b/website/docs/language/reference/provisioners/local-exec.mdx similarity index 100% rename from website/docs/language/resources/provisioners/local-exec.mdx rename to website/docs/language/reference/provisioners/local-exec.mdx diff --git a/website/docs/language/resources/provisioners/remote-exec.mdx b/website/docs/language/reference/provisioners/remote-exec.mdx similarity index 100% rename from website/docs/language/resources/provisioners/remote-exec.mdx rename to website/docs/language/reference/provisioners/remote-exec.mdx diff --git a/website/docs/language/state/remote-state-data.mdx b/website/docs/language/reference/remote-state-data.mdx similarity index 100% rename from website/docs/language/state/remote-state-data.mdx rename to website/docs/language/reference/remote-state-data.mdx diff --git a/website/docs/language/resources/syntax.mdx b/website/docs/language/reference/resource.mdx similarity index 100% rename from website/docs/language/resources/syntax.mdx rename to website/docs/language/reference/resource.mdx diff --git a/website/docs/language/resources/terraform-data.mdx b/website/docs/language/reference/terraform-data.mdx similarity index 100% rename from website/docs/language/resources/terraform-data.mdx rename to website/docs/language/reference/terraform-data.mdx diff --git a/website/docs/language/settings/index.mdx b/website/docs/language/reference/terraform.mdx similarity index 100% rename from website/docs/language/settings/index.mdx rename to website/docs/language/reference/terraform.mdx diff --git a/website/docs/language/tests/index.mdx b/website/docs/language/reference/test/index.mdx similarity index 100% rename from website/docs/language/tests/index.mdx rename to website/docs/language/reference/test/index.mdx diff --git a/website/docs/language/tests/mocking.mdx b/website/docs/language/reference/test/mock.mdx similarity index 100% rename from website/docs/language/tests/mocking.mdx rename to website/docs/language/reference/test/mock.mdx diff --git a/website/docs/language/resource.mdx b/website/docs/language/resource.mdx new file mode 100644 index 000000000000..dad0a638706f --- /dev/null +++ b/website/docs/language/resource.mdx @@ -0,0 +1,236 @@ +--- +page_title: Resources Overview - Configuration Language +description: >- + Resources describe infrastructure objects in Terraform configurations. Find + documentation for resource syntax, behavior, and meta-arguments. +--- + +# Resources + +PLACEHOLDER (Combined with [syntax](https://developer.hashicorp.com/terraform/language/resources/syntax) page) + +I also duplicated syntax and moved it into the reference docs since it contains a bunch of reference information. Similar to the provider docs, I recommend moving the [resource behavior](https://developer.hashicorp.com/terraform/language/resources/behavior) to the `/intro` docs and making it a general resource concept page. + +> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. + +_Resources_ are the most important element in the Terraform language. +Each resource block describes one or more infrastructure objects, such +as virtual networks, compute instances, or higher-level components such +as DNS records. + +- [Resource Blocks](/terraform/language/resources/syntax) documents + the syntax for declaring resources. + +- [Resource Behavior](/terraform/language/resources/behavior) explains in + more detail how Terraform handles resource declarations when applying a + configuration. + +- The Meta-Arguments section documents special arguments that can be used with + every resource type, including + [`depends_on`](/terraform/language/meta-arguments/depends_on), + [`count`](/terraform/language/meta-arguments/count), + [`for_each`](/terraform/language/meta-arguments/for_each), + [`provider`](/terraform/language/meta-arguments/resource-provider), + and [`lifecycle`](/terraform/language/meta-arguments/lifecycle). + +- [Provisioners](/terraform/language/resources/provisioners/syntax) + documents configuring post-creation actions for a resource using the + `provisioner` and `connection` blocks. Since provisioners are non-declarative + and potentially unpredictable, we strongly recommend that you treat them as a + last resort. + + +## Resource Syntax + +A `resource` block declares a resource of a specific type +with a specific local name. Terraform uses the name when referring to the resource +in the same module, but it has no meaning outside that module's scope. + +In the following example, the `aws_instance` resource type is named `web`. The resource type and name must be unique within a module because they serve as an identifier for a given resource. + +```hcl +resource "aws_instance" "web" { + ami = "ami-a1b2c3d4" + instance_type = "t2.micro" +} +``` + +Within the block body (between `{` and `}`) are the configuration arguments +for the resource itself. The arguments often depend on the +resource type. In this example, both `ami` and `instance_type` are special +arguments for [the `aws_instance` resource type](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/instance). + +-> **Note:** Resource names must start with a letter or underscore, and may +contain only letters, digits, underscores, and dashes. + +Resource declarations can include more advanced features, such as single +resource declarations that produce multiple similar remote objects, but only +a small subset is required for initial use. + +## Resource Types + +Each resource is associated with a single _resource type_, which determines +the kind of infrastructure object it manages and what arguments and other +attributes the resource supports. + +### Providers + +A [provider](/terraform/language/providers/requirements) is a plugin for Terraform +that offers a collection of resource types. Each resource type is implemented by a provider. A +provider provides resources to manage a single cloud or on-premises +infrastructure platform. Providers are distributed separately from Terraform, +but Terraform can automatically install most providers when initializing +a working directory. + +To manage resources, a Terraform module must specify the required providers. Refer to +[Provider Requirements](/terraform/language/providers/requirements) for additional information. + +Most providers need some configuration to access their remote API, +which is provided by the root module. Refer to +[Provider Configuration](/terraform/language/providers/configuration) for additional information. + +Based on a resource type's name, Terraform can usually determine which provider to use. +By convention, resource type names start with their provider's preferred local name. +When using multiple configurations of a provider or non-preferred local provider names, +you must use [the `provider` meta-argument](/terraform/language/meta-arguments/resource-provider) +to manually choose a provider configuration. + +### Resource Arguments + +Most of the arguments within the body of a `resource` block are specific to the +selected resource type. The resource type's documentation lists which arguments +are available and how their values should be formatted. + +The values for resource arguments can make full use of +[expressions](/terraform/language/expressions) and other dynamic Terraform +language features. + +[Meta-arguments](#meta-arguments) are defined by Terraform +and apply across all resource types. + +### Documentation for Resource Types + +Every Terraform provider has its own documentation, describing its resource +types and their arguments. + +Some provider documentation is still part of Terraform's core documentation, +but the [Terraform Registry](https://registry.terraform.io/browse/providers) +is the main home for all publicly available provider docs. + +When viewing a provider's page on the Terraform +Registry, you can click the **Documentation** link in the header to browse its +documentation. The documentation is versioned. To choose a different version of the provider documentation, click on the version in the provider breadcrumbs to choose a version from the drop-down menu. + +## Meta-Arguments + +The Terraform language defines the following meta-arguments, which can be used with +any resource type to change the behavior of resources: + +- [`depends_on`, for specifying hidden dependencies](/terraform/language/meta-arguments/depends_on) +- [`count`, for creating multiple resource instances according to a count](/terraform/language/meta-arguments/count) +- [`for_each`, to create multiple instances according to a map, or set of strings](/terraform/language/meta-arguments/for_each) +- [`provider`, for selecting a non-default provider configuration](/terraform/language/meta-arguments/resource-provider) +- [`lifecycle`, for lifecycle customizations](/terraform/language/meta-arguments/lifecycle) +- [`provisioner`, for taking extra actions after resource creation](/terraform/language/resources/provisioners/syntax) + +## Removing Resources + +-> **Note:** The `removed` block is available in Terraform v1.7 and later. For earlier Terraform versions, you can use the [`terraform state rm` CLI command](/terraform/cli/commands/state/rm) as a separate step. + +To remove a resource from Terraform, simply delete the `resource` block from your Terraform configuration. + +By default, after you remove the `resource` block, Terraform will plan to destroy any real infrastructure object managed by that resource. + +Sometimes you may wish to remove a resource from your Terraform configuration without destroying the real infrastructure object it manages. In this case, the resource will be removed from the [Terraform state](/terraform/language/state), but the real infrastructure object will not be destroyed. + +To declare that a resource was removed from Terraform configuration but that its managed object should not be destroyed, remove the `resource` block from your configuration and replace it with a `removed` block: + +```hcl +removed { + from = aws_instance.example + + lifecycle { + destroy = false + } +} +``` + +The `from` argument is the address of the resource you want to remove, without any instance keys (such as "aws_instance.example[1]"). + +The `lifecycle` block is required. The `destroy` argument determines whether Terraform will attempt to destroy the object managed by the resource or not. A value of `false` means that Terraform will remove the resource from state without destroying it. + +A `removed` block may also contain a [Destroy-Time Provisioner](/terraform/language/resources/provisioners/syntax#destroy-time-provisioners), so that the provisioner can remain in the configuration even though the `resource` block has been removed. + +```hcl +removed { + from = aws_instance.example + + lifecycle { + destroy = true + } + + provisioner "local-exec" { + when = destroy + command = "echo 'Instance ${self.id} has been destroyed.'" + } +} +``` + +The same referencing rules apply as in normal destroy-time provisioners, with only `count.index`, `each.key`, and `self` allowed. The provisioner must specify `when = destroy`, and the `removed` block must use `destroy = true` in order for the provisioner to execute. + +## Custom Condition Checks + +You can use `precondition` and `postcondition` blocks to specify assumptions and guarantees about how the resource operates. The following example creates a precondition that checks whether the AMI is properly configured. + +```hcl +resource "aws_instance" "example" { + instance_type = "t2.micro" + ami = "ami-abc123" + + lifecycle { + # The AMI ID must refer to an AMI that contains an operating system + # for the `x86_64` architecture. + precondition { + condition = data.aws_ami.example.architecture == "x86_64" + error_message = "The selected AMI must be for the x86_64 architecture." + } + } +} +``` + +[Custom condition checks](/terraform/language/expressions/custom-conditions#preconditions-and-postconditions) +can help capture assumptions so that future maintainers +understand the configuration design and intent. They also return useful +information about errors earlier and in context, helping consumers to diagnose +issues in their configuration. + +## Operation Timeouts + +Some resource types provide a special `timeouts` nested block argument that +allows you to customize how long certain operations are allowed to take +before being considered to have failed. +For example, [`aws_db_instance`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/db_instance) +allows configurable timeouts for `create`, `update`, and `delete` operations. + +Timeouts are handled entirely by the resource type implementation in the +provider, but resource types offering these features follow the convention +of defining a child block called `timeouts` that has a nested argument +named after each operation that has a configurable timeout value. +Each of these arguments takes a string representation of a duration, such +as `"60m"` for 60 minutes, `"10s"` for ten seconds, or `"2h"` for two hours. + +```hcl +resource "aws_db_instance" "example" { + # ... + + timeouts { + create = "60m" + delete = "2h" + } +} +``` + +The set of configurable operations is chosen by each resource type. Most +resource types do not support the `timeouts` block at all. Consult the +documentation for each resource type to see which operations it offers +for configuration, if any. diff --git a/website/docs/language/resources/behavior.mdx b/website/docs/language/resources/behavior.mdx deleted file mode 100644 index c65de9d1f45f..000000000000 --- a/website/docs/language/resources/behavior.mdx +++ /dev/null @@ -1,111 +0,0 @@ ---- -page_title: Resource Behavior - Configuration Language -description: >- - Learn how Terraform uses resource blocks to create infrastructure objects. - Also learn about resource dependencies and how to access resource attributes. ---- - -# Resource Behavior - -A `resource` block declares that you want a particular infrastructure object -to exist with the given settings. If you are writing a new configuration for -the first time, the resources it defines will exist _only_ in the configuration, -and will not yet represent real infrastructure objects in the target platform. - -_Applying_ a Terraform configuration is the process of creating, updating, -and destroying real infrastructure objects in order to make their settings -match the configuration. - -## How Terraform Applies a Configuration - -When Terraform creates a new infrastructure object represented by a `resource` -block, the identifier for that real object is saved in Terraform's -[state](/terraform/language/state), allowing it to be updated and destroyed -in response to future changes. For resource blocks that already have an -associated infrastructure object in the state, Terraform compares the -actual configuration of the object with the arguments given in the -configuration and, if necessary, updates the object to match the configuration. - -In summary, applying a Terraform configuration will: - -- _Create_ resources that exist in the configuration but are not associated with a real infrastructure object in the state. -- _Destroy_ resources that exist in the state but no longer exist in the configuration. -- _Update in-place_ resources whose arguments have changed. -- _Destroy and re-create_ resources whose arguments have changed but which cannot be updated in-place due to remote API limitations. - -This general behavior applies for all resources, regardless of type. The -details of what it means to create, update, or destroy a resource are different -for each resource type, but this standard set of verbs is common across them -all. - -The meta-arguments within `resource` blocks, documented in the -sections below, allow some details of this standard resource behavior to be -customized on a per-resource basis. - -## Accessing Resource Attributes - -[Expressions](/terraform/language/expressions) within a Terraform module can access -information about resources in the same module, and you can use that information -to help configure other resources. Use the `..` -syntax to reference a resource attribute in an expression. - -In addition to arguments specified in the configuration, resources often provide -read-only attributes with information obtained from the remote API; this often -includes things that can't be known until the resource is created, like the -resource's unique random ID. - -Many providers also include [data sources](/terraform/language/data-sources), -which are a special type of resource used only for looking up information. - -For a list of the attributes a resource or data source type provides, consult -its documentation; these are generally included in a second list below its list -of configurable arguments. - -For more information about referencing resource attributes in expressions, see -[Expressions: References to Resource Attributes](/terraform/language/expressions/references#references-to-resource-attributes). - -## Resource Dependencies - -Most resources in a configuration don't have any particular relationship, and -Terraform can make changes to several unrelated resources in parallel. - -However, some resources must be processed after other specific resources; -sometimes this is because of how the resource works, and sometimes the -resource's configuration just requires information generated by another -resource. - -Most resource dependencies are handled automatically. Terraform analyses any -[expressions](/terraform/language/expressions) within a `resource` block to find references -to other objects, and treats those references as implicit ordering requirements -when creating, updating, or destroying resources. Since most resources with -behavioral dependencies on other resources also refer to those resources' data, -it's usually not necessary to manually specify dependencies between resources. - -However, some dependencies cannot be recognized implicitly in configuration. For -example, if Terraform must manage access control policies _and_ take actions -that require those policies to be present, there is a hidden dependency between -the access policy and a resource whose creation depends on it. In these rare -cases, -[the `depends_on` meta-argument](/terraform/language/meta-arguments/depends_on) -can explicitly specify a dependency. - -You can also use the [`replace_triggered_by` meta-argument](/terraform/language/meta-arguments/lifecycle#replace_triggered_by) to add dependencies between otherwise independent resources. It forces Terraform to replace the parent resource when there is a change to a referenced resource or resource attribute. - -## Local-only Resources - -While most resource types correspond to an infrastructure object type that -is managed via a remote network API, there are certain specialized resource -types that operate only within Terraform itself, calculating some results and -saving those results in the state for future use. - -For example, local-only resource types exist for -[generating private keys](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/private_key), -[issuing self-signed TLS certificates](https://registry.terraform.io/providers/hashicorp/tls/latest/docs/resources/self_signed_cert), -and even [generating random ids](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/id). -While these resource types often have a more marginal purpose than those -managing "real" infrastructure objects, they can be useful as glue to help -connect together other resources. - -The behavior of local-only resources is the same as all other resources, but -their result data exists only within the Terraform state. "Destroying" such -a resource means only to remove it from the state, discarding its data. diff --git a/website/docs/language/resources/index.mdx b/website/docs/language/resources/index.mdx deleted file mode 100644 index 0c3d230f91d6..000000000000 --- a/website/docs/language/resources/index.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -page_title: Resources Overview - Configuration Language -description: >- - Resources describe infrastructure objects in Terraform configurations. Find - documentation for resource syntax, behavior, and meta-arguments. ---- - -# Resources - -> **Hands-on:** Try the [Terraform: Get Started](/terraform/tutorials/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS) tutorials. - -_Resources_ are the most important element in the Terraform language. -Each resource block describes one or more infrastructure objects, such -as virtual networks, compute instances, or higher-level components such -as DNS records. - -- [Resource Blocks](/terraform/language/resources/syntax) documents - the syntax for declaring resources. - -- [Resource Behavior](/terraform/language/resources/behavior) explains in - more detail how Terraform handles resource declarations when applying a - configuration. - -- The Meta-Arguments section documents special arguments that can be used with - every resource type, including - [`depends_on`](/terraform/language/meta-arguments/depends_on), - [`count`](/terraform/language/meta-arguments/count), - [`for_each`](/terraform/language/meta-arguments/for_each), - [`provider`](/terraform/language/meta-arguments/resource-provider), - and [`lifecycle`](/terraform/language/meta-arguments/lifecycle). - -- [Provisioners](/terraform/language/resources/provisioners/syntax) - documents configuring post-creation actions for a resource using the - `provisioner` and `connection` blocks. Since provisioners are non-declarative - and potentially unpredictable, we strongly recommend that you treat them as a - last resort. diff --git a/website/docs/language/resources/provisioners/null_resource.mdx b/website/docs/language/resources/provisioners/null_resource.mdx deleted file mode 100644 index b91430807b14..000000000000 --- a/website/docs/language/resources/provisioners/null_resource.mdx +++ /dev/null @@ -1,50 +0,0 @@ ---- -page_title: Provisioners Without a Resource -description: >- - A terraform_data managed resource allows you to configure provisioners that - are not directly associated with a single existing resource. ---- - -# Provisioners Without a Resource - -If you need to run provisioners that aren't directly associated with a specific -resource, you can associate them with a `terraform_data`. - -Instances of [`terraform_data`](/terraform/language/resources/terraform-data) are treated -like normal resources, but they don't do anything. Like with any other resource -type, you can configure [provisioners](/terraform/language/resources/provisioners/syntax) -and [connection details](/terraform/language/resources/provisioners/connection) on a -`terraform_data` resource. You can also use its `input` argument, `triggers_replace` argument, and any -meta-arguments to control exactly where in the dependency graph its -provisioners will run. - -~> **Important:** Use provisioners as a last resort. There are better alternatives for most situations. Refer to -[Declaring Provisioners](/terraform/language/resources/provisioners/syntax) for more details. - -## Example usage - -```hcl -resource "aws_instance" "cluster" { - count = 3 - - # ... -} - -resource "terraform_data" "cluster" { - # Replacement of any instance of the cluster requires re-provisioning - triggers_replace = aws_instance.cluster[*].id - - # Bootstrap script can run on any instance of the cluster - # So we just choose the first in this case - connection { - host = aws_instance.cluster[0].public_ip - } - - provisioner "remote-exec" { - # Bootstrap script called with private_ip of each node in the cluster - inline = [ - "bootstrap-cluster.sh ${join(" ", aws_instance.cluster[*].private_ip)}", - ] - } -} -``` diff --git a/website/docs/language/share-data-configuration.mdx b/website/docs/language/share-data-configuration.mdx new file mode 100644 index 000000000000..f0375d48b1d1 --- /dev/null +++ b/website/docs/language/share-data-configuration.mdx @@ -0,0 +1,209 @@ +--- +page_title: Share data across configurations +description: >- + Write structured test code for validating your configuration. +--- + +# Share data between configurations + +PLACEHOLDER: I removed the state section completely. I think like resources and providers, this should be a dedicated concepts section within the `/intro` section of the docs... since it applies to Terraform as a whole rather than specifically to writing Terraform configuration. + +[backends]: /terraform/language/settings/backends/configuration + +The `terraform_remote_state` data source uses the latest state snapshot from a specified state backend to retrieve the root module output values +from some other Terraform configuration. + +You can use the `terraform_remote_state` data source without requiring or configuring a provider. It is always available through a built-in provider with the [source address](/terraform/language/providers/requirements#source-addresses) `terraform.io/builtin/terraform`. That provider does not include any other resources or data sources. + +~> **Important:** We recommend using the [`tfe_outputs` data source](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/outputs) in the [HCP Terraform/Enterprise Provider](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs) to access remote state outputs in HCP Terraform or Terraform Enterprise. The `tfe_outputs` data source is more secure because it does not require full access to workspace state to fetch outputs. + +## Alternative Ways to Share Data Between Configurations + +Sharing data with root module outputs is convenient, but it has drawbacks. +Although `terraform_remote_state` only exposes output values, its user must have +access to the entire state snapshot, which often includes some sensitive +information. + +When possible, we recommend explicitly publishing data for external consumption +to a separate location instead of accessing it via remote state. This lets you +apply different access controls for shared information and state snapshots. + +To share data explicitly between configurations, you can use pairs of managed +resource types and data sources in various providers, including (but not +limited to) the following: + +| System | Publish with... | Read with... | +| ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| Alibaba Cloud DNS
(for IP addresses and hostnames) | [`alicloud_alidns_record` resource type](https://registry.terraform.io/providers/aliyun/alicloud/latest/docs/resources/alidns_record) | Normal DNS lookups, or [the `dns` provider](https://registry.terraform.io/providers/hashicorp/dns/latest/docs) | +| Amazon Route53
(for IP addresses and hostnames) | [`aws_route53_record` resource type](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | Normal DNS lookups, or [the `dns` provider](https://registry.terraform.io/providers/hashicorp/dns/latest/docs) | +| Amazon S3 | [`aws_s3_object` resource type](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/s3_object) | [`aws_s3_object` data source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/s3_object) | +| Amazon SSM Parameter Store | [`aws_ssm_parameter` resource type](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ssm_parameter) | [`aws_ssm_parameter` data source](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter) | +| Azure Automation | [`azurerm_automation_variable_string` resource type](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/automation_variable_string) | [`azurerm_automation_variable_string` data source](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/automation_variable_string) | +| Azure DNS
(for IP addresses and hostnames) | [`azurerm_dns_a_record` resource type](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/dns_a_record), etc | Normal DNS lookups, or [the `dns` provider](https://registry.terraform.io/providers/hashicorp/dns/latest/docs) | +| Google Cloud DNS
(for IP addresses and hostnames) | [`google_dns_record_set` resource type](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/dns_record_set) | Normal DNS lookups, or [the `dns` provider](https://registry.terraform.io/providers/hashicorp/dns/latest/docs) | +| Google Cloud Storage | [`google_storage_bucket_object` resource type](https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/storage_bucket_object) | [`google_storage_bucket_object` data source](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/storage_bucket_object) and [`http` data source](https://registry.terraform.io/providers/hashicorp/http/latest/docs/data-sources/http) | +| HashiCorp Consul | [`consul_key_prefix` resource type](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/resources/key_prefix) | [`consul_key_prefix` data source](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/key_prefix) | +| HashiCorp HCP Terraform | Normal `outputs` terraform block | [`tfe_outputs` data source](https://registry.terraform.io/providers/hashicorp/tfe/latest/docs/data-sources/outputs) | +| Kubernetes | [`kubernetes_config_map` resource type](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/config_map) | [`kubernetes_config_map` data source](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/data-sources/config_map) | +| OCI Object Storage | [`oci_objectstorage_bucket` resource type](https://registry.terraform.io/providers/hashicorp/oci/latest/docs/resources/objectstorage_object) | [`oci_objectstorage_bucket` data source](https://registry.terraform.io/providers/hashicorp/oci/latest/docs/data-sources/objectstorage_object) | + +-> These are some common options from the Official Terraform providers, but +there are too many configuration storage options for us to list them all +here, including some in partner and community providers. +Any pair of managed resource type and corresponding data source can potentially +be used to share data between Terraform configurations. See individual provider +documentation to find other possibilities. + +A key advantage of using a separate explicit configuration store instead of +`terraform_remote_state` is that the data can potentially also be read by +systems other than Terraform, such as configuration management or scheduler +systems within your compute instances. For that reason, we recommend selecting +a configuration store that your other infrastructure could potentially make +use of. For example: + +* If you wish to share IP addresses and hostnames, you could publish them as + normal DNS `A`, `AAAA`, `CNAME`, and `SRV` records in a private DNS zone and + then configure your other infrastructure to refer to that zone so you can + find infrastructure objects via your system's built-in DNS resolver. +* If you use HashiCorp Consul then publishing data to the Consul key/value + store or Consul service catalog can make that data also accessible via + [Consul Template](https://github.com/hashicorp/consul-template) + or the + [HashiCorp Nomad](/nomad/docs/job-specification/template) + `template` stanza. +* If you use Kubernetes then you can + [make Config Maps available to your Pods](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/). + +Some of the data stores listed above are specifically designed for storing +small configuration values, while others are generic blob storage systems. For +those generic systems, you can use +[the `jsonencode` function](/terraform/language/functions/jsonencode) +and +[the `jsondecode` function](/terraform/language/functions/jsondecode) respectively +to store and retrieve structured data. + +You can encapsulate the implementation details of retrieving your published +configuration data by writing a +[data-only module](/terraform/language/modules/develop/composition#data-only-modules) +containing the necessary data source configuration and any necessary +post-processing such as JSON decoding. You can then change that module later +if you switch to a different strategy for sharing data between multiple +Terraform configurations. + +## Example Usage (`remote` Backend) + +```hcl +data "terraform_remote_state" "vpc" { + backend = "remote" + + config = { + organization = "hashicorp" + workspaces = { + name = "vpc-prod" + } + } +} + +# Terraform >= 0.12 +resource "aws_instance" "foo" { + # ... + subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id +} + +# Terraform <= 0.11 +resource "aws_instance" "foo" { + # ... + subnet_id = "${data.terraform_remote_state.vpc.subnet_id}" +} +``` + +## Example Usage (`local` Backend) + +```hcl +data "terraform_remote_state" "vpc" { + backend = "local" + + config = { + path = "..." + } +} + +# Terraform >= 0.12 +resource "aws_instance" "foo" { + # ... + subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id +} + +# Terraform <= 0.11 +resource "aws_instance" "foo" { + # ... + subnet_id = "${data.terraform_remote_state.vpc.subnet_id}" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `backend` - (Required) The remote backend to use. +* `workspace` - (Optional) The Terraform workspace to use, if the backend + supports workspaces. +* `config` - (Optional; object) The configuration of the remote backend. + Although this argument is listed as optional, most backends require + some configuration. + + The `config` object can use any arguments that would be valid in the + equivalent `terraform { backend "" { ... } }` block. See + [the documentation of your chosen backend](/terraform/language/settings/backends/configuration) + for details. + + -> **Note:** If the backend configuration requires a nested block, specify + it here as a normal attribute with an object value. (For example, + `workspaces = { ... }` instead of `workspaces { ... }`.) +* `defaults` - (Optional; object) Default values for outputs, in case the state + file is empty or lacks a required output. + +## Attributes Reference + +In addition to the above, the following attributes are exported: + +* (v0.12+) `outputs` - An object containing every root-level + [output](/terraform/language/values/outputs) in the remote state. +* (<= v0.11) `` - Each root-level [output](/terraform/language/values/outputs) + in the remote state appears as a top level attribute on the data source. + +## Root Outputs Only + +Only the root-level output values from the remote state snapshot are exposed +for use elsewhere in your module. Resource data and output values from nested +modules are not accessible. + +If you wish to make a nested module output value accessible as a root module +output value, you must explicitly configure a passthrough in the root module. +For example: + +For example: + +```hcl +module "app" { + source = "..." +} + +output "app_value" { + # This syntax is for Terraform 0.12 or later. + value = module.app.example +} +``` + +In this example, the output value named `example` from the "app" module is +available as the `app_value` root module output value. If this configuration +didn't include the `output "app_value"` block then the data would not be +accessible via `terraform_remote_state`. + +~> **Warning:** Although `terraform_remote_state` doesn't expose any other +state snapshot information for use in configuration, the state snapshot data +is a single object and so any user or server which has enough access to read +the root module output values will also always have access to the full state +snapshot data by direct network requests. Don't use `terraform_remote_state` +if any of the resources in your configuration work with data that you consider +sensitive. diff --git a/website/docs/language/state/backends.mdx b/website/docs/language/state/backends.mdx deleted file mode 100644 index 72af00c005aa..000000000000 --- a/website/docs/language/state/backends.mdx +++ /dev/null @@ -1,72 +0,0 @@ ---- -page_title: 'Backends: State Storage and Locking' -description: >- - Backends are configured directly in Terraform files in the `terraform` - section. ---- - -# State Storage and Locking - -Backends are responsible for storing state and providing an API for -[state locking](/terraform/language/state/locking). State locking is optional. - -Despite the state being stored remotely, all Terraform commands such -as `terraform console`, the `terraform state` operations, `terraform taint`, -and more will continue to work as if the state was local. - -## State Storage - -Backends determine where state is stored. For example, the local (default) -backend stores state in a local JSON file on disk. The Consul backend stores -the state within Consul. Both of these backends happen to provide locking: -local via system APIs and Consul via locking APIs. - -When using a non-local backend, Terraform will not persist the state anywhere -on disk except in the case of a non-recoverable error where writing the state -to the backend failed. This behavior is a major benefit for backends: if -sensitive values are in your state, using a remote backend allows you to use -Terraform without that state ever being persisted to disk. - -In the case of an error persisting the state to the backend, Terraform will -write the state locally. This is to prevent data loss. If this happens, the -end user must manually push the state to the remote backend once the error -is resolved. - -## Manual State Pull/Push - -You can still manually retrieve the state from the remote state using -the `terraform state pull` command. This will load your remote state and -output it to stdout. You can choose to save that to a file or perform any -other operations. - -You can also manually write state with `terraform state push`. **This -is extremely dangerous and should be avoided if possible.** This will -overwrite the remote state. This can be used to do manual fixups if necessary. - -When manually pushing state, Terraform will attempt to protect you from -some potentially dangerous situations: - -- **Differing lineage**: The "lineage" is a unique ID assigned to a state - when it is created. If a lineage is different, then it means the states - were created at different times and its very likely you're modifying a - different state. Terraform will not allow this. - -- **Higher serial**: Every state has a monotonically increasing "serial" - number. If the destination state has a higher serial, Terraform will - not allow you to write it since it means that changes have occurred since - the state you're attempting to write. - -Both of these protections can be bypassed with the `-force` flag if you're -confident you're making the right decision. Even if using the `-force` flag, -we recommend making a backup of the state with `terraform state pull` -prior to forcing the overwrite. - -## State Locking - -Backends are responsible for supporting [state locking](/terraform/language/state/locking) -if possible. - -Not all backends support locking. The [documentation for each backend](/terraform/language/settings/backends/configuration#available-backends) includes details about whether it supports locking or not. - -For more information on state locking, view the -[page dedicated to state locking](/terraform/language/state/locking). diff --git a/website/docs/language/state/import.mdx b/website/docs/language/state/import.mdx deleted file mode 100644 index 1bf2c7d5fd90..000000000000 --- a/website/docs/language/state/import.mdx +++ /dev/null @@ -1,13 +0,0 @@ ---- -page_title: 'State: Import Existing Resources' -description: >- - Terraform stores state which caches the known state of the world the last time - Terraform ran. ---- - -# Import Existing Resources - -Terraform is able to import existing infrastructure. This allows you to take -resources you have created by some other means and bring them under Terraform management. - -To learn more, see [Import](/terraform/language/import). diff --git a/website/docs/language/state/index.mdx b/website/docs/language/state/index.mdx deleted file mode 100644 index 89b539ad3690..000000000000 --- a/website/docs/language/state/index.mdx +++ /dev/null @@ -1,83 +0,0 @@ ---- -page_title: State -description: >- - An introduction to state, information that Terraform uses to map resources to - a configuration, track metadata, and improve performance. ---- - -# State - -Terraform must store state about your managed infrastructure and -configuration. This state is used by Terraform to map real world -resources to your configuration, keep track of metadata, and to improve -performance for large infrastructures. - -This state is stored by default in a local file named "terraform.tfstate", -but we recommend [storing it in HCP Terraform](/terraform/cloud-docs/migrate) -to version, encrypt, and securely share it with your team. - -Terraform uses state to determine which changes to make to your -infrastructure. Prior to any operation, Terraform does a -[refresh](/terraform/cli/commands/refresh) to update the state with the -real infrastructure. - -The primary purpose of Terraform state is to store bindings between objects in -a remote system and resource instances declared in your configuration. -When Terraform creates a remote object in response to a change of configuration, -it will record the identity of that remote object against a particular -resource instance, and then potentially update or delete that object in -response to future configuration changes. - -For more information on why Terraform requires state and why Terraform cannot -function without state, please see the page [state purpose](/terraform/language/state/purpose). - -## Inspection and Modification - -While the format of the state files are just JSON, direct file editing -of the state is discouraged. Terraform provides the -[terraform state](/terraform/cli/commands/state) command to perform -basic modifications of the state using the CLI. - -The CLI usage and output of the state commands is structured to be -friendly for Unix tools such as grep, awk, etc. Additionally, the CLI -insulates users from any format changes within the state itself. The Terraform -project will keep the CLI working while the state format underneath it may -shift. - -Terraform expects a one-to-one mapping between configured resource instances -and remote objects. Normally that is guaranteed by Terraform being the one -to create each object and record its identity in the state, or to destroy -an object and then remove the binding for it. - -If you add or remove bindings in the state by other means, such as by importing -externally-created objects with `terraform import`, or by asking Terraform to -"forget" an existing object with `terraform state rm`, you'll then need to -ensure for yourself that this one-to-one rule is followed, such as by manually -deleting an object that you asked Terraform to "forget", or by re-importing it -to bind it to some other resource instance. - -## Format - -State snapshots are stored in JSON format and new Terraform versions are -generally backward compatible with state snapshots produced by earlier versions. -However, the state format is subject to change in new Terraform versions, so -if you build software that parses or modifies it directly you should expect -to perform ongoing maintenance of that software as the state format evolves -in new versions. - -Alternatively, there are several integration points which produce JSON output -that is specifically intended for consumption by external software: - -* [The `terraform output` command](/terraform/cli/commands/output) - has a `-json` option, for obtaining either the full set of root module output - values or a specific named output value from the latest state snapshot. -* [The `terraform show` command](/terraform/cli/commands/show) has a `-json` - option for inspecting the latest state snapshot in full, and also for - inspecting saved plan files which include a copy of the prior state at the - time the plan was made. - -A typical way to use these in situations where Terraform is running in -automation is to run them immediately after a successful `terraform apply` -to obtain a representation of the latest state snapshot, and then store that -result as an artifact associated with the automated run so that other software -can potentially consume it without needing to run Terraform itself. diff --git a/website/docs/language/state/locking.mdx b/website/docs/language/state/locking.mdx deleted file mode 100644 index a5fa145a3bde..000000000000 --- a/website/docs/language/state/locking.mdx +++ /dev/null @@ -1,40 +0,0 @@ ---- -page_title: 'State: Locking' -description: >- - Terraform stores state which caches the known state of the world the last time - Terraform ran. ---- - -# State Locking - -If supported by your [backend](/terraform/language/settings/backends/configuration), Terraform will lock your -state for all operations that could write state. This prevents -others from acquiring the lock and potentially corrupting your state. - -State locking happens automatically on all operations that could write -state. You won't see any message that it is happening. If state locking fails, -Terraform will not continue. You can disable state locking for most commands -with the `-lock` flag but it is not recommended. - -If acquiring the lock is taking longer than expected, Terraform will output -a status message. If Terraform doesn't output a message, state locking is -still occurring if your backend supports it. - -Not all backends support locking. The -[documentation for each backend](/terraform/language/settings/backends/configuration) -includes details on whether it supports locking or not. - -## Force Unlock - -Terraform has a [force-unlock command](/terraform/cli/commands/force-unlock) -to manually unlock the state if unlocking failed. - -**Be very careful with this command.** If you unlock the state when someone -else is holding the lock it could cause multiple writers. Force unlock should -only be used to unlock your own lock in the situation where automatic -unlocking failed. - -To protect you, the `force-unlock` command requires a unique lock ID. Terraform -will output this lock ID if unlocking fails. This lock ID acts as a -[nonce](https://en.wikipedia.org/wiki/Cryptographic_nonce), ensuring -that locks and unlocks target the correct lock. diff --git a/website/docs/language/state/purpose.mdx b/website/docs/language/state/purpose.mdx deleted file mode 100644 index bd6663675341..000000000000 --- a/website/docs/language/state/purpose.mdx +++ /dev/null @@ -1,109 +0,0 @@ ---- -page_title: State -description: >- - Terraform must store state about your managed infrastructure and - configuration. This state is used by Terraform to map real world resources to - your configuration, keep track of metadata, and to improve performance for - large infrastructures. ---- - -# Purpose of Terraform State - -State is a necessary requirement for Terraform to function. It is often -asked if it is possible for Terraform to work without state, or for Terraform -to not use state and just inspect real world resources on every run. This page -will help explain why Terraform state is required. - -As you'll see from the reasons below, state is required. And in the scenarios -where Terraform may be able to get away without state, doing so would require -shifting massive amounts of complexity from one place (state) to another place -(the replacement concept). - -## Mapping to the Real World - -Terraform requires some sort of database to map Terraform config to the real -world. For example, when you have a resource `resource "aws_instance" "foo"` in your -configuration, Terraform uses this mapping to know that the resource `resource "aws_instance" "foo"` -represents a real world object with the instance ID `i-abcd1234` on a remote system. - -For some providers like AWS, Terraform could theoretically use something like -AWS tags. Early prototypes of Terraform actually had no state files and used -this method. However, we quickly ran into problems. The first major issue was -a simple one: not all resources support tags, and not all cloud providers -support tags. - -Therefore, for mapping configuration to resources in the real world, -Terraform uses its own state structure. - -Terraform expects that each remote object is bound to only one resource instance in the configuration. -If a remote object is bound to multiple resource instances, the mapping from configuration to the remote -object in the state becomes ambiguous, and Terraform may behave unexpectedly. Terraform can guarantee -a one-to-one mapping when it creates objects and records their identities in the state. -When importing objects created outside of Terraform, you must make sure that each distinct object -is imported to only one resource instance. - -## Metadata - -Alongside the mappings between resources and remote objects, Terraform must -also track metadata such as resource dependencies. - -Terraform typically uses the configuration to determine dependency order. -However, when you delete a resource from a Terraform configuration, Terraform -must know how to delete that resource from the remote system. Terraform can see that a mapping exists -in the state file for a resource not in your configuration and plan to destroy. However, since -the configuration no longer exists, the order cannot be determined from the -configuration alone. - -To ensure correct operation, Terraform retains a copy of the most recent set -of dependencies within the state. Now Terraform can still determine the correct -order for destruction from the state when you delete one or more items from -the configuration. - -Terraform could take another approach to dependency order by using an underlying hierarchy of order -between resource types. For example, Terraform could know that servers must be -deleted before the subnets they are a part of. The complexity for this approach -quickly explodes, however: in addition to Terraform having to understand the -ordering semantics of every resource for every _provider_, Terraform must also -understand the ordering _across providers_. - -Terraform also stores other metadata for similar reasons, such as a pointer -to the provider configuration that was most recently used with the resource -in situations where multiple aliased providers are present. - -## Performance - -In addition to basic mapping, Terraform stores a cache of the attribute -values for all resources in the state. This is the most optional feature of -Terraform state and is done only as a performance improvement. - -When running a `terraform plan`, Terraform must know the current state of -resources in order to effectively determine the changes that it needs to make -to reach your desired configuration. - -For small infrastructures, Terraform can query your providers and sync the -latest attributes from all your resources. This is the default behavior -of Terraform: for every plan and apply, Terraform will sync all resources in -your state. - -For larger infrastructures, querying every resource is too slow. Many cloud -providers do not provide APIs to query multiple resources at once, and the -round trip time for each resource is hundreds of milliseconds. On top of this, -cloud providers almost always have API rate limiting so Terraform can only -request a certain number of resources in a period of time. Larger users -of Terraform make heavy use of the `-refresh=false` flag as well as the -`-target` flag in order to work around this. In these scenarios, the cached -state is treated as the record of truth. - -## Syncing - -In the default configuration, Terraform stores the state in a file in the -current working directory where Terraform was run. This is okay for getting -started, but when using Terraform in a team it is important for everyone -to be working with the same state so that operations will be applied to the -same remote objects. - -[Remote state](/terraform/language/state/remote) is the recommended solution -to this problem. With a fully-featured state backend, Terraform can use -remote locking as a measure to avoid two or more different users accidentally -running Terraform at the same time, and thus ensure that each Terraform run -begins with the most recent updated state. diff --git a/website/docs/language/state/remote.mdx b/website/docs/language/state/remote.mdx deleted file mode 100644 index eb756b22ce6a..000000000000 --- a/website/docs/language/state/remote.mdx +++ /dev/null @@ -1,63 +0,0 @@ ---- -page_title: 'State: Remote Storage' -description: >- - Terraform can store the state remotely, making it easier to version and work - with in a team. ---- - -# Remote State - -By default, Terraform stores state locally in a file named `terraform.tfstate`. -When working with Terraform in a team, use of a local file makes Terraform -usage complicated because each user must make sure they always have the latest -state data before running Terraform and make sure that nobody else runs -Terraform at the same time. - -With _remote_ state, Terraform writes the state data to a remote data store, -which can then be shared between all members of a team. Terraform supports -storing state in [HCP Terraform](https://www.hashicorp.com/products/terraform/), -[HashiCorp Consul](https://www.consul.io/), Amazon S3, Azure Blob Storage, Google Cloud Storage, Alibaba Cloud OSS, and more. - -Remote state is implemented by a [backend](/terraform/language/settings/backends/configuration) or by -HCP Terraform, both of which you can configure in your configuration's root module. - -## Delegation and Teamwork - -Remote state allows you to share -[output values](/terraform/language/values/outputs) with other configurations. -This allows your infrastructure to be decomposed into smaller components. - -Put another way, remote state also allows teams to share infrastructure -resources in a read-only way without relying on any additional configuration -store. - -For example, a core infrastructure team can handle building the core -machines, networking, etc. and can expose some information to other -teams to run their own infrastructure. As a more specific example with AWS: -you can expose things such as VPC IDs, subnets, NAT instance IDs, etc. through -remote state and have other Terraform states consume that. - -For example usage, see -[the `terraform_remote_state` data source](/terraform/language/state/remote-state-data). - -While remote state can be a convenient, built-in mechanism for sharing data -between configurations, you may prefer to use more general stores to -pass settings both to other configurations and to other consumers. For example, -if your environment has [HashiCorp Consul](https://www.consul.io/) then you -can have one Terraform configuration that writes to Consul using -[`consul_key_prefix`](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/resources/key_prefix) and then -another that consumes those values using -[the `consul_keys` data source](https://registry.terraform.io/providers/hashicorp/consul/latest/docs/data-sources/keys). - -## Locking and Teamwork - -For fully-featured remote backends, Terraform can also use -[state locking](/terraform/language/state/locking) to prevent concurrent runs of -Terraform against the same state. - -[HCP Terraform by HashiCorp](https://www.hashicorp.com/products/terraform/) -is a commercial offering that supports an even stronger locking concept that -can also detect attempts to create a new plan when an existing plan is already -awaiting approval, by queuing Terraform operations in a central location. -This allows teams to more easily coordinate and communicate about changes to -infrastructure. diff --git a/website/docs/language/state/sensitive-data.mdx b/website/docs/language/state/sensitive-data.mdx deleted file mode 100644 index bf406177c514..000000000000 --- a/website/docs/language/state/sensitive-data.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -page_title: 'State: Sensitive Data' -description: Sensitive data in Terraform state. ---- - -# Sensitive Data in State - -Terraform state can contain sensitive data, depending on the resources in use -and your definition of "sensitive." The state contains resource IDs and all -resource attributes. For resources such as databases, this may contain initial -passwords. - -When using local state, state is stored in plain-text JSON files. - -When using [remote state](/terraform/language/state/remote), state is only ever held in -memory when used by Terraform. It may be encrypted at rest, but this depends on -the specific remote state backend. - -## Recommendations - -If you manage any sensitive data with Terraform (like database passwords, user -passwords, or private keys), treat the state itself as sensitive data. - -Storing state remotely can provide better security. As of Terraform 0.9, -Terraform does not persist state to the local disk when remote state is in use, -and some backends can be configured to encrypt the state data at rest. - -For example: - -- [HCP Terraform](https://cloud.hashicorp.com/products/terraform) always encrypts state at rest and - protects it with TLS in transit. HCP Terraform also knows the identity of - the user requesting state and maintains a history of state changes. This can - be used to control access and track activity. [Terraform Enterprise](/terraform/enterprise) - also supports detailed audit logging. -- The S3 backend supports encryption at rest when the `encrypt` option is - enabled. IAM policies and logging can be used to identify any invalid access. - Requests for the state go over a TLS connection. -- The GCS (Google Cloud Storage) backend supports using [customer-supplied](/terraform/language/settings/backends/gcs#customer-supplied-encryption-keys) or [customer-managed (Cloud KMS)](/terraform/language/settings/backends/gcs#customer-managed-encryption-keys-cloud-kms) encryption keys. diff --git a/website/docs/language/syntax/index.mdx b/website/docs/language/syntax/index.mdx index 8cf3a254005f..b040258bd9d6 100644 --- a/website/docs/language/syntax/index.mdx +++ b/website/docs/language/syntax/index.mdx @@ -20,4 +20,4 @@ section offer a more abstract view of the Terraform language. don't have a readily available HCL library. - [Style Conventions](/terraform/language/style#code-formatting) documents some commonly accepted formatting guidelines for Terraform code. These conventions can be - enforced automatically with [`terraform fmt`](/terraform/cli/commands/fmt). + enforced automatically with [`terraform fmt`](/terraform/cli/commands/fmt). \ No newline at end of file diff --git a/website/docs/language/syntax/configuration.mdx b/website/docs/language/syntax/terraform.mdx similarity index 96% rename from website/docs/language/syntax/configuration.mdx rename to website/docs/language/syntax/terraform.mdx index 2ca57fe5bdba..e1660fb0ece8 100644 --- a/website/docs/language/syntax/configuration.mdx +++ b/website/docs/language/syntax/terraform.mdx @@ -1,11 +1,11 @@ --- -page_title: Syntax - Configuration Language +page_title: Syntax Overview - Configuration Language description: >- - Key constructs of the native Terraform language syntax, including identifiers, - arguments, blocks, and comments. + Terraform language syntax for both the native and JSON variants. Also learn + formatting conventions that you can enforce with terraform fmt. --- -# Configuration Syntax +# Terraform configuration syntax Other pages in this section have described various configuration constructs that can appear in the Terraform language. This page describes the lower-level @@ -127,3 +127,4 @@ Terraform accepts configuration files with either Unix-style line endings (LF only) or Windows-style line endings (CR then LF), but the idiomatic style is to use the Unix convention, and so automatic configuration formatting tools may automatically transform CRLF endings to LF. + diff --git a/website/docs/language/validate/check.mdx b/website/docs/language/validate/check.mdx new file mode 100644 index 000000000000..ec001c637c9c --- /dev/null +++ b/website/docs/language/validate/check.mdx @@ -0,0 +1,9 @@ +--- +page_title: Check +description: >- + Check +--- + +# Check + +Check \ No newline at end of file diff --git a/website/docs/language/validate/index.mdx b/website/docs/language/validate/index.mdx new file mode 100644 index 000000000000..58ab89fd14d1 --- /dev/null +++ b/website/docs/language/validate/index.mdx @@ -0,0 +1,9 @@ +--- +page_title: Validate configuration +description: >- + Write structured test code for validating your configuration. +--- + +# Validate configuration + +PLACEHOLDER: overview page for validating configuraiton using checks and tests. Should include at a high level description of each and why you would pick one over the other \ No newline at end of file diff --git a/website/docs/language/validate/test.mdx b/website/docs/language/validate/test.mdx new file mode 100644 index 000000000000..9c0ae8562f2c --- /dev/null +++ b/website/docs/language/validate/test.mdx @@ -0,0 +1,739 @@ +--- +page_title: Tests - Configuration Language +description: >- + Write structured test code for validating your configuration. +--- + +# Tests + +-> **Note:** This testing framework is available in Terraform v1.6.0 and later. + +Terraform tests let authors validate that module configuration updates do not introduce breaking changes. Tests run against test-specific, short-lived resources, preventing any risk to your existing infrastructure or state. + +## Integration or Unit testing + +By default, tests within Terraform create real infrastructure and can run assertions and validations against that infrastructure. This is analogous to integration testing because you are testing Terraform's core functionality by executing operations and validating the infrastructure Terraform creates. + +You can override the normal testing behavior by updating the `command` attribute within a [`run`](#run-blocks) block (examples below). By default, each `run` block executes with `command = apply` instructing Terraform to execute a complete `apply` operation against your configuration. Replacing the `command` value with `command = plan` instructs Terraform to _not_ create new infrastructure for this `run` block. This allows test authors to validate logical operations and custom conditions within their infrastructure in a process analogous to unit testing. + +Terraform v1.7.0 introduced the ability to mock data returned by the providers during a `terraform test` execution. This can be used to write more detailed and complete unit tests. + +## Syntax + +Each Terraform test lives in a test file. Terraform discovers test files are based on their file extension: `.tftest.hcl` or `.tftest.json`. + +Each test file contains the following root level attributes and blocks: + +- One to many [`run`](#run-blocks) blocks. +- Zero to one [`variables`](#variables) block. +- Zero to many [`provider`](#providers) blocks. + +Terraform executes `run` blocks in order, simulating a series of Terraform commands executing directly within the configuration directory. The order of the `variables` and `provider` blocks doesn't matter, Terraform processes all the values within these blocks at the beginning of the test operation. We recommend defining your `variables` and `provider` blocks first, at the beginning of the test file. + +### Example + +The following example demonstrates a simple Terraform configuration that creates an AWS S3 bucket, using an input variable to modify the name. We will create an example test file (below) that validates the buckets name is created as expected. + +```hcl +# main.tf + +provider "aws" { + region = "eu-central-1" +} + +variable "bucket_prefix" { + type = string +} + +resource "aws_s3_bucket" "bucket" { + bucket = "${var.bucket_prefix}-bucket" +} + +output "bucket_name" { + value = aws_s3_bucket.bucket.bucket +} +``` + +The following test file runs a single Terraform `plan` command which creates the S3 bucket, and then validates the logic for calculating the name is correct by checking the actual name matches the expected name. + +```hcl +# valid_string_concat.tftest.hcl + +variables { + bucket_prefix = "test" +} + +run "valid_string_concat" { + + command = plan + + assert { + condition = aws_s3_bucket.bucket.bucket == "test-bucket" + error_message = "S3 bucket name did not match expected" + } + +} +``` + +## Run blocks + +Each `run` block has the following fields and blocks: + +| Field or Block Name | Description | Default Value | +| ------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------- | +| `command` | An optional attribute, which is either `apply` or `plan`. | `apply` | +| `plan_options.mode` | An optional attribute, which is either `normal` or `refresh-only`. | `normal` | +| `plan_options.refresh` | An optional boolean attribute. | `true` | +| `plan_options.replace` | An optional attribute containing a list of resource addresses referencing resources within the configuration under test. | | +| `plan_options.target` | An optional attribute containing a list of resource addresses referencing resources within the configuration under test. | | +| [`variables`](#variables) | An optional `variables` block. | | +| [`module`](#modules) | An optional `module` block. | | +| [`providers`](#providers) | An optional `providers` attribute. | | +| [`assert`](#assertions) | Optional `assert` blocks. | | +| `expect_failures` | An optional attribute. | | + +The `command` attribute and `plan_options` block tell Terraform which command and options to execute for each run block. The default operation, if you do not specify a `command` attribute or the `plan_options` block, is a normal Terraform apply operation. + +The `command` attribute states whether the operation should be a [`plan`](/terraform/cli/commands/plan) or an [`apply`](/terraform/cli/commands/apply) operation. + +The `plan_options` block allows test authors to customize the [planning mode](/terraform/cli/commands/plan#planning-modes) and [options](/terraform/cli/commands/plan#planning-options) they would typically need to edit via command-line flags and options. We cover the `-var` and `-var-file` options in the [Variables](#variables) section. + +### Assertions + +Terraform run block assertions are [Custom Conditions](/terraform/language/expressions/custom-conditions), consisting of a [condition](/terraform/language/expressions/custom-conditions#condition-expressions) and an [error message](/terraform/language/expressions/custom-conditions#error-messages). + +At the conclusion of a Terraform test command execution, Terraform presents any failed assertions as part of a tests passed or failed status. + +#### Assertion References + +Assertions within tests can reference any existing [named values](/terraform/language/expressions/references) that are available to other custom conditions within the main Terraform configuration. + +Additionally, test assertions can directly reference outputs from current and previous `run` blocks. Pulling from the [previous example](#example), this is a valid condition: `condition = output.bucket_name == "test_bucket"`. + +## Variables + +You can provide values for [Input Variables](/terraform/language/values/variables) within your configuration directly from your test files. + +The test file syntax supports `variables` blocks at both the root level and within `run` blocks. Terraform passes all variable values from the test file into all `run` blocks within the file. You can override variable values for a particular `run` block with values provided directly within that `run` block. + +Adding to the test file from the [example](#example) above: + +```hcl +# variable_precedence.tftest.hcl + +variables { + bucket_prefix = "test" +} + +run "uses_root_level_value" { + + command = plan + + assert { + condition = aws_s3_bucket.bucket.bucket == "test-bucket" + error_message = "S3 bucket name did not match expected" + } + +} + +run "overrides_root_level_value" { + + command = plan + + variables { + bucket_prefix = "other" + } + + assert { + condition = aws_s3_bucket.bucket.bucket == "other-bucket" + error_message = "S3 bucket name did not match expected" + } + +} +``` + +We've added a second `run` block that specifies the `bucket_prefix` variable value as `other`, overriding the value `test` that is provided by the test file and used during the first `run` block. + +### Specify variables with the Command Line or definition files + +In addition to specifying variable values via test files, the Terraform `test` command also supports the other typical mechanisms for specifying variable values. + +You can specify values for variables across all tests with the [Command Line](/terraform/language/values/variables#variables-on-the-command-line) and with [Variable Definition Files](/terraform/language/values/variables#variable-definitions-tfvars-files). + +As with the main configuration direction, Terraform will automatically load any variables defined in the automatic variable files within a test directory. The automatic variable files are `terraform.tfvars`, `terraform.tfvars.json`, and any files that end with `.auto.tfvars` or `.auto.tfvars.json`. + +-> **Note:** Variable values loaded from the automatic variable files within a test directory will only apply to tests also defined within the same test directory. Variables defined in all other ways will apply to all tests in a given test run. + +This is particularly useful for using sensitive variables values and for configuring providers. Otherwise, testing files could directly expose those sensitive values. + +### Variable definition precedence + +[Variable Definition Precedence](/terraform/language/values/variables#variable-definition-precedence) remains the same within tests, except for variable values that test files provide. The variables defined in test files take the highest precedence, overriding environment variables, variables files, or command-line input. + +For tests defined in a test directory, any variable values defined in automatic variable files from the test directory will override values defined in automatic variable files from the main configuration directory. + +### Variable References + +Variables you define within `run` blocks can refer to outputs from modules executed in earlier `run` blocks and variables defined at higher precedence levels. Variables defined within the file level `variables` block can only refer to global variables. + +For example, the following code block shows how a variable can refer to higher precedence variables and previous run blocks: + +```hcl +variables { + global_value = "some value" +} + +run "run_block_one" { + variables { + local_value = var.global_value + } + + # ... + # Some test assertions should go here. + # ... +} + +run "run_block_two" { + variables { + local_value = run.run_block_one.output_one + } + + # ... + # Some test assertions should go here. + # ... +} +``` + +Above, the `local_value` in `run_block_one` gets its value from the `global_value` variable. This pattern is useful if you want to assign multiple variables the same value. You can specify a variable value once at the file level and then share it with different variables. + +In comparison, `local_value` in `run_block_two` takes its value from the output value of `output_one` from `run_block_one`. This pattern is useful for passing values between `run` blocks, particularly if `run` blocks are executing different modules as detailed in the [Modules](#modules) section. + +## Providers + +You can set or override the required providers within the main configuration from your testing files by using `provider` and `providers` blocks and attributes. + +At the root level of a Terraform testing file, you can define [`provider` blocks](/terraform/language/providers/configuration) as if Terraform were creating them [within the main configuration](/terraform/language/providers). Terraform will then pass these provider blocks into its configuration as each `run` block executes. + +By default, each provider you specify is directly available within each `run` block. You can customize the availability of providers within a given `run` block by using a `providers` attribute. The behavior and syntax for this block match the behavior of [providers meta-argument](/terraform/language/meta-arguments/module-providers). + +If you do not provide provider configuration within a testing file, Terraform attempts to initialize any providers within its configuration using the provider's default settings. For example, any environment variables aimed at configuring providers are still available, and Terraform can use them to create default providers. + +Below, we expand on our previous [example](#example) to allow tests, instead of the configuration, to specify the region. In this example, we are going to test the following configuration file: + +```hcl +# main.tf + +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + } + } +} + +variable "bucket_prefix" { + type = string +} + +resource "aws_s3_bucket" "bucket" { + bucket = "${var.bucket_prefix}-bucket" +} + +output "bucket_name" { + value = aws_s3_bucket.bucket.bucket +} +``` + +We can now define our `provider` blocks within the following test file: + +```hcl +# customised_provider.tftest.hcl + +provider "aws" { + region = "eu-central-1" +} + +variables { + bucket_prefix = "test" +} + +run "valid_string_concat" { + + command = plan + + assert { + condition = aws_s3_bucket.bucket.bucket == "test-bucket" + error_message = "S3 bucket name did not match expected" + } + +} +``` + +We can also create a more complex example configuration, that makes use of multiple providers and aliases: + +```hcl +# main.tf + +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + configuration_aliases = [aws.secondary] + } + } +} + +variable "bucket_prefix" { + default = "test" + type = string +} + +resource "aws_s3_bucket" "primary_bucket" { + bucket = "${var.bucket_prefix}-primary" +} + +resource "aws_s3_bucket" "secondary_bucket" { + provider = aws.secondary + bucket = "${var.bucket_prefix}-secondary" +} +``` + +Within our test file we can specify multiple providers: + +```hcl +# customised_providers.tftest.hcl + +provider "aws" { + region = "us-east-1" +} + +provider "aws" { + alias = "secondary" + region = "eu-central-1" +} + +run "providers" { + + command = plan + + assert { + condition = aws_s3_bucket.primary_bucket.bucket == "test-primary" + error_message = "invalid value for primary S3 bucket" + } + + assert { + condition = aws_s3_bucket.secondary_bucket.bucket == "test-secondary" + error_message = "invalid value for secondary S3 bucket" + } +} +``` + +It is also possible to define specific providers you want to use in specific `run` blocks: + +```hcl +# main.tf + +terraform { + required_providers { + aws = { + source = "hashicorp/aws" + configuration_aliases = [aws.secondary] + } + } +} + +data "aws_region" "primary" {} + +data "aws_region" "secondary" { + provider = aws.secondary +} + +variable "bucket_prefix" { + default = "test" + type = string +} + +resource "aws_s3_bucket" "primary_bucket" { + bucket = "${var.bucket_prefix}-${data.aws_region.primary.name}-primary" +} + +resource "aws_s3_bucket" "secondary_bucket" { + provider = aws.secondary + bucket = "${var.bucket_prefix}-${data.aws_region.secondary.name}-secondary" +} +``` + +Our test file can pass in specific providers for each different `run` block: + +```hcl +# customised_providers.tftest.hcl + +provider "aws" { + region = "us-east-1" +} + +provider "aws" { + alias = "secondary" + region = "eu-central-1" +} + +provider "aws" { + alias = "tertiary" + region = "eu-west-2" +} + +run "default_providers" { + + command = plan + + assert { + condition = aws_s3_bucket.primary_bucket.bucket == "test-us-east-1-primary" + error_message = "invalid value for primary S3 bucket" + } + + assert { + condition = aws_s3_bucket.secondary_bucket.bucket == "test-eu-central-1-secondary" + error_message = "invalid value for secondary S3 bucket" + } +} + +run "customised_providers" { + + command = plan + + providers = { + aws = aws + aws.secondary = aws.tertiary + } + + assert { + condition = aws_s3_bucket.primary_bucket.bucket == "test-us-east-1-primary" + error_message = "invalid value for primary S3 bucket" + } + + assert { + condition = aws_s3_bucket.secondary_bucket.bucket == "test-eu-west-2-secondary" + error_message = "invalid value for secondary S3 bucket" + } +} +``` + +> **Note:** When running tests with `command = apply`, switching providers between `run` blocks can result in failed operations and tests because resources created by one provider definition will be unusable when modified by a second. + +From Terraform v1.7.0, `provider` blocks can also reference test file variables and run block outputs. This means the testing framework can retrieve credentials and other setup information from one provider and use this when initializing a second. + +In the following example, the `vault` provider is initialized first, and then used within a setup module to extract credentials for the `aws` provider. For more information on setup modules, see [Modules](#modules). + +```hcl + +provider "vault" { + # ... vault configuration ... +} + +provider "aws" { + region = "us-east-1" + + # The `aws` provider can reference the outputs of the "vault_setup" run block. + access_key = run.vault_setup.aws_access_key + secret_key = run.vault_setup.aws_secret_key +} + +run "vault_setup" { + module { + # This module should only include reference to the Vault provider. Terraform + # will automatically work out which providers to supply based on the module + # configuration. The tests will error if a run block requires access to a + # provider that references outputs from a run block that has not executed. + source = "./testing/vault-setup" + } +} + +run "use_aws_provider" { + # This run block can then use both the `aws` and `vault` providers, as the + # previous run block provided all the data required for the `aws` provider. +} +``` + +## Modules + +You can modify the module that a given `run` block executes. + +By default, Terraform executes the given command against the configuration being tested for each `run` block. Terraform tests the configuration within the directory you execute the `terraform test` command from (or the directory you point to with the `-chdir` argument). Each `run` block also allows the user to change the targeted configuration using the `module` block. + +Unlike the traditional [`module` block](/terraform/language/modules/syntax), the `module` block within test files _only_ supports the [`source`](/terraform/language/modules/syntax#source) attribute and the [`version`](/terraform/language/modules/syntax#version) attribute. The remaining attributes that are typically supplied via the traditional `module` block should be supplied by the alternate attributes and blocks within the `run` block. + +> **Note:** Terraform test files only support [local](/terraform/language/modules/sources#local-paths) and [registry](/terraform/language/modules/sources#terraform-registry) modules within the `source` attribute. + +All other blocks and attributes within the `run` block are supported when executing an alternate module, with `assert` blocks executing against values from the alternate module. This is discussed more in [Modules State](#modules-state). + +Two example use cases for the `modules` block within a testing file are: + +1. A setup module that creates the infrastructure the main configuration requires for testing. +2. A loading module to load and validate secondary infrastructure (such as data sources) that are not created directly by the main configuration being tested. + +The following examples demonstrate both of these use cases. + +First, we have a module that will create and load several files into an already created S3 bucket. This is the configuration we want to test. + +```hcl +# main.tf + +variable "bucket" { + type = string +} + +variable "files" { + type = map(string) +} + +data "aws_s3_bucket" "bucket" { + bucket = var.bucket +} + +resource "aws_s3_object" "object" { + for_each = var.files + + bucket = data.aws_s3_bucket.bucket.id + key = each.key + source = each.value + + etag = filemd5(each.value) +} +``` + +Second, we have a setup module that will create the S3 bucket, so it is available to the configuration under test. + +```hcl +# testing/setup/main.tf + +variable "bucket" { + type = string +} + +resource "aws_s3_bucket" "bucket" { + bucket = var.bucket +} +``` + +Third, we have a loading module, that will load the files in the s3 bucket. This is a fairly contrived example, as it is definitely possible just to validate the files directly when they are created in the module under test. It is, however, good for demonstrating the use case. + +```hcl +# testing/loader/main.tf + +variable "bucket" { + type = string +} + +data "aws_s3_objects" "objects" { + bucket = var.bucket +} +``` + +Finally, we have the test file itself which configures everything and calls out to the various helper modules we have created. + +```hcl +# file_count.tftest.hcl + +variables { + bucket = "my_test_bucket" + files = { + "file-one.txt": "data/files/file_one.txt" + "file-two.txt": "data/files/file_two.txt" + } +} + +provider "aws" { + region = "us-east-1" +} + +run "setup" { + # Create the S3 bucket we will use later. + + module { + source = "./testing/setup" + } +} + +run "execute" { + # This is empty, we just run the configuration under test using all the default settings. +} + +run "verify" { + # Load and count the objects created in the "execute" run block. + + module { + source = "./testing/loader" + } + + assert { + condition = length(data.aws_s3_objects.objects.keys) == 2 + error_message = "created the wrong number of s3 objects" + } +} +``` + +### Modules state + +While Terraform executes a `terraform test` command, Terraform maintains at least one, but possibly many, state files within memory for each test file. + +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. + +Additionally, there is 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. + +The Terraform team is interested in any use cases requiring manual state management or the ability to execute different configurations against the same state within the `test` command. If you have a use case, please file an [issue](https://github.com/hashicorp/terraform/issues/new/choose) and share it with us. + +The following example uses comments to explain where the state files for each `run` block originate. 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. + +```hcl +run "setup" { + + # This run block references an alternate module and is the first run block + # to reference this particular alternate module. Therefore, Terraform creates + # and populates a new empty state file for this run block. + + module { + source = "./testing/setup" + } +} + +run "init" { + + # This run block does not reference an alternate module, so it uses the main + # state file for the configuration under test. As this is the first run block + # to reference the main configuration, the previously empty state file now + # contains the resources created by this run block. + + assert { + # In practice we'd do some interesting checks and tests here but the + # assertions aren't important for this example. + } + + # ... more assertions ... +} + +run "update_setup" { + + # We've now re-referenced the setup module, so the state file that was created + # for the first "setup" run block will be reused. It will contain any + # resources that were created as part of the other run block before this run + # block executes and will be updated with any changes made by this run block + # after. + + module { + source = "./testing/setup" + } + + variables { + # In practice, we'd likely make some changes to the module compared to the + # first run block here. Otherwise, there would be no point recalling the + # module. + } +} + +run "update" { + + # As with the "init" run block, we are executing against the main configuration + # again. This means we'd load the main state file that was initially populated + # by the "init" run block, and any changes made by this "run" block will be + # carried forward to any future run blocks that execute against the main + # configuration. + + # ... updated variables ... + + # ... assertions ... +} + +run "loader" { + + # This run block is now referencing our second alternate module so will create + # our third and final state file. The other two state files are managing + # resources from the main configuration and resources from the setup module. + # We are getting a new state file for this run block as the loader module has + # not previously been referenced by any run blocks. + + module { + source = "./testing/loader" + } +} +``` + +#### Modules Cleanup + +At the conclusion of a test file, Terraform attempts to destroy every resource it created during the execution of that test file. When Terraform loads alternate modules, the order in which Terraform destroys those objects in is important. For example, in the first [Modules](#modules) example, Terraform could not destroy the resources created in the "setup" `run` block before the objects created in the "execute" `run` block, because the S3 bucket we created in the "setup" step can not be destroyed while it contains objects. + +Terraform destroys resources in reverse `run` block order. In the most recent [example](#modules-state), there are three state files. One for the main state, one for the `./testing/loader` module, and one for the `./testing/setup` module. The `./testing/loader` state file would be destroyed first as it was referenced most recently by the last run block. The main state file would be destroyed second as it was referenced by the "update" `run` block. The `./testing/setup` state file would then be destroyed last. + +Note, that the first two `run` blocks "setup" and "init", do nothing during the destroy operations as their state files are used by later run blocks and have already been destroyed. + +If you use a single setup module as an alternate module, and it executes first, or you use no alternate modules, then the order of destruction does not affect you. Anything more complex may require careful consideration to make sure the destruction of resources can complete automatically. + +## Expecting failures + +By default, if any [Custom Conditions](/terraform/language/expressions/custom-conditions), including `check` block assertions, fail during the execution of a Terraform test file then the overall command reports the test as a failure. + +However, it is a common testing paradigm to want to test failure cases. Terraform supports the `expect_failures` attribute for this use case. + +In each `run` block the `expect_failures` attribute can provide a list of checkable objects (resources, data sources, check blocks, input variables, and outputs) that should fail their custom conditions. The test passes if the checkable objects you specify report an issue, and the test fails overall if they do not. + +You can still write assertions alongside an `expect_failures` block, but you should be mindful that all custom conditions, except check block assertions, halt the execution of Terraform. This still applies during test execution, so your assertions should only consider values that you are sure will be computed before the checkable object is due to fail. You can manage this using references, or the `depends_on` meta-argument within your main configuration. + +This also means that, with the exception of `check` blocks, you can only reliably include a single checkable object. We support a list of checkable objects within the `expect_failures` attribute purely for `check` blocks. + +A quick example below demonstrates testing the `validation` block on an input variable. The configuration file accepts a single input variable that must be even number. + +```hcl +# main.tf + +variable "input" { + type = number + + validation { + condition = var.input % 2 == 0 + error_message = "must be even number" + } +} +``` + +The test file contains two run blocks. One that validates that our custom condition passes on an even number and one that validates our custom condition fails on an odd number. + +```hcl +# input_validation.tftest.hcl + +variables { + input = 0 +} + +run "zero" { + # The variable defined above is even, so we expect the validation to pass. + + command = plan +} + +run "one" { + # This time we set the variable is odd, so we expect the validation to fail. + + command = plan + + variables { + input = 1 + } + + expect_failures = [ + var.input, + ] +} +``` + +> **Note**: Terraform only expects failures in the operation specified by the `command` attribute of the `run` block. + +Be careful when using `expect_failures` in `run` blocks with `command = apply`. A `run` block with `command = apply` that expects a custom condition failure will fail overall if that custom condition fails during the plan. + +This is logically consistent, as the `run` block is expecting to be able to run an apply operation but can not because the plan failed. It is also potentially confusing, as you will see the failure in the diagnostics as the reason the test failed, even though that failure was marked as being expected. + +There are instances when Terraform does not execute a custom condition during the planning stage, because that condition is relying on computed attributes that are only available after Terraform creates the referenced resource. In these cases, you could use an `expect_failures` block alongside a `command = apply` attribute and value. However, in most cases we recommend only using `expect_failures` alongside `command = plan` operations. + +> **Note**: Expected failures only apply to user-defined custom conditions. + +Other kinds of failure _besides_ the specified expected failures in the checkable object still result in the overall test failing. For example, a variable that expects a boolean value as input fails the surrounding test if Terraform provides the wrong kind of value, even if that variable is included in an `expect_failures` attribute. + +The `expect_failures` attribute is included to allow authors to test their configuration and any logic defined within. A type mismatch, as in the previous example, is not something Terraform authors should have to worry about testing as Terraform itself will handle enforce type constraints. As such, you can only `expect_failures` in custom conditions. diff --git a/website/docs/language/values/index.mdx b/website/docs/language/values/index.mdx deleted file mode 100644 index bd207554bfae..000000000000 --- a/website/docs/language/values/index.mdx +++ /dev/null @@ -1,20 +0,0 @@ ---- -page_title: Variables and Outputs -description: >- - An overview of input variables, output values, and local values in Terraform - language. ---- - -# Variables and Outputs - -The Terraform language includes a few kinds of blocks for requesting or -publishing named values. - -- [Input Variables](/terraform/language/values/variables) serve as parameters for - a Terraform module, so users can customize behavior without editing the source. - -- [Output Values](/terraform/language/values/outputs) are like return values for a - Terraform module. - -- [Local Values](/terraform/language/values/locals) are a convenience feature for - assigning a short name to an expression. diff --git a/website/docs/language/values/variables.mdx b/website/docs/language/variable/index.mdx similarity index 100% rename from website/docs/language/values/variables.mdx rename to website/docs/language/variable/index.mdx diff --git a/website/docs/language/variable/precedence.mdx b/website/docs/language/variable/precedence.mdx new file mode 100644 index 000000000000..4f5334124e8d --- /dev/null +++ b/website/docs/language/variable/precedence.mdx @@ -0,0 +1,40 @@ +--- +page_title: Variable definition precedence +description: >- + Input variables allow you to customize modules without altering their source + code. Learn how to declare, define, and reference variables in configurations. +--- + +# Variable definition precedence + +The above mechanisms for setting variables can be used together in any +combination. If the same variable is assigned multiple values, Terraform uses +the _last_ value it finds, overriding any previous values. Note that the same +variable cannot be assigned multiple values within a single source. + +Terraform loads variables in the following order, with later sources taking +precedence over earlier ones: + +* Environment variables +* The `terraform.tfvars` file, if present. +* The `terraform.tfvars.json` file, if present. +* Any `*.auto.tfvars` or `*.auto.tfvars.json` files, processed in lexical order + of their filenames. +* Any `-var` and `-var-file` options on the command line, in the order they + are provided. (This includes variables set by an HCP Terraform + workspace.) + +~> **Important:** In Terraform 0.12 and later, variables with map and object +values behave the same way as other variables: the last value found overrides +the previous values. This is a change from previous versions of Terraform, which +would _merge_ map values instead of overriding them. + +## Variable precedence within Terraform tests + +Within Terraform test files, you can specify variable values within +`variables` blocks, either nested within `run` blocks or defined directly within +the file. + +Variables defined in this way take precedence over all other mechanisms during +test execution, with variables defined within `run` blocks taking precedence +over those defined within the file. diff --git a/website/docs/language/variable/sensitive.mdx b/website/docs/language/variable/sensitive.mdx new file mode 100644 index 000000000000..cfcb257fae3a --- /dev/null +++ b/website/docs/language/variable/sensitive.mdx @@ -0,0 +1,10 @@ +--- +page_title: Variable sensitive data +description: >- + Input variables allow you to customize modules without altering their source + code. Learn how to declare, define, and reference variables in configurations. +--- + +# Variable sensitive data + +PLACEHOLDER \ No newline at end of file diff --git a/website/docs/language/version/dependency-lock-file.mdx b/website/docs/language/version/dependency-lock-file.mdx new file mode 100644 index 000000000000..98cfae9513c5 --- /dev/null +++ b/website/docs/language/version/dependency-lock-file.mdx @@ -0,0 +1,9 @@ +--- +page_title: Dependency lock file +description: >- + Import and manage existing resources with Terraform using configuration-driven import. +--- + +# Dependency lock file + +PLACEHOLDER \ No newline at end of file diff --git a/website/docs/language/version/index.mdx b/website/docs/language/version/index.mdx new file mode 100644 index 000000000000..69cfb5722ec3 --- /dev/null +++ b/website/docs/language/version/index.mdx @@ -0,0 +1,9 @@ +--- +page_title: Version configuration +description: >- + Import and manage existing resources with Terraform using configuration-driven import. +--- + +# Version configuration + +PLACEHOLDER \ No newline at end of file diff --git a/website/docs/language/version/vcs.mdx b/website/docs/language/version/vcs.mdx new file mode 100644 index 000000000000..4a006cf559ca --- /dev/null +++ b/website/docs/language/version/vcs.mdx @@ -0,0 +1,9 @@ +--- +page_title: Integrate with version source control +description: >- + Import and manage existing resources with Terraform using configuration-driven import. +--- + +# Integrate with version source control + +PLACEHOLDER \ No newline at end of file diff --git a/website/docs/language/state/workspaces.mdx b/website/docs/language/workspaces.mdx similarity index 100% rename from website/docs/language/state/workspaces.mdx rename to website/docs/language/workspaces.mdx From b94b6906aedb285471af845bdaa2450bd94fa170 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Date: Mon, 26 Aug 2024 15:29:43 -0700 Subject: [PATCH 2/3] create concepts section in /intro --- website/data/intro-nav-data.json | 10 +++++++++- website/docs/intro/{ => concepts}/core-workflow.mdx | 0 website/docs/intro/concepts/provider.mdx | 9 +++++++++ website/docs/intro/concepts/resource.mdx | 9 +++++++++ website/docs/intro/concepts/state.mdx | 9 +++++++++ 5 files changed, 36 insertions(+), 1 deletion(-) rename website/docs/intro/{ => concepts}/core-workflow.mdx (100%) create mode 100644 website/docs/intro/concepts/provider.mdx create mode 100644 website/docs/intro/concepts/resource.mdx create mode 100644 website/docs/intro/concepts/state.mdx diff --git a/website/data/intro-nav-data.json b/website/data/intro-nav-data.json index 4d0da480afdb..689152c82dbd 100644 --- a/website/data/intro-nav-data.json +++ b/website/data/intro-nav-data.json @@ -7,7 +7,15 @@ "href": "https://learn.hashicorp.com/collections/terraform/aws-get-started?utm_source=WEBSITE&utm_medium=WEB_IO&utm_offer=ARTICLE_PAGE&utm_content=DOCS" }, { "title": "Terraform Editions", "path": "terraform-editions" }, - { "title": "The Core Terraform Workflow", "path": "core-workflow" }, + { + "title": "Concepts", + "routes": [ + {"title": "Core Terraform workflow", "path": "concepts/core-workflow"}, + {"title": "Resource", "path": "concepts/resource"}, + {"title": "Provider", "path": "concepts/provider"}, + {"title": "State", "path": "concepts/state"} + ] + }, { "title": "Phases of Terraform Adoption", "routes": [ diff --git a/website/docs/intro/core-workflow.mdx b/website/docs/intro/concepts/core-workflow.mdx similarity index 100% rename from website/docs/intro/core-workflow.mdx rename to website/docs/intro/concepts/core-workflow.mdx diff --git a/website/docs/intro/concepts/provider.mdx b/website/docs/intro/concepts/provider.mdx new file mode 100644 index 000000000000..513dcdd5f302 --- /dev/null +++ b/website/docs/intro/concepts/provider.mdx @@ -0,0 +1,9 @@ +--- +page_title: Provider +description: |- + PLACEHOLDER +--- + +# Provider + +PLACEHOLDER for the provider concept page. This should be a deep dive into what a Terraform provider is. \ No newline at end of file diff --git a/website/docs/intro/concepts/resource.mdx b/website/docs/intro/concepts/resource.mdx new file mode 100644 index 000000000000..7c81879655ba --- /dev/null +++ b/website/docs/intro/concepts/resource.mdx @@ -0,0 +1,9 @@ +--- +page_title: Resource +description: |- + PLACEHOLDER +--- + +# Resource + +PLACEHOLDER for the resource concept page. This should be a deep dive into what a Terraform resource is. \ No newline at end of file diff --git a/website/docs/intro/concepts/state.mdx b/website/docs/intro/concepts/state.mdx new file mode 100644 index 000000000000..dc84f2c3f394 --- /dev/null +++ b/website/docs/intro/concepts/state.mdx @@ -0,0 +1,9 @@ +--- +page_title: State +description: |- + PLACEHOLDER +--- + +# State + +PLACEHOLDER for the state concept page. This should be a deep dive into how Terraform uses state. It should also include more internals/advanced things like state locking, graphs, etc. \ No newline at end of file From d4e51423d33d4e3b17cc7043c6ed934a4efbb514 Mon Sep 17 00:00:00 2001 From: Tu Nguyen Date: Wed, 28 Aug 2024 15:49:56 -0700 Subject: [PATCH 3/3] update broken nav and hidden meta-arg --- website/data/language-nav-data.json | 247 ++++++++++++++-------------- 1 file changed, 123 insertions(+), 124 deletions(-) diff --git a/website/data/language-nav-data.json b/website/data/language-nav-data.json index 9118b3fd2f69..54d8e5fd478c 100644 --- a/website/data/language-nav-data.json +++ b/website/data/language-nav-data.json @@ -397,39 +397,39 @@ "routes": [ { "title": "abs", - "href": "/language/functions/abs" + "href": "reference/functions/abs" }, { "title": "ceil", - "href": "/language/functions/ceil" + "href": "reference/functions/ceil" }, { "title": "floor", - "href": "/language/functions/floor" + "href": "reference/functions/floor" }, { "title": "log", - "href": "/language/functions/log" + "href": "reference/functions/log" }, { "title": "max", - "href": "/language/functions/max" + "href": "reference/functions/max" }, { "title": "min", - "href": "/language/functions/min" + "href": "reference/functions/min" }, { "title": "parseint", - "href": "/language/functions/parseint" + "href": "reference/functions/parseint" }, { "title": "pow", - "href": "/language/functions/pow" + "href": "reference/functions/pow" }, { "title": "signum", - "href": "/language/functions/signum" + "href": "reference/functions/signum" } ] }, @@ -438,91 +438,91 @@ "routes": [ { "title": "chomp", - "href": "/language/functions/chomp" + "href": "reference/functions/chomp" }, { "title": "endswith", - "href": "/language/functions/endswith" + "href": "reference/functions/endswith" }, { "title": "format", - "href": "/language/functions/format" + "href": "reference/functions/format" }, { "title": "formatlist", - "href": "/language/functions/formatlist" + "href": "reference/functions/formatlist" }, { "title": "indent", - "href": "/language/functions/indent" + "href": "reference/functions/indent" }, { "title": "join", - "href": "/language/functions/join" + "href": "reference/functions/join" }, { "title": "lower", - "href": "/language/functions/lower" + "href": "reference/functions/lower" }, { "title": "regex", - "href": "/language/functions/regex" + "href": "reference/functions/regex" }, { "title": "regexall", - "href": "/language/functions/regexall" + "href": "reference/functions/regexall" }, { "title": "replace", - "href": "/language/functions/replace" + "href": "reference/functions/replace" }, { "title": "split", - "href": "/language/functions/split" + "href": "reference/functions/split" }, { "title": "startswith", - "href": "/language/functions/startswith" + "href": "reference/functions/startswith" }, { "title": "strcontains", - "href": "/language/functions/strcontains" + "href": "reference/functions/strcontains" }, { "title": "strrev", - "href": "/language/functions/strrev" + "href": "reference/functions/strrev" }, { "title": "substr", - "href": "/language/functions/substr" + "href": "reference/functions/substr" }, { "title": "templatestring", - "href": "/language/functions/templatestring" + "href": "reference/functions/templatestring" }, { "title": "title", - "href": "/language/functions/title" + "href": "reference/functions/title" }, { "title": "trim", - "href": "/language/functions/trim" + "href": "reference/functions/trim" }, { "title": "trimprefix", - "href": "/language/functions/trimprefix" + "href": "reference/functions/trimprefix" }, { "title": "trimsuffix", - "href": "/language/functions/trimsuffix" + "href": "reference/functions/trimsuffix" }, { "title": "trimspace", - "href": "/language/functions/trimspace" + "href": "reference/functions/trimspace" }, { "title": "upper", - "href": "/language/functions/upper" + "href": "reference/functions/upper" } ] }, @@ -531,131 +531,131 @@ "routes": [ { "title": "alltrue", - "href": "/language/functions/alltrue" + "href": "reference/functions/alltrue" }, { "title": "anytrue", - "href": "/language/functions/anytrue" + "href": "reference/functions/anytrue" }, { "title": "chunklist", - "href": "/language/functions/chunklist" + "href": "reference/functions/chunklist" }, { "title": "coalesce", - "href": "/language/functions/coalesce" + "href": "reference/functions/coalesce" }, { "title": "coalescelist", - "href": "/language/functions/coalescelist" + "href": "reference/functions/coalescelist" }, { "title": "compact", - "href": "/language/functions/compact" + "href": "reference/functions/compact" }, { "title": "concat", - "href": "/language/functions/concat" + "href": "reference/functions/concat" }, { "title": "contains", - "href": "/language/functions/contains" + "href": "reference/functions/contains" }, { "title": "distinct", - "href": "/language/functions/distinct" + "href": "reference/functions/distinct" }, { "title": "element", - "href": "/language/functions/element" + "href": "reference/functions/element" }, { "title": "flatten", - "href": "/language/functions/flatten" + "href": "reference/functions/flatten" }, { "title": "index", - "href": "/language/functions/index_function" + "href": "reference/functions/index_function" }, { "title": "keys", - "href": "/language/functions/keys" + "href": "reference/functions/keys" }, { "title": "length", - "href": "/language/functions/length" + "href": "reference/functions/length" }, { "title": "list", - "href": "/language/functions/list" + "href": "reference/functions/list" }, { "title": "lookup", - "href": "/language/functions/lookup" + "href": "reference/functions/lookup" }, { "title": "map", - "href": "/language/functions/map" + "href": "reference/functions/map" }, { "title": "matchkeys", - "href": "/language/functions/matchkeys" + "href": "reference/functions/matchkeys" }, { "title": "merge", - "href": "/language/functions/merge" + "href": "reference/functions/merge" }, { "title": "one", - "href": "/language/functions/one" + "href": "reference/functions/one" }, { "title": "range", - "href": "/language/functions/range" + "href": "reference/functions/range" }, { "title": "reverse", - "href": "/language/functions/reverse" + "href": "reference/functions/reverse" }, { "title": "setintersection", - "href": "/language/functions/setintersection" + "href": "reference/functions/setintersection" }, { "title": "setproduct", - "href": "/language/functions/setproduct" + "href": "reference/functions/setproduct" }, { "title": "setsubtract", - "href": "/language/functions/setsubtract" + "href": "reference/functions/setsubtract" }, { "title": "setunion", - "href": "/language/functions/setunion" + "href": "reference/functions/setunion" }, { "title": "slice", - "href": "/language/functions/slice" + "href": "reference/functions/slice" }, { "title": "sort", - "href": "/language/functions/sort" + "href": "reference/functions/sort" }, { "title": "sum", - "href": "/language/functions/sum" + "href": "reference/functions/sum" }, { "title": "transpose", - "href": "/language/functions/transpose" + "href": "reference/functions/transpose" }, { "title": "values", - "href": "/language/functions/values" + "href": "reference/functions/values" }, { "title": "zipmap", - "href": "/language/functions/zipmap" + "href": "reference/functions/zipmap" } ] }, @@ -664,47 +664,47 @@ "routes": [ { "title": "base64decode", - "href": "/language/functions/base64decode" + "href": "reference/functions/base64decode" }, { "title": "base64encode", - "href": "/language/functions/base64encode" + "href": "reference/functions/base64encode" }, { "title": "base64gzip", - "href": "/language/functions/base64gzip" + "href": "reference/functions/base64gzip" }, { "title": "csvdecode", - "href": "/language/functions/csvdecode" + "href": "reference/functions/csvdecode" }, { "title": "jsondecode", - "href": "/language/functions/jsondecode" + "href": "reference/functions/jsondecode" }, { "title": "jsonencode", - "href": "/language/functions/jsonencode" + "href": "reference/functions/jsonencode" }, { "title": "textdecodebase64", - "href": "/language/functions/textdecodebase64" + "href": "reference/functions/textdecodebase64" }, { "title": "textencodebase64", - "href": "/language/functions/textencodebase64" + "href": "reference/functions/textencodebase64" }, { "title": "urlencode", - "href": "/language/functions/urlencode" + "href": "reference/functions/urlencode" }, { "title": "yamldecode", - "href": "/language/functions/yamldecode" + "href": "reference/functions/yamldecode" }, { "title": "yamlencode", - "href": "/language/functions/yamlencode" + "href": "reference/functions/yamlencode" } ] }, @@ -713,39 +713,39 @@ "routes": [ { "title": "abspath", - "href": "/language/functions/abspath" + "href": "reference/functions/abspath" }, { "title": "dirname", - "href": "/language/functions/dirname" + "href": "reference/functions/dirname" }, { "title": "pathexpand", - "href": "/language/functions/pathexpand" + "href": "reference/functions/pathexpand" }, { "title": "basename", - "href": "/language/functions/basename" + "href": "reference/functions/basename" }, { "title": "file", - "href": "/language/functions/file" + "href": "reference/functions/file" }, { "title": "fileexists", - "href": "/language/functions/fileexists" + "href": "reference/functions/fileexists" }, { "title": "fileset", - "href": "/language/functions/fileset" + "href": "reference/functions/fileset" }, { "title": "filebase64", - "href": "/language/functions/filebase64" + "href": "reference/functions/filebase64" }, { "title": "templatefile", - "href": "/language/functions/templatefile" + "href": "reference/functions/templatefile" } ] }, @@ -754,23 +754,23 @@ "routes": [ { "title": "formatdate", - "href": "/language/functions/formatdate" + "href": "reference/functions/formatdate" }, { "title": "plantimestamp", - "href": "/language/functions/plantimestamp" + "href": "reference/functions/plantimestamp" }, { "title": "timeadd", - "href": "/language/functions/timeadd" + "href": "reference/functions/timeadd" }, { "title": "timecmp", - "href": "/language/functions/timecmp" + "href": "reference/functions/timecmp" }, { "title": "timestamp", - "href": "/language/functions/timestamp" + "href": "reference/functions/timestamp" } ] }, @@ -779,67 +779,67 @@ "routes": [ { "title": "base64sha256", - "href": "/language/functions/base64sha256" + "href": "reference/functions/base64sha256" }, { "title": "base64sha512", - "href": "/language/functions/base64sha512" + "href": "reference/functions/base64sha512" }, { "title": "bcrypt", - "href": "/language/functions/bcrypt" + "href": "reference/functions/bcrypt" }, { "title": "filebase64sha256", - "href": "/language/functions/filebase64sha256" + "href": "reference/functions/filebase64sha256" }, { "title": "filebase64sha512", - "href": "/language/functions/filebase64sha512" + "href": "reference/functions/filebase64sha512" }, { "title": "filemd5", - "href": "/language/functions/filemd5" + "href": "reference/functions/filemd5" }, { "title": "filesha1", - "href": "/language/functions/filesha1" + "href": "reference/functions/filesha1" }, { "title": "filesha256", - "href": "/language/functions/filesha256" + "href": "reference/functions/filesha256" }, { "title": "filesha512", - "href": "/language/functions/filesha512" + "href": "reference/functions/filesha512" }, { "title": "md5", - "href": "/language/functions/md5" + "href": "reference/functions/md5" }, { "title": "rsadecrypt", - "href": "/language/functions/rsadecrypt" + "href": "reference/functions/rsadecrypt" }, { "title": "sha1", - "href": "/language/functions/sha1" + "href": "reference/functions/sha1" }, { "title": "sha256", - "href": "/language/functions/sha256" + "href": "reference/functions/sha256" }, { "title": "sha512", - "href": "/language/functions/sha512" + "href": "reference/functions/sha512" }, { "title": "uuid", - "href": "/language/functions/uuid" + "href": "reference/functions/uuid" }, { "title": "uuidv5", - "href": "/language/functions/uuidv5" + "href": "reference/functions/uuidv5" } ] }, @@ -848,19 +848,19 @@ "routes": [ { "title": "cidrhost", - "href": "/language/functions/cidrhost" + "href": "reference/functions/cidrhost" }, { "title": "cidrnetmask", - "href": "/language/functions/cidrnetmask" + "href": "reference/functions/cidrnetmask" }, { "title": "cidrsubnet", - "href": "/language/functions/cidrsubnet" + "href": "reference/functions/cidrsubnet" }, { "title": "cidrsubnets", - "href": "/language/functions/cidrsubnets" + "href": "reference/functions/cidrsubnets" } ] }, @@ -869,51 +869,51 @@ "routes": [ { "title": "can", - "href": "/language/functions/can" + "href": "reference/functions/can" }, { "title": "issensitive", - "href": "/language/functions/issensitive" + "href": "reference/functions/issensitive" }, { "title": "nonsensitive", - "href": "/language/functions/nonsensitive" + "href": "reference/functions/nonsensitive" }, { "title": "sensitive", - "href": "/language/functions/sensitive" + "href": "reference/functions/sensitive" }, { "title": "tobool", - "href": "/language/functions/tobool" + "href": "reference/functions/tobool" }, { "title": "tolist", - "href": "/language/functions/tolist" + "href": "reference/functions/tolist" }, { "title": "tomap", - "href": "/language/functions/tomap" + "href": "reference/functions/tomap" }, { "title": "tonumber", - "href": "/language/functions/tonumber" + "href": "reference/functions/tonumber" }, { "title": "toset", - "href": "/language/functions/toset" + "href": "reference/functions/toset" }, { "title": "tostring", - "href": "/language/functions/tostring" + "href": "reference/functions/tostring" }, { "title": "try", - "href": "/language/functions/try" + "href": "reference/functions/try" }, { "title": "type", - "href": "/language/functions/type" + "href": "reference/functions/type" } ] }, @@ -922,15 +922,15 @@ "routes": [ { "title": "provider::terraform::encode_tfvars", - "href": "/language/functions/terraform-encode_tfvars" + "href": "reference/functions/terraform-encode_tfvars" }, { "title": "provider::terraform::decode_tfvars", - "href": "/language/functions/terraform-decode_tfvars" + "href": "reference/functions/terraform-decode_tfvars" }, { "title": "provider::terraform::encode_expr", - "href": "/language/functions/terraform-encode_expr" + "href": "reference/functions/terraform-encode_expr" } ] }, @@ -1553,7 +1553,6 @@ }, { "title": "Meta-Arguments", - "hidden": true, "routes": [ { "title": "count",