Skip to content

Commit f9d6698

Browse files
authored
feat(examples/templates/azure-linux): promote module usage (#15517)
1 parent 747f7ce commit f9d6698

File tree

1 file changed

+42
-140
lines changed
  • examples/templates/azure-linux

1 file changed

+42
-140
lines changed

examples/templates/azure-linux/main.tf

Lines changed: 42 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -9,143 +9,14 @@ terraform {
99
}
1010
}
1111

12-
data "coder_parameter" "location" {
13-
name = "location"
14-
display_name = "Location"
15-
description = "What location should your workspace live in?"
16-
default = "eastus"
17-
icon = "/emojis/1f310.png"
18-
mutable = false
19-
option {
20-
name = "US (Virginia)"
21-
value = "eastus"
22-
icon = "/emojis/1f1fa-1f1f8.png"
23-
}
24-
option {
25-
name = "US (Virginia) 2"
26-
value = "eastus2"
27-
icon = "/emojis/1f1fa-1f1f8.png"
28-
}
29-
option {
30-
name = "US (Texas)"
31-
value = "southcentralus"
32-
icon = "/emojis/1f1fa-1f1f8.png"
33-
}
34-
option {
35-
name = "US (Washington)"
36-
value = "westus2"
37-
icon = "/emojis/1f1fa-1f1f8.png"
38-
}
39-
option {
40-
name = "US (Arizona)"
41-
value = "westus3"
42-
icon = "/emojis/1f1fa-1f1f8.png"
43-
}
44-
option {
45-
name = "US (Iowa)"
46-
value = "centralus"
47-
icon = "/emojis/1f1fa-1f1f8.png"
48-
}
49-
option {
50-
name = "Canada (Toronto)"
51-
value = "canadacentral"
52-
icon = "/emojis/1f1e8-1f1e6.png"
53-
}
54-
option {
55-
name = "Brazil (Sao Paulo)"
56-
value = "brazilsouth"
57-
icon = "/emojis/1f1e7-1f1f7.png"
58-
}
59-
option {
60-
name = "East Asia (Hong Kong)"
61-
value = "eastasia"
62-
icon = "/emojis/1f1f0-1f1f7.png"
63-
}
64-
option {
65-
name = "Southeast Asia (Singapore)"
66-
value = "southeastasia"
67-
icon = "/emojis/1f1f0-1f1f7.png"
68-
}
69-
option {
70-
name = "Australia (New South Wales)"
71-
value = "australiaeast"
72-
icon = "/emojis/1f1e6-1f1fa.png"
73-
}
74-
option {
75-
name = "China (Hebei)"
76-
value = "chinanorth3"
77-
icon = "/emojis/1f1e8-1f1f3.png"
78-
}
79-
option {
80-
name = "India (Pune)"
81-
value = "centralindia"
82-
icon = "/emojis/1f1ee-1f1f3.png"
83-
}
84-
option {
85-
name = "Japan (Tokyo)"
86-
value = "japaneast"
87-
icon = "/emojis/1f1ef-1f1f5.png"
88-
}
89-
option {
90-
name = "Korea (Seoul)"
91-
value = "koreacentral"
92-
icon = "/emojis/1f1f0-1f1f7.png"
93-
}
94-
option {
95-
name = "Europe (Ireland)"
96-
value = "northeurope"
97-
icon = "/emojis/1f1ea-1f1fa.png"
98-
}
99-
option {
100-
name = "Europe (Netherlands)"
101-
value = "westeurope"
102-
icon = "/emojis/1f1ea-1f1fa.png"
103-
}
104-
option {
105-
name = "France (Paris)"
106-
value = "francecentral"
107-
icon = "/emojis/1f1eb-1f1f7.png"
108-
}
109-
option {
110-
name = "Germany (Frankfurt)"
111-
value = "germanywestcentral"
112-
icon = "/emojis/1f1e9-1f1ea.png"
113-
}
114-
option {
115-
name = "Norway (Oslo)"
116-
value = "norwayeast"
117-
icon = "/emojis/1f1f3-1f1f4.png"
118-
}
119-
option {
120-
name = "Sweden (Gävle)"
121-
value = "swedencentral"
122-
icon = "/emojis/1f1f8-1f1ea.png"
123-
}
124-
option {
125-
name = "Switzerland (Zurich)"
126-
value = "switzerlandnorth"
127-
icon = "/emojis/1f1e8-1f1ed.png"
128-
}
129-
option {
130-
name = "Qatar (Doha)"
131-
value = "qatarcentral"
132-
icon = "/emojis/1f1f6-1f1e6.png"
133-
}
134-
option {
135-
name = "UAE (Dubai)"
136-
value = "uaenorth"
137-
icon = "/emojis/1f1e6-1f1ea.png"
138-
}
139-
option {
140-
name = "South Africa (Johannesburg)"
141-
value = "southafricanorth"
142-
icon = "/emojis/1f1ff-1f1e6.png"
143-
}
144-
option {
145-
name = "UK (London)"
146-
value = "uksouth"
147-
icon = "/emojis/1f1ec-1f1e7.png"
148-
}
12+
# See https://registry.coder.com/modules/azure-region
13+
module "azure_region" {
14+
source = "registry.coder.com/modules/azure-region/coder"
15+
16+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
17+
version = ">= 1.0.0"
18+
19+
default = "eastus"
14920
}
15021

15122
data "coder_parameter" "instance_type" {
@@ -219,8 +90,7 @@ provider "azurerm" {
21990
features {}
22091
}
22192

222-
data "coder_workspace" "me" {
223-
}
93+
data "coder_workspace" "me" {}
22494
data "coder_workspace_owner" "me" {}
22595

22696
resource "coder_agent" "main" {
@@ -263,6 +133,38 @@ resource "coder_agent" "main" {
263133
}
264134
}
265135

136+
# See https://registry.coder.com/modules/code-server
137+
module "code-server" {
138+
count = data.coder_workspace.me.start_count
139+
source = "registry.coder.com/modules/code-server/coder"
140+
141+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
142+
version = ">= 1.0.0"
143+
144+
agent_id = coder_agent.main.id
145+
order = 1
146+
}
147+
148+
# See https://registry.coder.com/modules/jetbrains-gateway
149+
module "jetbrains_gateway" {
150+
count = data.coder_workspace.me.start_count
151+
source = "registry.coder.com/modules/jetbrains-gateway/coder"
152+
153+
# JetBrains IDEs to make available for the user to select
154+
jetbrains_ides = ["IU", "PY", "WS", "PS", "RD", "CL", "GO", "RM"]
155+
default = "IU"
156+
157+
# Default folder to open when starting a JetBrains IDE
158+
folder = "/home/coder"
159+
160+
# This ensures that the latest version of the module gets downloaded, you can also pin the module version to prevent breaking changes in production.
161+
version = ">= 1.0.0"
162+
163+
agent_id = coder_agent.main.id
164+
agent_name = "main"
165+
order = 2
166+
}
167+
266168
locals {
267169
prefix = "coder-${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}"
268170

@@ -275,7 +177,7 @@ locals {
275177

276178
resource "azurerm_resource_group" "main" {
277179
name = "${local.prefix}-resources"
278-
location = data.coder_parameter.location.value
180+
location = module.azure_region.value
279181

280182
tags = {
281183
Coder_Provisioned = "true"

0 commit comments

Comments
 (0)
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