mirror of
https://github.com/coder/coder.git
synced 2026-11-02 13:33:30 +08:00
## Summary The DigitalOcean template builder base declared Terraform `variable` blocks for `project_uuid` and `ssh_key_id` that the template builder never filled. `project_uuid` was required with no default, so the build broke with no way to supply a value from the wizard (DEVEX-591). This brings the DigitalOcean base to parity with the GCP bases fixed in #27015: - Declare `project_uuid` (required) and `ssh_key_id` (optional, default `0`) in `base.json` so the wizard prompts for them on the first step. - Inject the entered values via `default = {{ .Variables.* }}` in `main.tf.tmpl`, keeping the existing `variable` blocks and validation. - Drop the `sensitive` flags. The variable-injection path (`mergeBaseVariables`, `DefaultBaseRenderContext`, and the snapshot test helper) skips sensitive variables, so a sensitive base variable renders empty. A project UUID / SSH key ID are not secrets. - Update the README now that the values are prompted rather than manually edited. - Regenerate the `digitalocean-linux.tf.golden` snapshot. ## Testing - `go test ./coderd/templatebuilder/` <img width="1048" height="616" alt="Screenshot 2026-07-15 at 12 44 42 PM" src="https://github.com/user-attachments/assets/89e334ca-e904-4387-9264-6ed1614a40ba" /> <details> <summary>Audit of all template builder bases for unfilled variables</summary> | Base | Variable status | Verdict | |------|-----------------|---------| | aws-linux | no HCL `variable` blocks; provider env auth | OK | | aws-windows | same | OK | | azure-linux | same | OK | | **digitalocean-linux** | `project_uuid` (required, no default) + `ssh_key_id`; absent from `base.json` | **Fixed here** | | docker | `docker_socket` has `default = ""`; `container_image` via `{{ .Variables }}` + declared | OK | | gcp-linux | fixed in #27015 | OK | | gcp-windows | fixed in #27015 | OK | | kubernetes | `namespace` (required), `use_kubeconfig`, `container_image` all via `{{ .Variables }}` + declared | OK | | scratch | no variables | OK | DigitalOcean was the only broken base; all others either have safe defaults or already declare their variables. **Mechanism note:** `base.json` `variables[]` drives the first-step prompts and values are injected as HCL literals via `{{ .Variables.<name> }}` (strings quoted, numbers/bools raw; supported types: string, number, bool). Sensitive/computed variables are intentionally skipped everywhere the injection map is built, so they cannot currently be injected. That is why the `sensitive` flags were removed here. </details> --- *This PR was generated by Coder Agents on behalf of @jeremyruppel.*
51 lines
2.1 KiB
Markdown
51 lines
2.1 KiB
Markdown
---
|
|
display_name: DigitalOcean Droplet (Linux)
|
|
description: Provision DigitalOcean Droplets as Coder workspaces
|
|
icon: ../../../site/static/icon/do.png
|
|
maintainer_github: coder
|
|
verified: true
|
|
tags: [vm, linux, digitalocean]
|
|
---
|
|
|
|
# Remote Development on DigitalOcean Droplets
|
|
|
|
Provision DigitalOcean Droplets as [Coder workspaces](https://coder.com/docs/user-guides/workspace-management) with this example template.
|
|
|
|
<!-- prerequisites:start -->
|
|
|
|
## Prerequisites
|
|
|
|
To deploy workspaces as DigitalOcean Droplets, you'll need:
|
|
|
|
- DigitalOcean [personal access token (PAT)](https://docs.digitalocean.com/reference/api/create-personal-access-token)
|
|
|
|
- DigitalOcean project ID, which the template builder prompts for. You can get
|
|
your project information via the `doctl` CLI by running `doctl projects list`.
|
|
|
|
- **Optional:** DigitalOcean SSH key ID, which the template builder prompts for
|
|
(obtain via the `doctl` CLI by running `doctl compute ssh-key list`).
|
|
|
|
- Note that this is only required for Fedora images to work. Leave it as `0`
|
|
if you don't need it.
|
|
|
|
### Authentication
|
|
|
|
This template assumes that the Coder Provisioner is run in an environment that is authenticated with Digital Ocean.
|
|
|
|
Obtain a [Digital Ocean Personal Access Token](https://cloud.digitalocean.com/account/api/tokens) and set the `DIGITALOCEAN_TOKEN` environment variable to the access token.
|
|
For other ways to authenticate [consult the Terraform provider's docs](https://registry.terraform.io/providers/digitalocean/digitalocean/latest/docs).
|
|
|
|
<!-- prerequisites:end -->
|
|
|
|
## Architecture
|
|
|
|
This template provisions the following resources:
|
|
|
|
- DigitalOcean VM (ephemeral, deleted on stop)
|
|
- Managed disk (persistent, mounted to `/home/coder`)
|
|
|
|
This means, when the workspace restarts, any tools or files outside of the home directory are not persisted. To pre-bake tools into the workspace (e.g. `python3`), modify the VM image, or use a [startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/script).
|
|
|
|
> [!NOTE]
|
|
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
|