Skip to content

Commit de90fa1

Browse files
committed
chore: update Digital Ocean example template (#11528)
1 parent 97bd74b commit de90fa1

File tree

2 files changed

+93
-71
lines changed

2 files changed

+93
-71
lines changed

examples/templates/do-linux/main.tf

+77-71
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,40 @@ data "coder_parameter" "droplet_image" {
5656
type = "string"
5757
mutable = false
5858
option {
59-
name = "Ubuntu 22.04"
60-
value = "ubuntu-22-04-x64"
61-
icon = "/icon/ubuntu.svg"
59+
name = "AlmaLinux 9"
60+
value = "almalinux-9-x64"
61+
icon = "/icon/almalinux.svg"
6262
}
6363
option {
64-
name = "Ubuntu 20.04"
65-
value = "ubuntu-20-04-x64"
66-
icon = "/icon/ubuntu.svg"
64+
name = "AlmaLinux 8"
65+
value = "almalinux-8-x64"
66+
icon = "/icon/almalinux.svg"
6767
}
6868
option {
69-
name = "Fedora 36"
70-
value = "fedora-36-x64"
69+
name = "Fedora 39"
70+
value = "fedora-39-x64"
7171
icon = "/icon/fedora.svg"
7272
}
7373
option {
74-
name = "Fedora 35"
75-
value = "fedora-35-x64"
74+
name = "Fedora 38"
75+
value = "fedora-38-x64"
7676
icon = "/icon/fedora.svg"
7777
}
78+
option {
79+
name = "CentOS Stream 9"
80+
value = "centos-stream-9-x64"
81+
icon = "/icon/centos.svg"
82+
}
83+
option {
84+
name = "CentOS Stream 8"
85+
value = "centos-stream-8-x64"
86+
icon = "/icon/centos.svg"
87+
}
88+
option {
89+
name = "Debian 12"
90+
value = "debian-12-x64"
91+
icon = "/icon/debian.svg"
92+
}
7893
option {
7994
name = "Debian 11"
8095
value = "debian-11-x64"
@@ -86,24 +101,24 @@ data "coder_parameter" "droplet_image" {
86101
icon = "/icon/debian.svg"
87102
}
88103
option {
89-
name = "CentOS Stream 9"
90-
value = "centos-stream-9-x64"
91-
icon = "/icon/centos.svg"
92-
}
93-
option {
94-
name = "CentOS Stream 8"
95-
value = "centos-stream-8-x64"
96-
icon = "/icon/centos.svg"
104+
name = "Rocky Linux 9"
105+
value = "rockylinux-9-x64"
106+
icon = "/icon/rockylinux.svg"
97107
}
98108
option {
99109
name = "Rocky Linux 8"
100110
value = "rockylinux-8-x64"
101111
icon = "/icon/rockylinux.svg"
102112
}
103113
option {
104-
name = "Rocky Linux 8.4"
105-
value = "rockylinux-8-4-x64"
106-
icon = "/icon/rockylinux.svg"
114+
name = "Ubuntu 22.04 (LTS)"
115+
value = "ubuntu-22-04-x64"
116+
icon = "/icon/ubuntu.svg"
117+
}
118+
option {
119+
name = "Ubuntu 20.04 (LTS)"
120+
value = "ubuntu-20-04-x64"
121+
icon = "/icon/ubuntu.svg"
107122
}
108123
}
109124

@@ -115,6 +130,11 @@ data "coder_parameter" "droplet_size" {
115130
type = "string"
116131
icon = "/icon/memory.svg"
117132
mutable = false
133+
# s-1vcpu-1gb is unsupported in tor1, blr1, lon1, sfo2, and nyc3 regions
134+
#option {
135+
# name = "1 vCPU, 1 GB RAM"
136+
# value = "s-1vcpu-512mb-10gb"
137+
#}
118138
option {
119139
name = "1 vCPU, 1 GB RAM"
120140
value = "s-1vcpu-1gb"
@@ -135,13 +155,13 @@ data "coder_parameter" "droplet_size" {
135155
name = "4 vCPU, 8 GB RAM"
136156
value = "s-4vcpu-8gb"
137157
}
138-
option {
139-
name = "8 vCPU, 16 GB RAM"
140-
value = "s-8vcpu-16gb"
141-
}
158+
# s-8vcpu-16gb access requires a support ticket with Digital Ocean
159+
#option {
160+
# name = "8 vCPU, 16 GB RAM"
161+
# value = "s-8vcpu-16gb"
162+
#}
142163
}
143164

144-
145165
data "coder_parameter" "home_volume_size" {
146166
name = "home_volume_size"
147167
display_name = "Home volume size"
@@ -151,7 +171,7 @@ data "coder_parameter" "home_volume_size" {
151171
mutable = false
152172
validation {
153173
min = 1
154-
max = 999999
174+
max = 100 # Sizes larger than 100 GB require a support ticket with Digital Ocean
155175
}
156176
}
157177

@@ -163,70 +183,56 @@ data "coder_parameter" "region" {
163183
type = "string"
164184
default = "ams3"
165185
mutable = false
186+
# nyc1, sfo1, and ams2 regions do not support volumes, which are used to persist data while decreasing cost:
166187
option {
167-
name = "New York 1"
168-
value = "nyc1"
169-
icon = "/emojis/1f1fa-1f1f8.png"
170-
}
171-
option {
172-
name = "New York 2"
173-
value = "nyc2"
174-
icon = "/emojis/1f1fa-1f1f8.png"
175-
}
176-
option {
177-
name = "New York 3"
178-
value = "nyc3"
179-
icon = "/emojis/1f1fa-1f1f8.png"
180-
}
181-
option {
182-
name = "San Francisco 1"
183-
value = "sfo1"
184-
icon = "/emojis/1f1fa-1f1f8.png"
185-
}
186-
option {
187-
name = "San Francisco 2"
188-
value = "sfo2"
189-
icon = "/emojis/1f1fa-1f1f8.png"
188+
name = "Canada (Toronto)"
189+
value = "tor1"
190+
icon = "/emojis/1f1e8-1f1e6.png"
190191
}
191192
option {
192-
name = "San Francisco 3"
193-
value = "sfo3"
194-
icon = "/emojis/1f1fa-1f1f8.png"
193+
name = "Germany (Frankfurt)"
194+
value = "fra1"
195+
icon = "/emojis/1f1e9-1f1ea.png"
195196
}
196197
option {
197-
name = "Amsterdam 2"
198-
value = "ams2"
199-
icon = "/emojis/1f1f3-1f1f1.png"
198+
name = "India (Bangalore)"
199+
value = "blr1"
200+
icon = "/emojis/1f1ee-1f1f3.png"
200201
}
201202
option {
202-
name = "Amsterdam 3"
203+
name = "Netherlands (Amsterdam)"
203204
value = "ams3"
204205
icon = "/emojis/1f1f3-1f1f1.png"
205206
}
206207
option {
207-
name = "Singapore 1"
208+
name = "Singapore"
208209
value = "sgp1"
209210
icon = "/emojis/1f1f8-1f1ec.png"
210211
}
211212
option {
212-
name = "London 1"
213+
name = "United Kingdom (London)"
213214
value = "lon1"
214215
icon = "/emojis/1f1ec-1f1e7.png"
215216
}
216217
option {
217-
name = "Frankfurt 1"
218-
value = "fra1"
219-
icon = "/emojis/1f1e9-1f1ea.png"
218+
name = "United States (California - 2)"
219+
value = "sfo2"
220+
icon = "/emojis/1f1fa-1f1f8.png"
220221
}
221222
option {
222-
name = "Toronto 1"
223-
value = "tor1"
224-
icon = "/emojis/1f1e8-1f1e6.png"
223+
name = "United States (California - 3)"
224+
value = "sfo3"
225+
icon = "/emojis/1f1fa-1f1f8.png"
225226
}
226227
option {
227-
name = "Bangalore 1"
228-
value = "blr1"
229-
icon = "/emojis/1f1ee-1f1f3.png"
228+
name = "United States (New York - 1)"
229+
value = "nyc1"
230+
icon = "/emojis/1f1fa-1f1f8.png"
231+
}
232+
option {
233+
name = "United States (New York - 3)"
234+
value = "nyc3"
235+
icon = "/emojis/1f1fa-1f1f8.png"
230236
}
231237
}
232238

@@ -250,7 +256,7 @@ resource "coder_agent" "main" {
250256
script = <<-EOT
251257
#!/bin/bash
252258
set -e
253-
top -bn1 | grep "Cpu(s)" | awk '{print $2 + $4 "%"}'
259+
top -bn1 | awk '/^.?Cpu/ {print $2 + $4 "%"}'
254260
EOT
255261
}
256262
metadata {
@@ -261,7 +267,7 @@ resource "coder_agent" "main" {
261267
script = <<-EOT
262268
#!/bin/bash
263269
set -e
264-
free -m | awk 'NR==2{printf "%.2f%%\t", $3*100/$2 }'
270+
free -m | awk '/^Mem/ {printf "%.2f%%", $3*100/$2 }'
265271
EOT
266272
}
267273
metadata {
@@ -272,7 +278,7 @@ resource "coder_agent" "main" {
272278
script = <<-EOT
273279
#!/bin/bash
274280
set -e
275-
df /home/coder | awk '$NF=="/"{printf "%s", $5}'
281+
df -h /home/${data.coder_workspace.me.owner} | awk '/^\// { printf "%s/%s (%s)", $3, $2, $5 }'
276282
EOT
277283
}
278284

site/static/icon/almalinux.svg

+16
Loading

0 commit comments

Comments
 (0)