Merge branch 'main' into GCP-AWS-regions
						commit
						b29938ca1b
					
				@ -0,0 +1,64 @@
 | 
				
			|||||||
 | 
					<svg width="64" height="64" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
 | 
				
			||||||
 | 
					<path d="M32 62L57.975 46.98V16.964L32 2L6.02602 16.964H6.02502L32 31.984V62Z" fill="url(#paint0_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M57.975 16.964L32 2L6.02602 16.964H6.02502L32 31.984L57.975 16.964Z" fill="url(#paint1_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M57.975 16.964L32 2L6.02602 16.964H6.02502L32 31.984L57.975 16.964Z" fill="url(#paint2_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M57.975 16.964L32 2L6.02602 16.964H6.02502L32 31.984L57.975 16.964Z" fill="url(#paint3_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M6.026 46.9799V16.9639L32 31.9839L6.026 46.9799Z" fill="url(#paint4_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M32 31.9844L6.026 46.9804L32 62.0004V31.9844Z" fill="url(#paint5_linear_1725:872)" style="mix-blend-mode:overlay"/>
 | 
				
			||||||
 | 
					<path d="M32 61.9999L57.975 46.9799V16.9639L32 31.9839V61.9999Z" fill="url(#paint6_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M32 61.9999L57.975 46.9799V16.9639L32 31.9839V61.9999Z" fill="url(#paint7_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<path d="M32 61.9999L57.975 46.9799V16.9639L32 31.9839V61.9999Z" fill="url(#paint8_linear_1725:872)"/>
 | 
				
			||||||
 | 
					<g opacity="0.8">
 | 
				
			||||||
 | 
					<path d="M25.028 27.9699L32 32V2L6 16.972L25.028 27.9699Z" fill="url(#paint9_linear_1725:872)" style="mix-blend-mode:overlay"/>
 | 
				
			||||||
 | 
					</g>
 | 
				
			||||||
 | 
					<defs>
 | 
				
			||||||
 | 
					<linearGradient id="paint0_linear_1725:872" x1="17.0683" y1="11.5629" x2="61.3962" y2="55.8908" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="#FDB60D"/>
 | 
				
			||||||
 | 
					<stop offset="0.54795" stop-color="#FF318C"/>
 | 
				
			||||||
 | 
					<stop offset="0.88765" stop-color="#6B57FF"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint1_linear_1725:872" x1="25.5898" y1="28.0668" x2="28.4505" y2="23.112" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="white" stop-opacity="0.6"/>
 | 
				
			||||||
 | 
					<stop offset="0.08098" stop-color="#FFC524" stop-opacity="0.4"/>
 | 
				
			||||||
 | 
					<stop offset="0.70457" stop-color="#FFC524" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint2_linear_1725:872" x1="25.4334" y1="5.59024" x2="29.6963" y2="12.9738" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="#F9ED32" stop-opacity="0.6"/>
 | 
				
			||||||
 | 
					<stop offset="0.19796" stop-color="#FFC524" stop-opacity="0.4"/>
 | 
				
			||||||
 | 
					<stop offset="0.70457" stop-color="#FFC524" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint3_linear_1725:872" x1="38.9129" y1="4.99057" x2="37.0135" y2="8.28029" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="#FDB60D" stop-opacity="0.6"/>
 | 
				
			||||||
 | 
					<stop offset="0.23369" stop-color="#FDB60D" stop-opacity="0.4"/>
 | 
				
			||||||
 | 
					<stop offset="0.5185" stop-color="#FF318C" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint4_linear_1725:872" x1="6.02553" y1="31.972" x2="48.2774" y2="31.972" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop offset="0.01477"/>
 | 
				
			||||||
 | 
					<stop offset="0.19258"/>
 | 
				
			||||||
 | 
					<stop offset="0.57156" stop-color="#6B57FF"/>
 | 
				
			||||||
 | 
					<stop offset="0.82576" stop-color="#FF318C"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint5_linear_1725:872" x1="25.2369" y1="19.192" x2="18.7738" y2="55.8462" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop offset="0.046628" stop-color="white" stop-opacity="0.86"/>
 | 
				
			||||||
 | 
					<stop offset="0.766654" stop-color="#CBCAA4" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint6_linear_1725:872" x1="32.0001" y1="39.4819" x2="38.997" y2="39.4819" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="#FFB2FF" stop-opacity="0.6"/>
 | 
				
			||||||
 | 
					<stop offset="0.08098" stop-color="#D828FF" stop-opacity="0.4"/>
 | 
				
			||||||
 | 
					<stop offset="0.70457" stop-color="#FF318C" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint7_linear_1725:872" x1="58.0814" y1="39.4819" x2="50.9352" y2="39.4819" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop  offset="0" stop-color="#6644FF" stop-opacity="0.8"/>
 | 
				
			||||||
 | 
					<stop offset="0.09676" stop-color="#6B57FF" stop-opacity="0.4"/>
 | 
				
			||||||
 | 
					<stop offset="0.70457" stop-color="#FF318C" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint8_linear_1725:872" x1="51.8655" y1="51.3952" x2="49.8093" y2="47.8337" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop offset="0.00572" stop-color="#FF318C"/>
 | 
				
			||||||
 | 
					<stop offset="0.46934" stop-color="#6B57FF" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					<linearGradient id="paint9_linear_1725:872" x1="18.9999" y1="2.93734" x2="18.9999" y2="20.5615" gradientUnits="userSpaceOnUse">
 | 
				
			||||||
 | 
					<stop offset="0.23873" stop-color="#FF5592" stop-opacity="0.65"/>
 | 
				
			||||||
 | 
					<stop offset="0.8289" stop-color="#FF57E4" stop-opacity="0"/>
 | 
				
			||||||
 | 
					</linearGradient>
 | 
				
			||||||
 | 
					</defs>
 | 
				
			||||||
 | 
					</svg>
 | 
				
			||||||
| 
		 After Width: | Height: | Size: 4.2 KiB  | 
@ -0,0 +1,41 @@
 | 
				
			|||||||
 | 
					---
 | 
				
			||||||
 | 
					display_name: JetBrains Gateway
 | 
				
			||||||
 | 
					description: Add a one-click button to launch JetBrains Gateway IDEs in the dashboard.
 | 
				
			||||||
 | 
					icon: ../.icons/gateway.svg
 | 
				
			||||||
 | 
					maintainer_github: coder
 | 
				
			||||||
 | 
					verified: true
 | 
				
			||||||
 | 
					tags: [ide, jetbrains, gateway, goland, webstorm, intellij, pycharm, phpstorm, clion, rubymine, datagrip, rider]
 | 
				
			||||||
 | 
					---
 | 
				
			||||||
 | 
					# JetBrains Gateway
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This module adds a JetBrains Gateway IDEs to your Coder template.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## How to use this module
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					To use this module, add the following snippet to your template manifest:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```hcl
 | 
				
			||||||
 | 
					module "jetbrains_gateway" {
 | 
				
			||||||
 | 
					  source                   = "https://registry.coder.com/modules/jetbrains-gateway"
 | 
				
			||||||
 | 
					  agent_id                 = coder_agent.main.id
 | 
				
			||||||
 | 
					  agent_name               = "main"
 | 
				
			||||||
 | 
					  project_directory        = "/home/coder/project"
 | 
				
			||||||
 | 
					  gateway_ide_product_code = ["GO","WS"] # A list of JetBrains product codes use ["ALL"] for all products
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					## Supported IDEs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The following JetBrains IDEs are supported:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- GoLand (`GO`)
 | 
				
			||||||
 | 
					- WebStorm (`WS`)
 | 
				
			||||||
 | 
					- IntelliJ IDEA Ultimate (`IU`)
 | 
				
			||||||
 | 
					- IntelliJ IDEA Community (`IC`)
 | 
				
			||||||
 | 
					- PyCharm Professional (`PY`)
 | 
				
			||||||
 | 
					- PyCharm Community (`PC`)
 | 
				
			||||||
 | 
					- PhpStorm (`PS`)
 | 
				
			||||||
 | 
					- CLion (`CL`)
 | 
				
			||||||
 | 
					- RubyMine (`RM`)
 | 
				
			||||||
 | 
					- DataGrip (`DB`)
 | 
				
			||||||
 | 
					- Rider (`RD`)
 | 
				
			||||||
@ -0,0 +1,129 @@
 | 
				
			|||||||
 | 
					terraform {
 | 
				
			||||||
 | 
					  required_version = ">= 1.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  required_providers {
 | 
				
			||||||
 | 
					    coder = {
 | 
				
			||||||
 | 
					      source  = "coder/coder"
 | 
				
			||||||
 | 
					      version = ">= 0.11"
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					variable "agent_id" {
 | 
				
			||||||
 | 
					  type        = string
 | 
				
			||||||
 | 
					  description = "The ID of a Coder agent."
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					variable "agent_name" {
 | 
				
			||||||
 | 
					  type        = string
 | 
				
			||||||
 | 
					  description = "The name of a Coder agent."
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					variable "project_directory" {
 | 
				
			||||||
 | 
					  type        = string
 | 
				
			||||||
 | 
					  description = "The directory to open in the IDE. e.g. /home/coder/project"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					variable "gateway_ide_product_code" {
 | 
				
			||||||
 | 
					  type        = list(string)
 | 
				
			||||||
 | 
					  description = "The list of IDE product codes, e.g. ['GO', 'WS'] or ['ALL']"
 | 
				
			||||||
 | 
					  default     = ["ALL"]
 | 
				
			||||||
 | 
					  validation {
 | 
				
			||||||
 | 
					    condition = (
 | 
				
			||||||
 | 
					      length(var.gateway_ide_product_code) == 1 && var.gateway_ide_product_code[0] == "ALL" ||
 | 
				
			||||||
 | 
					      alltrue([
 | 
				
			||||||
 | 
					        for code in var.gateway_ide_product_code : contains(["IU", "IC", "PS", "WS", "PY", "PC", "CL", "GO", "DB", "RD", "RM"], code)
 | 
				
			||||||
 | 
					      ])
 | 
				
			||||||
 | 
					    )
 | 
				
			||||||
 | 
					    error_message = "The gateway_ide_product_code must be ['ALL'] or a list of valid product codes. https://plugins.jetbrains.com/docs/marketplace/product-codes.html"
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					locals {
 | 
				
			||||||
 | 
					  gateway_ides = {
 | 
				
			||||||
 | 
					    "GO" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/goland.svg",
 | 
				
			||||||
 | 
					      name  = "GoLand",
 | 
				
			||||||
 | 
					      value = jsonencode(["GO", "232.9921.53", "https://download.jetbrains.com/go/goland-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "WS" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/webstorm.svg",
 | 
				
			||||||
 | 
					      name  = "WebStorm",
 | 
				
			||||||
 | 
					      value = jsonencode(["WS", "232.9921.42", "https://download.jetbrains.com/webstorm/WebStorm-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "IU" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/intellij.svg",
 | 
				
			||||||
 | 
					      name  = "IntelliJ IDEA Ultimate",
 | 
				
			||||||
 | 
					      value = jsonencode(["IU", "232.9921.47", "https://download.jetbrains.com/idea/ideaIU-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "IC" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/intellij.svg",
 | 
				
			||||||
 | 
					      name  = "IntelliJ IDEA Community",
 | 
				
			||||||
 | 
					      value = jsonencode(["IC", "232.9921.47", "https://download.jetbrains.com/idea/ideaIC-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "PY" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/pycharm.svg",
 | 
				
			||||||
 | 
					      name  = "PyCharm Professional",
 | 
				
			||||||
 | 
					      value = jsonencode(["PY", "232.9559.58", "https://download.jetbrains.com/python/pycharm-professional-2023.2.1.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "PC" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/pycharm.svg",
 | 
				
			||||||
 | 
					      name  = "PyCharm Community",
 | 
				
			||||||
 | 
					      value = jsonencode(["PC", "232.9559.58", "https://download.jetbrains.com/python/pycharm-community-2023.2.1.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "RD" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/rider.svg",
 | 
				
			||||||
 | 
					      name  = "Rider",
 | 
				
			||||||
 | 
					      value = jsonencode(["RD", "232.9559.61", "https://download.jetbrains.com/rider/JetBrains.Rider-2023.2.1.tar.gz"])
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    "CL" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/clion.svg",
 | 
				
			||||||
 | 
					      name  = "CLion",
 | 
				
			||||||
 | 
					      value = jsonencode(["CL", "232.9921.42", "https://download.jetbrains.com/cpp/CLion-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "DB" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/datagrip.svg",
 | 
				
			||||||
 | 
					      name  = "DataGrip",
 | 
				
			||||||
 | 
					      value = jsonencode(["DB", "232.9559.28", "https://download.jetbrains.com/datagrip/datagrip-2023.2.1.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "PS" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/phpstorm.svg",
 | 
				
			||||||
 | 
					      name  = "PhpStorm",
 | 
				
			||||||
 | 
					      value = jsonencode(["PS", "232.9559.64", "https://download.jetbrains.com/webide/PhpStorm-2023.2.1.tar.gz"])
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "RM" = {
 | 
				
			||||||
 | 
					      icon  = "/icon/rubymine.svg",
 | 
				
			||||||
 | 
					      name  = "RubyMine",
 | 
				
			||||||
 | 
					      value = jsonencode(["RM", "232.9921.48", "https://download.jetbrains.com/ruby/RubyMine-2023.2.2.tar.gz"])
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					data "coder_parameter" "jetbrains_ide" {
 | 
				
			||||||
 | 
					  type         = "list(string)"
 | 
				
			||||||
 | 
					  name         = "jetbrains_ide"
 | 
				
			||||||
 | 
					  display_name = "JetBrains IDE"
 | 
				
			||||||
 | 
					  icon         = "/icon/gateway.svg"
 | 
				
			||||||
 | 
					  mutable      = true
 | 
				
			||||||
 | 
					  default      = local.gateway_ides["GO"].value
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  dynamic "option" {
 | 
				
			||||||
 | 
					    for_each = contains(var.gateway_ide_product_code, "ALL") ? local.gateway_ides : { for key, value in local.gateway_ides : key => value if contains(var.gateway_ide_product_code, key) }
 | 
				
			||||||
 | 
					    content {
 | 
				
			||||||
 | 
					      icon  = option.value.icon
 | 
				
			||||||
 | 
					      name  = option.value.name
 | 
				
			||||||
 | 
					      value = option.value.value
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					data "coder_workspace" "me" {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					resource "coder_app" "gateway" {
 | 
				
			||||||
 | 
					  agent_id     = var.agent_id
 | 
				
			||||||
 | 
					  display_name = data.coder_parameter.jetbrains_ide.option[index(data.coder_parameter.jetbrains_ide.option.*.value, data.coder_parameter.jetbrains_ide.value)].name
 | 
				
			||||||
 | 
					  slug         = "gateway"
 | 
				
			||||||
 | 
					  url          = "jetbrains-gateway://connect#type=coder&workspace=${data.coder_workspace.me.name}&agent=${var.agent_name}&folder=${var.project_directory}&url=${data.coder_workspace.me.access_url}&token=${data.coder_workspace.me.owner_session_token}&ide_product_code=${jsondecode(data.coder_parameter.jetbrains_ide.value)[0]}&ide_build_number=${jsondecode(data.coder_parameter.jetbrains_ide.value)[1]}&ide_download_link=${jsondecode(data.coder_parameter.jetbrains_ide.value)[2]}"
 | 
				
			||||||
 | 
					  icon         = data.coder_parameter.jetbrains_ide.option[index(data.coder_parameter.jetbrains_ide.option.*.value, data.coder_parameter.jetbrains_ide.value)].icon
 | 
				
			||||||
 | 
					  external     = true
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
					Loading…
					
					
				
		Reference in New Issue