Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfb7958

Browse files
committed
fix: copy updates
Signed-off-by: Danny Kopping <[email protected]>
1 parent 1edc98f commit dfb7958

File tree

1 file changed

+37
-42
lines changed

1 file changed

+37
-42
lines changed

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

+37-42
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ Prebuilt workspaces are:
1313
- Claimed transparently when developers create workspaces.
1414
- Monitored and replaced automatically to maintain your desired pool size.
1515

16+
## Relationship to workspace presets
17+
18+
Prebuilt workspaces are tightly integrated with [workspace presets](./parameters.md#workspace-presets-beta):
19+
20+
1. Each prebuilt workspace is associated with a specific template preset.
21+
1. The preset must define all required parameters needed to build the workspace.
22+
1. The preset parameters define the base configuration and are immutable once a prebuilt workspace is provisioned.
23+
1. Parameters that are not defined in the preset can still be customized by users when they claim a workspace.
24+
1625
## Prerequisites
1726

1827
- [**Premium license**](../../licensing/index.md)
@@ -21,7 +30,7 @@ Prebuilt workspaces are:
2130

2231
## Enable prebuilt workspaces for template presets
2332

24-
In your template, add a `prebuilds` block within a `coder_workspace_preset` block to identify how many prebuilt
33+
In your template, add a `prebuilds` block within a `coder_workspace_preset` definition to identify how many prebuilt
2534
instances your Coder deployment should maintain:
2635

2736
```hcl
@@ -38,79 +47,65 @@ instances your Coder deployment should maintain:
3847
}
3948
```
4049

41-
After you create or update the template, Coder automatically provisions and maintains prebuilt workspaces through an
42-
internal reconciliation loop (similar to Kubernetes) to maintain the number of specified `instances`.
43-
44-
Prebuilt workspaces are displayed in the list of workspaces on the Coder dashboard with the owner set to `prebuilds`.
50+
After you publish a new template version, Coder will automatically provision and maintain prebuilt workspaces through an
51+
internal reconciliation loop (similar to Kubernetes) to ensure the defined `instances` count are running.
4552

4653
## Prebuilt workspace lifecycle
4754

4855
Prebuilt workspaces follow a specific lifecycle from creation through eligibility to claiming.
4956

50-
Expand each item in this list for more information about the stage:
57+
1. After you configure a preset with prebuilds and publish the template, Coder provisions the prebuilt workspace(s).
5158

52-
1. <details><summary>After you configure a preset with a prebuilt workspace and publish the template, Coder provisions
53-
the prebuilt workspace(s).</summary>
54-
55-
1. Coder automatically creates prebuilt workspaces up to the specified `instances` count.
56-
1. Each new prebuild is initially owned by an unprivileged system pseudo-user named `prebuilds`.
59+
1. Coder automatically creates the defined `instances` count of prebuilt workspaces.
60+
1. Each new prebuilt workspace is initially owned by an unprivileged system pseudo-user named `prebuilds`.
5761
- The `prebuilds` user belongs to the `Everyone` group (you can add it to additional groups if needed).
5862
1. Each prebuilt workspace receives a randomly generated name for identification.
59-
1. The workspace is provisioned like a regular workspace.
60-
61-
</details>
63+
1. The workspace is provisioned like a regular workspace; only its ownership distinguishes it as a prebuilt workspace.
6264

63-
1. <details><summary>Coder prepares the prebuilt workspace to be claimed by a developer.</summary>
65+
1. Prebuilt workspaces start up and become eligible to be claimed by a developer.
6466

6567
Before a prebuilt workspace is available to users:
6668

67-
1. The workspace reaches `running` state.
68-
1. The agent connects to coderd.
69-
1. The agent starts its bootstrap procedures and startup scripts complete successfully.
69+
1. The workspace is provisioned.
70+
1. The agent starts up and connects to coderd.
71+
1. The agent starts its bootstrap procedures and completes its startup scripts.
7072
1. The agent reports `ready` status.
7173

72-
Prebuilt workspaces that fail during provisioning are retried with an exponential backoff to prevent transient failures.
74+
Only once the agent reports `ready` is the prebuilt workspace considered eligible.
7375

74-
</details>
76+
Prebuilt workspaces that fail during provisioning are retried with a backoff to prevent transient failures.
7577

76-
1. <details><summary>When a developer selects requests a new workspace, the claiming process occurs:</summary>
78+
1. When a developer requests a new workspace, the claiming process occurs:
7779

7880
1. Developer selects a template and preset that has prebuilt workspaces configured.
79-
1. If an eligible prebuilt workspace exists, it's automatically assigned to the user.
80-
1. Ownership transfers from the `prebuilds` user to the requesting user.
81+
1. If an eligible prebuilt workspace exists, ownership transfers from the `prebuilds` user to the requesting user.
8182
1. The workspace name changes to the user's requested name.
82-
1. The process is transparent to the developer - they simply see a workspace ready faster than normal.
83+
1. `terraform apply` is executed using the new ownership details, which may affect the [`coder_workspace`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace) and
84+
[`coder_workspace_owner`](https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner)
85+
datasources (see [Preventing resource replacement](#preventing-resource-replacement) for further considerations).
8386

84-
This ownership transfer happens automatically without any special action required by the user.
85-
86-
</details>
87+
The process is transparent to the developer - they simply see a workspace ready faster than normal.
8788

8889
You can view available prebuilt workspaces in the **Workspaces** view in the Coder dashboard:
8990

9091
![A prebuilt workspace in the dashboard](../../../images/admin/templates/extend-templates/prebuilt/prebuilt-workspaces.png)
9192

93+
_Note the search term `owner:prebuilds`._
94+
9295
### Template updates and the prebuilt workspace lifecycle
9396

94-
Prebuilt workspaces have specific behavior when templates are updated:
97+
Prebuilt workspaces are not updated after they are provisioned.
98+
99+
When a template's active version is updated:
95100

96-
1. When a template version changes, prebuilt workspaces for old versions are automatically deleted.
101+
1. Prebuilt workspaces for old versions are automatically deleted.
97102
1. New prebuilt workspaces are created for the active template version.
98-
1. Prebuilt workspaces aren't automatically updated after creation.
99-
1. If dependencies change (e.g., an [AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) update) without a template version change, you can:
100-
- Delete the existing prebuilt workspaces manually.
103+
1. If dependencies change (e.g., an [AMI](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AMIs.html) update) without a template version change:
104+
- You may delete the existing prebuilt workspaces manually.
101105
- Coder will automatically create new prebuilt workspaces with the updated dependencies.
102106

103107
The system always maintains the desired number of prebuilt workspaces for the active template version.
104108

105-
### Relationship to workspace presets
106-
107-
Prebuilt workspaces are tightly integrated with [workspace presets](./parameters.md#workspace-presets-beta):
108-
109-
1. Each prebuilt workspace is associated with a specific template preset.
110-
1. The preset must define all required parameters needed to build the workspace.
111-
1. The preset parameters define the base configuration and are immutable after they're claimed.
112-
1. Parameters that are not defined in the preset can still be customized by users when they claim a workspace.
113-
114109
## Administration and troubleshooting
115110

116111
### Managing resource quotas
@@ -129,7 +124,7 @@ If a quota is exceeded, the prebuilt workspace will fail provisioning the same w
129124

130125
When a prebuilt workspace is claimed, another `terraform apply` run occurs with new values for the workspace owner and name.
131126

132-
This can cause issues:
127+
This can cause issues in the following scenario:
133128

134129
1. The workspace is initially created with values from the `prebuilds` user and a random name.
135130
1. After claiming, various workspace properties change (ownership, name, and potentially other values), which Terraform sees as configuration drift.

0 commit comments

Comments
 (0)