Skip to content

Commit b7b91be

Browse files
committed
docs: Documenting mutable attribute
1 parent 4b0556f commit b7b91be

3 files changed

Lines changed: 54 additions & 8 deletions

File tree

docs/src/content/docs/03-features/02-stacks/03-explicit.mdx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,19 @@ When `update_source_with_cas = true` is set:
412412

413413
Consumers do not set `update_source_with_cas` themselves. When the `cas` experiment is enabled and the source is remote, Terragrunt uses the CAS path automatically. The attribute only has effect inside catalog files, where it flags nested `source` attributes for rewriting.
414414

415-
`unit` and `stack` blocks also accept a `mutable` attribute. When `mutable = true`, the unit's or stack's content under `.terragrunt-stack` is copied from the CAS store instead of hardlinked. The default is `false`, which lets CAS hardlink files for speed and deduplication. Set this when you intend to edit files in `.terragrunt-stack` directly: hardlinked files share an inode with the shared store, so editing them in place would corrupt it.
415+
<Before version="1.0.4">
416+
417+
<Aside type="tip">
418+
A `mutable` attribute that opts a `unit` or `stack` block out of CAS hardlinking is coming in v1.0.4.
419+
</Aside>
420+
421+
</Before>
422+
423+
<Since version="1.0.4">
424+
425+
`unit` and `stack` blocks also accept a `mutable` attribute. When `mutable = true`, the unit's or stack's content under `.terragrunt-stack` is copied from the CAS store instead of hardlinked. The default is `false`, which lets CAS hardlink files for speed and deduplication. Hardlinked files inherit the store's read-only permissions, so the working tree is safe by default; set `mutable = true` when you want to edit files in `.terragrunt-stack` directly.
426+
427+
</Since>
416428

417429
Given the catalog files above, and an ordinary consumer stack like:
418430

docs/src/content/docs/04-reference/01-hcl/02-blocks.mdx

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ sidebar:
88

99
import FileTree from '@components/vendored/starlight/FileTree.astro';
1010
import { Aside } from '@astrojs/starlight/components';
11+
import Since from '@components/Since.astro';
12+
import Before from '@components/Before.astro';
1113

1214
Terragrunt HCL configuration uses [configuration blocks](https://github.com/hashicorp/hcl/blob/main/hclsyntax/spec.md#blocks) when there's a structural configuration that needs to be defined for Terragrunt.
1315

@@ -69,13 +71,6 @@ The `terraform` block supports the following arguments:
6971

7072
*Note that if you wish to exclude files from being copied from a terraform module source, you should use the [before_hook](/features/units/hooks) feature.*
7173

72-
- `mutable` (attribute): When `true`, content fetched into `.terragrunt-cache` is copied from the
73-
[content-addressable storage (CAS)](/features/caching/cas) instead of hardlinked. The default is `false`,
74-
which lets CAS hardlink files from its shared store for speed and deduplication. Set this to `true` when you
75-
intend to edit files inside `.terragrunt-cache` directly: hardlinked files share an inode with the CAS store,
76-
so editing them in place would corrupt the store. The flag has no effect when CAS is not used to fetch the
77-
source; the standard download path already produces an independent copy.
78-
7974
- `copy_terraform_lock_file` (attribute): In certain use cases, you don't want to check the terraform provider lock
8075
file into your source repository from your working directory as described in
8176
[Lock File Handling](/reference/lock-files). This attribute allows you to disable the copy
@@ -118,6 +113,26 @@ The `terraform` block supports the following arguments:
118113
error must match one of the expressions listed in the `on_errors` attribute. Error hooks are executed after the before/after hooks.
119114
To handle errors during source download (when using the `source` attribute), use `init-from-module` in the `commands` list.
120115

116+
<Before version="1.0.4">
117+
118+
<Aside type="tip">
119+
A `mutable` attribute that opts a `terraform` block out of CAS hardlinking is coming in v1.0.4.
120+
</Aside>
121+
122+
</Before>
123+
124+
<Since version="1.0.4">
125+
126+
- `mutable` (attribute): When `true`, content fetched into `.terragrunt-cache` through the
127+
[content-addressable storage (CAS)](/features/caching/cas) is copied from the CAS store instead of
128+
hardlinked. The default is `false`, which lets CAS hardlink files from its shared store for speed and
129+
deduplication. Hardlinked files inherit the store's read-only permissions, so the working tree is safe
130+
by default; set `mutable = true` when you want to edit files inside `.terragrunt-cache` directly. The
131+
flag has no effect when CAS is not used to fetch the source; the standard download path already
132+
produces an independent, writable copy.
133+
134+
</Since>
135+
121136
In addition to supporting before and after hooks for all OpenTofu/Terraform commands, the following specialized hooks are also
122137
supported:
123138

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
version: "v1.0.4"
3+
category: "experiments-updated"
4+
---
5+
6+
#### `cas``mutable` attribute on `terraform`, `unit`, and `stack` blocks
7+
8+
A new `mutable` attribute opts a block out of CAS hardlinking when its source is fetched through CAS. With `mutable = true`, files materialized into `.terragrunt-cache` (for `terraform`) or `.terragrunt-stack` (for `unit` and `stack`) are copied from the CAS store rather than hardlinked from it.
9+
10+
The default is `false`, which preserves the existing hardlink behavior. Hardlinked files inherit the CAS store's read-only permissions, so the working tree is safe by default; set `mutable = true` when you want to edit files inside the destination directory.
11+
12+
```hcl
13+
terraform {
14+
source = "git::https://github.com/acme/infrastructure-modules.git//vpc?ref=v1.0.0"
15+
mutable = true
16+
}
17+
```
18+
19+
The flag is orthogonal to `update_source_with_cas` and has no effect when content is fetched through the standard download path, which already produces an independent copy.

0 commit comments

Comments
 (0)