@@ -11,18 +11,7 @@ terraform {
11
11
}
12
12
}
13
13
14
- variable "step1_do_token" {
15
- type = string
16
- description = " Enter token (see documentation at https://docs.digitalocean.com/reference/api/create-personal-access-token/)"
17
- sensitive = true
18
-
19
- validation {
20
- condition = length (var. step1_do_token ) == 71 && substr (var. step1_do_token , 0 , 4 ) == " dop_"
21
- error_message = " Invalid Digital Ocean Personal Access Token."
22
- }
23
- }
24
-
25
- variable "step2_do_project_id" {
14
+ variable "step1_do_project_id" {
26
15
type = string
27
16
description = <<- EOF
28
17
Enter project ID
@@ -32,17 +21,17 @@ variable "step2_do_project_id" {
32
21
sensitive = true
33
22
34
23
validation {
35
- condition = length (var. step2_do_project_id ) == 36
24
+ condition = length (var. step1_do_project_id ) == 36
36
25
error_message = " Invalid Digital Ocean Project ID."
37
26
}
38
27
}
39
28
40
- variable "step3_do_admin_ssh_key " {
29
+ variable "step2_do_admin_ssh_key " {
41
30
type = number
42
31
description = <<- EOF
43
32
Enter admin SSH key ID (some Droplet images require an SSH key to be set):
44
33
45
- Can be set to zero .
34
+ Can be set to "0" for no key .
46
35
47
36
Note: Setting this to zero will break Fedora images and notify root passwords via email.
48
37
@@ -51,7 +40,7 @@ variable "step3_do_admin_ssh_key" {
51
40
sensitive = true
52
41
53
42
validation {
54
- condition = var. step3_do_admin_ssh_key >= 0
43
+ condition = var. step2_do_admin_ssh_key >= 0
55
44
error_message = " Invalid Digital Ocean SSH key ID, a number is required."
56
45
}
57
46
}
@@ -98,7 +87,8 @@ variable "region" {
98
87
99
88
# Configure the DigitalOcean Provider
100
89
provider "digitalocean" {
101
- token = var. step1_do_token
90
+ # Recommended: use environment variable DIGITALOCEAN_TOKEN with your personal access token when starting coderd
91
+ # alternatively, you can pass the token via a variable.
102
92
}
103
93
104
94
data "coder_workspace" "me" {}
@@ -130,12 +120,12 @@ resource "digitalocean_droplet" "workspace" {
130
120
coder_agent_token = coder_agent.dev.token
131
121
})
132
122
# Required to provision Fedora.
133
- ssh_keys = var. step3_do_admin_ssh_key > 0 ? [var . step3_do_admin_ssh_key ] : []
123
+ ssh_keys = var. step2_do_admin_ssh_key > 0 ? [var . step2_do_admin_ssh_key ] : []
134
124
}
135
125
136
126
# Temporarily disabled because it breaks SSH. (https://github.com/coder/coder/issues/1750)
137
127
# resource "digitalocean_project_resources" "project" {
138
- # project = var.step2_do_project_id
128
+ # project = var.step1_do_project_id
139
129
# # Workaround for terraform plan when using count.
140
130
# resources = length(digitalocean_droplet.workspace) > 0 ? [
141
131
# digitalocean_volume.home_volume.urn,
0 commit comments