You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/templates/resource-persistence.md
+14-16Lines changed: 14 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Resource Persistence
2
2
3
-
Coder doesn't prescribe your workspace's level of ephemerality. In a
3
+
Coder templates have full control over workspace ephemerality. In a
4
4
completely ephemeral workspace, there are zero resources in the On state. In
5
5
a completely persistent workspace, there is no difference between the Off and
6
6
On states.
@@ -9,13 +9,14 @@ Most workspaces fall somewhere in the middle, persisting user data
9
9
such as filesystem volumes, but deleting expensive, reproducible resources
10
10
such as compute instances.
11
11
12
-
By default, all Coder resources are persistent, but there are practices all
13
-
production templates **must** employ to prevent accidental deletion.
12
+
By default, all Coder resources are persistent, but
13
+
production templates **must** employ the practices laid out in this document
14
+
to prevent accidental deletion.
14
15
15
16
## Disabling Persistence
16
17
17
18
The [`coder_workspace` data source](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace) exposes the `start_count = [0 | 1]` attribute that other
18
-
resources use to become ephemeral.
19
+
resources reference to become ephemeral.
19
20
20
21
For example:
21
22
@@ -24,7 +25,7 @@ data "coder_workspace" "me" {
24
25
}
25
26
26
27
resource "docker_container" "workspace" {
27
-
# ephemeral resource (deleted when workspace is stopped, created when started)
28
+
# When `start_count` is 0, `count` is 0, so no `docker_container` is created.
Even if we depend exclusively static IDs, a change to the `name` format or other
68
-
attributes would cause Terraform to rebuild the resource.
69
-
70
-
Bulletproof persistent resources by setting the [`ignore_changes = all` directive in the `lifecycle` block](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes). This
71
-
setting prevents Terraform from recreating the resource under any circumstance.
66
+
## 🛡 Bulletproofing
67
+
Even if our persistent resource depends exclusively on static IDs, a change to
68
+
the `name` format or other attributes would cause Terraform to rebuild the resource.
72
69
70
+
Prevent Terraform from recreating the resource under any circumstance by setting the [`ignore_changes = all` directive in the `lifecycle` block](https://developer.hashicorp.com/terraform/language/meta-arguments/lifecycle#ignore_changes).
0 commit comments