diff --git a/.icons/aws.svg b/.icons/aws.svg new file mode 100644 index 0000000..3244c97 --- /dev/null +++ b/.icons/aws.svg @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.icons/azure.svg b/.icons/azure.svg new file mode 100644 index 0000000..645ac66 --- /dev/null +++ b/.icons/azure.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.icons/fly.svg b/.icons/fly.svg new file mode 100644 index 0000000..0d0086b --- /dev/null +++ b/.icons/fly.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.icons/gcp.svg b/.icons/gcp.svg new file mode 100644 index 0000000..0f234a4 --- /dev/null +++ b/.icons/gcp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/.icons/jupyter.svg b/.icons/jupyter.svg new file mode 100644 index 0000000..bc94e3d --- /dev/null +++ b/.icons/jupyter.svg @@ -0,0 +1,90 @@ + +Group.svg +Created using Figma 0.90 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.icons/kasmvnc.svg b/.icons/kasmvnc.svg new file mode 100644 index 0000000..958f283 --- /dev/null +++ b/.icons/kasmvnc.svg @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/aws-region/README.md b/aws-region/README.md new file mode 100644 index 0000000..ecd27ac --- /dev/null +++ b/aws-region/README.md @@ -0,0 +1,65 @@ +--- +display_name: AWS Region +description: A parameter with human region names and icons +icon: ../.icons/aws.svg +maintainer_github: coder +verified: true +tags: [helper, parameter] +--- + +# AWS Region + +A parameter with all AWS regions. This allows developers to select +the region closest to them. + +## Examples + +### Default Region + +Customize the preselected parameter value: + +```hcl +module "aws-region" { + source = "https://registry.coder.com/modules/aws-region" + default = "us-east-1" +} + +provider "aws" { + region = module.aws_region.value +} +``` + +### Customize Regions + +Change the display name and icon for a region: + +```hcl +module "aws-region" { + source = "https://registry.coder.com/modules/aws-region" + custom_names = { + "fra": "Awesome Germany!" + } + custom_icons = { + "fra": "/icons/smiley.svg" + } +} + +provider "aws" { + region = module.aws_region.value +} +``` + +### Exclude Regions + +Hide the `fra` region: + +```hcl +module "aws-region" { + source = "https://registry.coder.com/modules/aws-region" + exclude = [ "fra" ] +} + +provider "aws" { + region = module.aws_region.value +} +``` diff --git a/aws-region/main.tf b/aws-region/main.tf new file mode 100644 index 0000000..11f43b5 --- /dev/null +++ b/aws-region/main.tf @@ -0,0 +1,148 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + coder = { + source = "coder/coder" + version = ">= 0.12" + } + } +} + +variable "display_name" { + default = "AWS Region" + description = "The display name of the parameter." + type = string +} + +variable "description" { + default = "The region to deploy workspace infrastructure." + description = "The description of the parameter." + type = string +} + +variable "default" { + default = "us-east-1" + description = "The default region to use if no region is specified." + type = string +} + +variable "mutable" { + default = false + description = "Whether the parameter can be changed after creation." + type = bool +} + +variable "custom_names" { + default = {} + description = "A map of custom display names for region IDs." + type = map(string) +} + +variable "custom_icons" { + default = {} + description = "A map of custom icons for region IDs." + type = map(string) +} + +variable "exclude" { + default = [] + description = "A list of region IDs to exclude." + type = list(string) +} + +locals { + # This is a static list because the regions don't change _that_ + # frequently and including the `aws_regions` data source requires + # the provider, which requires a region. + regions = { + "ap-northeast-1" = { + name = "Asia Pacific (Tokyo)" + icon = "/emojis/1f1ef-1f1f5.png" + } + "ap-northeast-2" = { + name = "Asia Pacific (Seoul)" + icon = "/emojis/1f1f0-1f1f7.png" + } + "ap-northeast-3" = { + name = "Asia Pacific (Osaka)" + icon = "/emojis/1f1ef-1f1f5.png" + } + "ap-south-1" = { + name = "Asia Pacific (Mumbai)" + icon = "/emojis/1f1ee-1f1f3.png" + } + "ap-southeast-1" = { + name = "Asia Pacific (Singapore)" + icon = "/emojis/1f1f8-1f1ec.png" + } + "ap-southeast-2" = { + name = "Asia Pacific (Sydney)" + icon = "/emojis/1f1e6-1f1fa.png" + } + "ca-central-1" = { + name = "Canada (Central)" + icon = "/emojis/1f1e8-1f1e6.png" + } + "eu-central-1" = { + name = "EU (Frankfurt)" + icon = "/emojis/1f1ea-1f1fa.png" + } + "eu-north-1" = { + name = "EU (Stockholm)" + icon = "/emojis/1f1ea-1f1fa.png" + } + "eu-west-1" = { + name = "EU (Ireland)" + icon = "/emojis/1f1ea-1f1fa.png" + } + "eu-west-2" = { + name = "EU (London)" + icon = "/emojis/1f1ea-1f1fa.png" + } + "eu-west-3" = { + name = "EU (Paris)" + icon = "/emojis/1f1ea-1f1fa.png" + } + "sa-east-1" = { + name = "South America (São Paulo)" + icon = "/emojis/1f1e7-1f1f7.png" + } + "us-east-1" = { + name = "US East (N. Virginia)" + icon = "/emojis/1f1fa-1f1f8.png" + } + "us-east-2" = { + name = "US East (Ohio)" + icon = "/emojis/1f1fa-1f1f8.png" + } + "us-west-1" = { + name = "US West (N. California)" + icon = "/emojis/1f1fa-1f1f8.png" + } + "us-west-2" = { + name = "US West (Oregon)" + icon = "/emojis/1f1fa-1f1f8.png" + } + } +} + +data "coder_parameter" "region" { + name = "aws_region" + display_name = var.display_name + description = var.description + default = var.default + mutable = var.mutable + dynamic "option" { + for_each = { for k, v in local.regions : k => v if !(contains(var.exclude, k)) } + content { + name = try(var.custom_names[option.key], option.value.name) + icon = try(var.custom_icons[option.key], option.value.icon) + value = option.key + } + } +} + +output "value" { + value = data.coder_parameter.region.value +} diff --git a/azure-region/README.md b/azure-region/README.md new file mode 100644 index 0000000..afeaa37 --- /dev/null +++ b/azure-region/README.md @@ -0,0 +1,16 @@ +--- +display_name: Azure Region +description: A parameter with human region names and icons +icon: ../.icons/azure.svg +maintainer_github: coder +verified: true +tags: [helper, parameter, azure] +--- + +# Azure Region + +A parameter with all Azure regions. This allows developers to select the region closest to them. + +## Examples + +TODO \ No newline at end of file diff --git a/code-server/README.md b/code-server/README.md index 9b63912..6f068ed 100644 --- a/code-server/README.md +++ b/code-server/README.md @@ -11,15 +11,14 @@ tags: [helper, ide] Automatically install [code-server](https://github.com/coder/code-server) in a workspace, create an app to access it via the dashboard, install extensions, and pre-configure editor settings. -![Screenshot 1](https://github.com/coder/code-server/raw/main/docs/assets/screenshot-1.png?raw=true) -![Screenshot 2](https://github.com/coder/code-server/raw/main/docs/assets/screenshot-2.png?raw=true) - -## Highlights +```hcl +module "code-server" { + source = "https://registry.coder.com/modules/code-server" + agent_id = coder_agent.example.id +} +``` -- Code on any device with a consistent development environment -- Use cloud servers to speed up tests, compilations, downloads, and more -- Preserve battery life when you're on the go; all intensive tasks run on your - server +![Screenshot 1](https://github.com/coder/code-server/raw/main/docs/assets/screenshot-1.png?raw=true) ## Examples @@ -30,6 +29,7 @@ Install the Dracula theme from [OpenVSX](https://open-vsx.org/): ```hcl module "code-server" { source = "https://registry.coder.com/modules/code-server" + agent_id = coder_agent.example.id extensions = [ "dracula-theme.theme-dracula" ] @@ -45,6 +45,7 @@ Configure VS Code's [settings.json](https://code.visualstudio.com/docs/getstarte ```hcl module "settings" { source = "https://registry.coder.com/modules/code-server" + agent_id = coder_agent.example.id extensions = [ "dracula-theme.theme-dracula" ] settings = { "workbench.colorTheme" = "Dracula" @@ -59,6 +60,7 @@ Just run code-server in the background, don't fetch it from GitHub: ```hcl module "settings" { source = "https://registry.coder.com/modules/code-server" + agent_id = coder_agent.example.id offline = true } ``` \ No newline at end of file diff --git a/fly-region/README.md b/fly-region/README.md new file mode 100644 index 0000000..96babc3 --- /dev/null +++ b/fly-region/README.md @@ -0,0 +1,16 @@ +--- +display_name: Fly.io Region +description: A parameter with human region names and icons +icon: ../.icons/fly.svg +maintainer_github: coder +verified: true +tags: [helper, parameter, fly] +--- + +# Fly.io Region + +A parameter with all fly.io regions. This allows developers to select the region closest to them. + +## Examples + +TODO \ No newline at end of file diff --git a/gcp-region/README.md b/gcp-region/README.md new file mode 100644 index 0000000..6746c81 --- /dev/null +++ b/gcp-region/README.md @@ -0,0 +1,16 @@ +--- +display_name: Google Cloud Region +description: A parameter with human region names and icons +icon: ../.icons/gcp.svg +maintainer_github: coder +verified: true +tags: [helper, parameter, azure] +--- + +# Google Cloud Region + +A parameter with all Google Cloud regions. This allows developers to select the region closest to them. + +## Examples + +TODO \ No newline at end of file diff --git a/jupyterhub/README.md b/jupyterhub/README.md new file mode 100644 index 0000000..ab123ed --- /dev/null +++ b/jupyterhub/README.md @@ -0,0 +1,16 @@ +--- +display_name: JupyterHub +description: A multi-user version of the notebook designed for companies, classrooms and research labs +icon: ../.icons/jupyter.svg +maintainer_github: coder +verified: true +tags: [helper, ide] +--- + +# JupyterHub + +Automatically install [JupyterHub](https://jupyter.org/hub) in a workspace, and create an app to access it via the dashboard. + +## Examples + +TODO \ No newline at end of file diff --git a/kasmvnc/README.md b/kasmvnc/README.md new file mode 100644 index 0000000..1803268 --- /dev/null +++ b/kasmvnc/README.md @@ -0,0 +1,16 @@ +--- +display_name: KasmVNC +description: A modern open source VNC server +icon: ../.icons/kasmvnc.svg +maintainer_github: coder +verified: true +tags: [helper, ide] +--- + +# KasmVNC + +Automatically install [KasmVNC](https://kasmweb.com/kasmvnc) in a workspace, and create an app to access it via the dashboard. + +## Examples + +TODO \ No newline at end of file