Skip to content

Commit ba5ce86

Browse files
committed
chore: reduce ignore_changes suggestion scope (#17947)
We probably shouldn't be suggesting `ignore_changes = all`. Only the attributes which cause drift in prebuilds should be ignored; everything else can behave as normal. --------- Signed-off-by: Danny Kopping <dannykopping@gmail.com> Co-authored-by: Edward Angert <EdwardAngert@users.noreply.github.com>
1 parent 1f54c36 commit ba5ce86

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

docs/admin/templates/extending-templates/prebuilt-workspaces.md

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ To prevent this, add a `lifecycle` block with `ignore_changes`:
142142
```hcl
143143
resource "docker_container" "workspace" {
144144
lifecycle {
145-
ignore_changes = all
145+
ignore_changes = [env, image] # include all fields which caused drift
146146
}
147147
148148
count = data.coder_workspace.me.start_count
@@ -151,19 +151,8 @@ resource "docker_container" "workspace" {
151151
}
152152
```
153153

154-
For more targeted control, specify which attributes to ignore:
155-
156-
```hcl
157-
resource "docker_container" "workspace" {
158-
lifecycle {
159-
ignore_changes = [name]
160-
}
161-
162-
count = data.coder_workspace.me.start_count
163-
name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
164-
...
165-
}
166-
```
154+
Limit the scope of `ignore_changes` to include only the fields specified in the notification.
155+
If you include too many fields, Terraform might ignore changes that wouldn't otherwise cause drift.
167156

168157
Learn more about `ignore_changes` in the [Terraform documentation](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes).
169158

0 commit comments

Comments
 (0)