This repository contains Terraform configuration and a startup script to provision a remote C++ development environment with code-server on Google Cloud.
With this setup, you can start coding in C++ in a browser-based VS Code environment, complete with Clang, LLDB, CMake, and preconfigured VS Code extensions.
Before you begin, make sure you have:
- A Google Cloud account: https://console.cloud.google.com
- A GCP project (e.g.,
cpp-tutorial-code-serve
) - Billing enabled on the project (free tier is sufficient)
- Cloud SDK installed on your local machine: https://cloud.google.com/sdk/docs/install
- Terraform installed: https://developer.hashicorp.com/terraform
- A local SSH key (
~/.ssh/id_rsa
or similar) for connecting to the VM
Once these prerequisites are ready, you can provision the VM and start coding.
git clone git@github.com:YOURUSERNAME/cpp-tutorial-code-serve.git
cd cpp-tutorial-code-serve
Initialize Terraform
terraform init
terraform apply
Terraform will create a VM and firewall rules.
Wait for the startup script to finish installing packages.
Connect via SSH
ssh -L 8080:localhost:8080 your-username@your-vm-ip
Add code-server authentication
code-server supports a password or token-based login. You can set this in ~/.config/code-server/config.yaml:
auth: password
password: "some-strong-password"
Combined with SSH tunneling, that’s already double protection.
- Access code-server
Open a browser and go to:
http://127.0.0.1:8080 Use the password defined in the startup script.