From 09743d57e80154dc79017648c82e255e6ab34173 Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Tue, 20 May 2025 17:07:11 +0200 Subject: [PATCH 1/2] chore: reduce ignore_changes suggestion scope Signed-off-by: Danny Kopping --- .../extending-templates/prebuilt-workspaces.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/docs/admin/templates/extending-templates/prebuilt-workspaces.md b/docs/admin/templates/extending-templates/prebuilt-workspaces.md index 3fd82d62d1943..5165c69dd46f0 100644 --- a/docs/admin/templates/extending-templates/prebuilt-workspaces.md +++ b/docs/admin/templates/extending-templates/prebuilt-workspaces.md @@ -142,7 +142,7 @@ To prevent this, add a `lifecycle` block with `ignore_changes`: ```hcl resource "docker_container" "workspace" { lifecycle { - ignore_changes = all + ignore_changes = [env, image] # include all fields which caused drift } count = data.coder_workspace.me.start_count @@ -151,19 +151,9 @@ resource "docker_container" "workspace" { } ``` -For more targeted control, specify which attributes to ignore: - -```hcl -resource "docker_container" "workspace" { - lifecycle { - ignore_changes = [name] - } - - count = data.coder_workspace.me.start_count - name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}" - ... -} -``` +Try to keep `ignore_changes` scoped to just the fields which were called out in the notification. Excessive use of +`ignore_changes` can lead to undesirable outcomes in Terraform, like innocuous changes (which wouldn't cause replacements) +to be ignored. Learn more about `ignore_changes` in the [Terraform documentation](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes). From de676fb5c651564df776c26b87943f47b2ad1cca Mon Sep 17 00:00:00 2001 From: Danny Kopping Date: Tue, 20 May 2025 22:03:26 +0200 Subject: [PATCH 2/2] Update docs/admin/templates/extending-templates/prebuilt-workspaces.md Co-authored-by: Edward Angert --- .../templates/extending-templates/prebuilt-workspaces.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/admin/templates/extending-templates/prebuilt-workspaces.md b/docs/admin/templates/extending-templates/prebuilt-workspaces.md index 5165c69dd46f0..57f3dc0b3109f 100644 --- a/docs/admin/templates/extending-templates/prebuilt-workspaces.md +++ b/docs/admin/templates/extending-templates/prebuilt-workspaces.md @@ -151,9 +151,8 @@ resource "docker_container" "workspace" { } ``` -Try to keep `ignore_changes` scoped to just the fields which were called out in the notification. Excessive use of -`ignore_changes` can lead to undesirable outcomes in Terraform, like innocuous changes (which wouldn't cause replacements) -to be ignored. +Limit the scope of `ignore_changes` to include only the fields specified in the notification. +If you include too many fields, Terraform might ignore changes that wouldn't otherwise cause drift. Learn more about `ignore_changes` in the [Terraform documentation](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes).