Last active
October 25, 2025 17:35
-
-
Save xSAVIKx/78eaeb461417f265fda71771cf8bb872 to your computer and use it in GitHub Desktop.
GCP Cloud Workstations minimal setup with Pulumi, Typescript and Bun
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as gcp from "@pulumi/gcp"; | |
| const region = "us-central1"; | |
| const gcpProvider = new gcp.Provider("gcpProvider", { | |
| project: gcp.config.project, | |
| region: region, | |
| defaultLabels: { team: "devops" }, | |
| }); | |
| const enableServices = (services: string[]) => { | |
| return services.map((service) => { | |
| return new gcp.projects.Service( | |
| service, | |
| { | |
| service: service, | |
| project: gcp.config.project, | |
| }, | |
| { provider: gcpProvider }, | |
| ); | |
| }); | |
| }; | |
| const requiredServices = [ | |
| "compute.googleapis.com", | |
| "workstations.googleapis.com", | |
| ]; | |
| const services = enableServices(requiredServices); | |
| export default async function main() { | |
| const wsNetwork = new gcp.compute.Network( | |
| "wsNetwork", | |
| { | |
| autoCreateSubnetworks: false, | |
| }, | |
| { | |
| provider: gcpProvider, | |
| dependsOn: services, | |
| }, | |
| ); | |
| const wsSubnetwork = new gcp.compute.Subnetwork( | |
| "wsUsCentral1Subnet", | |
| { | |
| network: wsNetwork.id, | |
| region: region, | |
| ipCidrRange: "10.128.0.0/20", | |
| }, | |
| { | |
| provider: gcpProvider, | |
| parent: wsNetwork, | |
| }, | |
| ); | |
| const wsCluster: gcp.workstations.WorkstationCluster = | |
| new gcp.workstations.WorkstationCluster( | |
| "developmentCluster", | |
| { | |
| workstationClusterId: "test-cluster", | |
| network: wsNetwork.id, | |
| subnetwork: wsSubnetwork.id, | |
| location: region, | |
| displayName: "Test Cluster", | |
| annotations: { | |
| description: "Minimal cluster for testing", | |
| }, | |
| labels: { | |
| purpose: "test", | |
| }, | |
| }, | |
| { provider: gcpProvider, dependsOn: services }, | |
| ); | |
| const wsMinimalConfig = new gcp.workstations.WorkstationConfig( | |
| "wsMinimalConfig", | |
| { | |
| workstationConfigId: "minimal-config", | |
| workstationClusterId: wsCluster.workstationClusterId, | |
| location: region, | |
| }, | |
| { provider: gcpProvider, dependsOn: services }, | |
| ); | |
| const workstation = new gcp.workstations.Workstation( | |
| "test-workstation", | |
| { | |
| workstationId: "test-workstation", | |
| workstationConfigId: wsMinimalConfig.workstationConfigId, | |
| workstationClusterId: wsCluster.workstationClusterId, | |
| location: region, | |
| }, | |
| { provider: gcpProvider, dependsOn: services }, | |
| ); | |
| return { | |
| wsCluster: wsCluster.name, | |
| wsConfig: wsMinimalConfig.name, | |
| workstation: workstation.host, | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment