mirror of
https://github.com/coder/coder.git
synced 2026-11-03 05:55:24 +08:00
Add 6 new base templates to the template builder, covering all major cloud providers and platforms: - **scratch**: Minimal starter template with only `coder_agent` and metadata - **aws-windows**: AWS EC2 Windows instances with PowerShell user_data - **azure-linux**: Azure VMs with cloud-init and managed disk persistence - **gcp-linux**: Google Compute Engine Linux instances with persistent disk - **gcp-windows**: Google Compute Engine Windows instances - **digitalocean-linux**: DigitalOcean Linux droplets with persistent volumes Each base includes `base.json`, `main.tf.tmpl`, `README.md` (with prerequisite markers), and any static files (cloud-init configs). Tests verify all 9 bases load, render without error, and produce valid single-agent declarations. `azure-windows` is deferred; it needs to be registered in the `examples` package first. Depends on #26633 > [!NOTE] > This PR was authored by Coder Agents on behalf of @jeremyruppel. --- NB: This is very much an agent-generated PR and draws completely from base templates that exist in `examples/templates/`. The base.json files are new, so review those, but don't spend any brain tokens on the correctness of the terraform and supporting files: any issues there are issues with the upstream example template
63 lines
2.0 KiB
Markdown
63 lines
2.0 KiB
Markdown
---
|
|
display_name: Google Compute Engine (Linux)
|
|
description: Provision Google Compute Engine instances as Coder workspaces
|
|
icon: ../../../site/static/icon/gcp.png
|
|
maintainer_github: coder
|
|
verified: true
|
|
tags: [vm, linux, gcp]
|
|
---
|
|
|
|
# Remote Development on Google Compute Engine (Linux)
|
|
|
|
<!-- prerequisites:start -->
|
|
|
|
## Prerequisites
|
|
|
|
### Authentication
|
|
|
|
This template assumes that coderd is run in an environment that is authenticated
|
|
with Google Cloud. For example, run `gcloud auth application-default login` to
|
|
import credentials on the system and user running coderd. For other ways to
|
|
authenticate [consult the Terraform
|
|
docs](https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/getting_started#adding-credentials).
|
|
|
|
Coder requires a Google Cloud Service Account to provision workspaces. To create
|
|
a service account:
|
|
|
|
1. Navigate to the [CGP
|
|
console](https://console.cloud.google.com/projectselector/iam-admin/serviceaccounts/create),
|
|
and select your Cloud project (if you have more than one project associated
|
|
with your account)
|
|
|
|
1. Provide a service account name (this name is used to generate the service
|
|
account ID)
|
|
|
|
1. Click **Create and continue**, and choose the following IAM roles to grant to
|
|
the service account:
|
|
|
|
- Compute Admin
|
|
- Service Account User
|
|
|
|
Click **Continue**.
|
|
|
|
1. Click on the created key, and navigate to the **Keys** tab.
|
|
|
|
1. Click **Add key** > **Create new key**.
|
|
|
|
1. Generate a **JSON private key**, which will be what you provide to Coder
|
|
during the setup process.
|
|
|
|
<!-- prerequisites:end -->
|
|
|
|
## Architecture
|
|
|
|
This template provisions the following resources:
|
|
|
|
- GCP VM (ephemeral)
|
|
- GCP Disk (persistent, mounted to root)
|
|
|
|
Coder persists the root volume. The full filesystem is preserved when the workspace restarts. See this [community example](https://github.com/bpmct/coder-templates/tree/main/aws-linux-ephemeral) of an ephemeral AWS instance.
|
|
|
|
> **Note**
|
|
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
|