From e574234efc09e77c8eedebda78ff7c098adbbc96 Mon Sep 17 00:00:00 2001 From: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com> Date: Fri, 29 Jul 2022 15:24:04 -0400 Subject: [PATCH 1/2] Add note about module.path and local module sources --- website/docs/language/expressions/references.mdx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/website/docs/language/expressions/references.mdx b/website/docs/language/expressions/references.mdx index cada96a0c1..032e6ed5e6 100644 --- a/website/docs/language/expressions/references.mdx +++ b/website/docs/language/expressions/references.mdx @@ -118,14 +118,16 @@ to mark the reference as for a data resource. ### Filesystem and Workspace Info -* `path.module` is the filesystem path of the module where the expression - is placed. -* `path.root` is the filesystem path of the root module of the configuration. -* `path.cwd` is the filesystem path of the current working directory. In +The following values are available: + +- `path.module` is the filesystem path of the module where the expression + is placed. You can use `path.module` in write operations, but we do not recommend this when using local module sources. Multiple invocations of local modules use the same source directory, overwriting the data in `path.module` during each call. This can lead to race conditions and unexpected results. +- `path.root` is the filesystem path of the root module of the configuration. +- `path.cwd` is the filesystem path of the current working directory. In normal use of Terraform this is the same as `path.root`, but some advanced uses of Terraform run it from a directory other than the root module directory, causing these paths to be different. -* `terraform.workspace` is the name of the currently selected +- `terraform.workspace` is the name of the currently selected [workspace](/language/state/workspaces). Use the values in this section carefully, because they include information From f6aeecb59295b02ba132196117ad071d347dffc1 Mon Sep 17 00:00:00 2001 From: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com> Date: Fri, 29 Jul 2022 16:52:58 -0400 Subject: [PATCH 2/2] Update website/docs/language/expressions/references.mdx --- website/docs/language/expressions/references.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/website/docs/language/expressions/references.mdx b/website/docs/language/expressions/references.mdx index 032e6ed5e6..947013a36f 100644 --- a/website/docs/language/expressions/references.mdx +++ b/website/docs/language/expressions/references.mdx @@ -120,8 +120,7 @@ to mark the reference as for a data resource. The following values are available: -- `path.module` is the filesystem path of the module where the expression - is placed. You can use `path.module` in write operations, but we do not recommend this when using local module sources. Multiple invocations of local modules use the same source directory, overwriting the data in `path.module` during each call. This can lead to race conditions and unexpected results. +- `path.module` is the filesystem path of the module where the expression is placed. We do not recommend using `path.module` in write operations because it can produce different behavior depending on whether you use remote or local module sources. Multiple invocations of local modules use the same source directory, overwriting the data in `path.module` during each call. This can lead to race conditions and unexpected results. - `path.root` is the filesystem path of the root module of the configuration. - `path.cwd` is the filesystem path of the current working directory. In normal use of Terraform this is the same as `path.root`, but some advanced