From 9b0886ae6a6325323ce218ed159172675c19807b Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Sat, 16 Nov 2024 17:05:39 +0000 Subject: [PATCH 1/3] feat: promote module usage --- examples/templates/gcp-windows/main.tf | 79 ++++++++++++-------------- 1 file changed, 36 insertions(+), 43 deletions(-) diff --git a/examples/templates/gcp-windows/main.tf b/examples/templates/gcp-windows/main.tf index 74ff06109a83a..883f5f54f3414 100644 --- a/examples/templates/gcp-windows/main.tf +++ b/examples/templates/gcp-windows/main.tf @@ -9,64 +9,58 @@ terraform { } } -provider "coder" { -} +provider "coder" {} variable "project_id" { description = "Which Google Compute Project should your workspace live in?" } -data "coder_parameter" "zone" { - name = "zone" - display_name = "Zone" - description = "Which zone should your workspace live in?" - type = "string" - default = "us-central1-a" - icon = "/emojis/1f30e.png" - mutable = false - option { - name = "North America (Northeast)" - value = "northamerica-northeast1-a" - icon = "/emojis/1f1fa-1f1f8.png" - } - option { - name = "North America (Central)" - value = "us-central1-a" - icon = "/emojis/1f1fa-1f1f8.png" - } - option { - name = "North America (West)" - value = "us-west2-c" - icon = "/emojis/1f1fa-1f1f8.png" - } - option { - name = "Europe (West)" - value = "europe-west4-b" - icon = "/emojis/1f1ea-1f1fa.png" - } - option { - name = "South America (East)" - value = "southamerica-east1-a" - icon = "/emojis/1f1e7-1f1f7.png" - } +# See https://registry.coder.com/modules/code-server +module "code-server" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/code-server/coder" + + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + order = 1 +} + +# See https://registry.coder.com/modules/jetbrains-gateway +module "jetbrains_gateway" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/jetbrains-gateway/coder" + + # JetBrains IDEs to make available for the user to select + jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"] + default = "IU" + + # Default folder to open when starting a JetBrains IDE + folder = "/home/coder" + + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + agent_name = "main" + order = 2 } provider "google" { - zone = data.coder_parameter.zone.value + zone = module.gcp_region.value project = var.project_id } -data "coder_workspace" "me" { -} +data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} -data "google_compute_default_service_account" "default" { -} +data "google_compute_default_service_account" "default" {} resource "google_compute_disk" "root" { name = "coder-${data.coder_workspace.me.id}-root" type = "pd-ssd" - zone = data.coder_parameter.zone.value + zone = module.gcp_region.value image = "projects/windows-cloud/global/images/windows-server-2022-dc-core-v20220215" lifecycle { ignore_changes = [name, image] @@ -77,11 +71,10 @@ resource "coder_agent" "main" { auth = "google-instance-identity" arch = "amd64" os = "windows" - } resource "google_compute_instance" "dev" { - zone = data.coder_parameter.zone.value + zone = module.gcp_region.value count = data.coder_workspace.me.start_count name = "coder-${lower(data.coder_workspace_owner.me.name)}-${lower(data.coder_workspace.me.name)}" machine_type = "e2-medium" From dc776a39b2d139019f46769b2608580804647f9e Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Wed, 27 Nov 2024 12:43:38 +0000 Subject: [PATCH 2/3] fix: add GCP region module --- examples/templates/gcp-windows/main.tf | 63 +++++++++++++++----------- 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/examples/templates/gcp-windows/main.tf b/examples/templates/gcp-windows/main.tf index 883f5f54f3414..ab311b648132f 100644 --- a/examples/templates/gcp-windows/main.tf +++ b/examples/templates/gcp-windows/main.tf @@ -15,36 +15,15 @@ variable "project_id" { description = "Which Google Compute Project should your workspace live in?" } -# See https://registry.coder.com/modules/code-server -module "code-server" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/modules/code-server/coder" +# See https://registry.coder.com/modules/gcp-region +module "gcp_region" { + source = "registry.coder.com/modules/gcp-region/coder" # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. version = ">= 1.0.0" - agent_id = coder_agent.main.id - order = 1 -} - -# See https://registry.coder.com/modules/jetbrains-gateway -module "jetbrains_gateway" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/modules/jetbrains-gateway/coder" - - # JetBrains IDEs to make available for the user to select - jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"] - default = "IU" - - # Default folder to open when starting a JetBrains IDE - folder = "/home/coder" - - # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. - version = ">= 1.0.0" - - agent_id = coder_agent.main.id - agent_name = "main" - order = 2 + regions = ["us", "europe"] + default = "us-central1-a" } provider "google" { @@ -73,6 +52,38 @@ resource "coder_agent" "main" { os = "windows" } +# See https://registry.coder.com/modules/code-server +module "code-server" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/code-server/coder" + + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + order = 1 +} + +# See https://registry.coder.com/modules/jetbrains-gateway +module "jetbrains_gateway" { + count = data.coder_workspace.me.start_count + source = "registry.coder.com/modules/jetbrains-gateway/coder" + + # JetBrains IDEs to make available for the user to select + jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"] + default = "IU" + + # Default folder to open when starting a JetBrains IDE + folder = "/home/coder" + + # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. + version = ">= 1.0.0" + + agent_id = coder_agent.main.id + agent_name = "main" + order = 2 +} + resource "google_compute_instance" "dev" { zone = module.gcp_region.value count = data.coder_workspace.me.start_count From 1ba51ed8ffdfbd2de8159c667cb2c4566e466a2e Mon Sep 17 00:00:00 2001 From: Phorcys <57866459+phorcys420@users.noreply.github.com> Date: Thu, 28 Nov 2024 03:57:02 +0000 Subject: [PATCH 3/3] fix: remove jetbrains gateway and code-server modules --- examples/templates/gcp-windows/main.tf | 32 -------------------------- 1 file changed, 32 deletions(-) diff --git a/examples/templates/gcp-windows/main.tf b/examples/templates/gcp-windows/main.tf index ab311b648132f..28f64ee232051 100644 --- a/examples/templates/gcp-windows/main.tf +++ b/examples/templates/gcp-windows/main.tf @@ -52,38 +52,6 @@ resource "coder_agent" "main" { os = "windows" } -# See https://registry.coder.com/modules/code-server -module "code-server" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/modules/code-server/coder" - - # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. - version = ">= 1.0.0" - - agent_id = coder_agent.main.id - order = 1 -} - -# See https://registry.coder.com/modules/jetbrains-gateway -module "jetbrains_gateway" { - count = data.coder_workspace.me.start_count - source = "registry.coder.com/modules/jetbrains-gateway/coder" - - # JetBrains IDEs to make available for the user to select - jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"] - default = "IU" - - # Default folder to open when starting a JetBrains IDE - folder = "/home/coder" - - # This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production. - version = ">= 1.0.0" - - agent_id = coder_agent.main.id - agent_name = "main" - order = 2 -} - resource "google_compute_instance" "dev" { zone = module.gcp_region.value count = data.coder_workspace.me.start_count pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy