Skip to content

Commit dea0442

Browse files
authored
chore!: remove deprecated fields from coder_app and coder_agent resources (#257)
1 parent f46148f commit dea0442

File tree

5 files changed

+6
-95
lines changed

5 files changed

+6
-95
lines changed

docs/resources/agent.md

-3
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,12 @@ resource "kubernetes_pod" "dev" {
7676
- `dir` (String) The starting directory when a user creates a shell session. Defaults to `"$HOME"`.
7777
- `display_apps` (Block Set, Max: 1) The list of built-in apps to display in the agent bar. (see [below for nested schema](#nestedblock--display_apps))
7878
- `env` (Map of String) A mapping of environment variables to set inside the workspace.
79-
- `login_before_ready` (Boolean, **Deprecated**: Configure `startup_script_behavior` instead. This attribute will be removed in a future version of the provider.) This option defines whether or not the user can (by default) login to the workspace before it is ready. Ready means that e.g. the `startup_script` is done and has exited. When enabled, users may see an incomplete workspace when logging in.
8079
- `metadata` (Block List) Each `metadata` block defines a single item consisting of a key/value pair. This feature is in alpha and may break in future releases. (see [below for nested schema](#nestedblock--metadata))
8180
- `motd_file` (String) The path to a file within the workspace containing a message to display to users when they login via SSH. A typical value would be `"/etc/motd"`.
8281
- `order` (Number) The order determines the position of agents in the UI presentation. The lowest order is shown first and agents with equal order are sorted by name (ascending order).
8382
- `shutdown_script` (String) A script to run before the agent is stopped. The script should exit when it is done to signal that the workspace can be stopped. This option is an alias for defining a `coder_script` resource with `run_on_stop` set to `true`.
84-
- `shutdown_script_timeout` (Number, **Deprecated**: This feature is deprecated and has no effect. This attribute will be removed in a future version of the provider.) Time in seconds until the agent lifecycle status is marked as timed out during shutdown, this happens when the shutdown script has not completed (exited) in the given time.
8583
- `startup_script` (String) A script to run after the agent starts. The script should exit when it is done to signal that the agent is ready. This option is an alias for defining a `coder_script` resource with `run_on_start` set to `true`.
8684
- `startup_script_behavior` (String) This option sets the behavior of the `startup_script`. When set to `"blocking"`, the `startup_script` must exit before the workspace is ready. When set to `"non-blocking"`, the `startup_script` may run in the background and the workspace will be ready immediately. Default is `"non-blocking"`, although `"blocking"` is recommended. This option is an alias for defining a `coder_script` resource with `start_blocks_login` set to `true` (blocking).
87-
- `startup_script_timeout` (Number, **Deprecated**: This feature is deprecated and has no effect. This attribute will be removed in a future version of the provider.) Time in seconds until the agent lifecycle status is marked as timed out during start, this happens when the startup script has not completed (exited) in the given time.
8885
- `troubleshooting_url` (String) A URL to a document with instructions for troubleshooting problems with the agent.
8986

9087
### Read-Only

docs/resources/app.md

-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ resource "coder_app" "vim" {
6464
- `external` (Boolean) Specifies whether `url` is opened on the client machine instead of proxied through the workspace.
6565
- `healthcheck` (Block Set, Max: 1) HTTP health checking to determine the application readiness. (see [below for nested schema](#nestedblock--healthcheck))
6666
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`.
67-
- `name` (String, **Deprecated**: `name` on apps is deprecated, use `display_name` instead) A display name to identify the app.
6867
- `order` (Number) The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order).
69-
- `relative_path` (Boolean, **Deprecated**: `relative_path` on apps is deprecated, use `subdomain` instead.) Specifies whether the URL will be accessed via a relative path or wildcard. Use if wildcard routing is unavailable. Defaults to `true`.
7068
- `share` (String) Determines the level which the application is shared at. Valid levels are `"owner"` (default), `"authenticated"` and `"public"`. Level `"owner"` disables sharing on the app, so only the workspace owner can access it. Level `"authenticated"` shares the app with all authenticated users. Level `"public"` shares it with any user, including unauthenticated users. Permitted application sharing levels can be configured site-wide via a flag on `coder server` (Enterprise only).
7169
- `subdomain` (Boolean) Determines whether the app will be accessed via it's own subdomain or whether it will be accessed via a path on Coder. If wildcards have not been setup by the administrator then apps with `subdomain` set to `true` will not be accessible. Defaults to `false`.
7270
- `url` (String) An external url if `external=true` or a URL to be proxied to from inside the workspace. This should be of the form `http://localhost:PORT[/SUBPATH]`. Either `command` or `url` may be specified, but not both.

provider/agent.go

+6-41
Original file line numberDiff line numberDiff line change
@@ -128,30 +128,12 @@ func agentResource() *schema.Resource {
128128
Type: schema.TypeString,
129129
Optional: true,
130130
},
131-
"startup_script_timeout": {
132-
Type: schema.TypeInt,
133-
Default: 300,
134-
ForceNew: true,
135-
Optional: true,
136-
Description: "Time in seconds until the agent lifecycle status is marked as timed out during start, this happens when the startup script has not completed (exited) in the given time.",
137-
Deprecated: "This feature is deprecated and has no effect. This attribute will be removed in a future version of the provider.",
138-
ValidateFunc: validation.IntAtLeast(1),
139-
},
140131
"shutdown_script": {
141132
Type: schema.TypeString,
142133
ForceNew: true,
143134
Optional: true,
144135
Description: "A script to run before the agent is stopped. The script should exit when it is done to signal that the workspace can be stopped. This option is an alias for defining a `coder_script` resource with `run_on_stop` set to `true`.",
145136
},
146-
"shutdown_script_timeout": {
147-
Type: schema.TypeInt,
148-
Default: 300,
149-
ForceNew: true,
150-
Optional: true,
151-
Description: "Time in seconds until the agent lifecycle status is marked as timed out during shutdown, this happens when the shutdown script has not completed (exited) in the given time.",
152-
Deprecated: "This feature is deprecated and has no effect. This attribute will be removed in a future version of the provider.",
153-
ValidateFunc: validation.IntAtLeast(1),
154-
},
155137
"token": {
156138
ForceNew: true,
157139
Sensitive: true,
@@ -179,30 +161,13 @@ func agentResource() *schema.Resource {
179161
Optional: true,
180162
Description: "The path to a file within the workspace containing a message to display to users when they login via SSH. A typical value would be `\"/etc/motd\"`.",
181163
},
182-
"login_before_ready": {
183-
// Note: When this is removed, "startup_script_behavior" should
184-
// be set to "non-blocking" by default (instead of empty string).
185-
Type: schema.TypeBool,
186-
Default: true,
187-
ForceNew: true,
188-
Optional: true,
189-
Description: "This option defines whether or not the user can (by default) login to the workspace before it is ready. Ready means that e.g. the `startup_script` is done and has exited. When enabled, users may see an incomplete workspace when logging in.",
190-
Deprecated: "Configure `startup_script_behavior` instead. This attribute will be removed in a future version of the provider.",
191-
ConflictsWith: []string{"startup_script_behavior"},
192-
},
193164
"startup_script_behavior": {
194-
// Note: Our default value is "non-blocking" but we do not set
195-
// it here because we want to be able to differentiate between
196-
// the user setting this or "login_before_ready". For all
197-
// intents and purposes, until deprecation, setting
198-
// "login_before_ready = false" is equivalent to setting
199-
// "startup_script_behavior = blocking".
200-
Type: schema.TypeString,
201-
ForceNew: true,
202-
Optional: true,
203-
Description: "This option sets the behavior of the `startup_script`. When set to `\"blocking\"`, the `startup_script` must exit before the workspace is ready. When set to `\"non-blocking\"`, the `startup_script` may run in the background and the workspace will be ready immediately. Default is `\"non-blocking\"`, although `\"blocking\"` is recommended. This option is an alias for defining a `coder_script` resource with `start_blocks_login` set to `true` (blocking).",
204-
ValidateFunc: validation.StringInSlice([]string{"blocking", "non-blocking"}, false),
205-
ConflictsWith: []string{"login_before_ready"},
165+
Type: schema.TypeString,
166+
Default: "non-blocking",
167+
ForceNew: true,
168+
Optional: true,
169+
Description: "This option sets the behavior of the `startup_script`. When set to `\"blocking\"`, the `startup_script` must exit before the workspace is ready. When set to `\"non-blocking\"`, the `startup_script` may run in the background and the workspace will be ready immediately. Default is `\"non-blocking\"`, although `\"blocking\"` is recommended. This option is an alias for defining a `coder_script` resource with `start_blocks_login` set to `true` (blocking).",
170+
ValidateFunc: validation.StringInSlice([]string{"blocking", "non-blocking"}, false),
206171
},
207172
"metadata": {
208173
Type: schema.TypeList,

provider/agent_test.go

-32
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ func TestAgent(t *testing.T) {
3434
hi = "test"
3535
}
3636
startup_script = "echo test"
37-
startup_script_timeout = 120
3837
troubleshooting_url = "https://example.com/troubleshoot"
3938
motd_file = "/etc/motd"
4039
shutdown_script = "echo bye bye"
41-
shutdown_script_timeout = 120
4240
order = 4
4341
}
4442
`,
@@ -55,12 +53,10 @@ func TestAgent(t *testing.T) {
5553
"dir",
5654
"env.hi",
5755
"startup_script",
58-
"startup_script_timeout",
5956
"connection_timeout",
6057
"troubleshooting_url",
6158
"motd_file",
6259
"shutdown_script",
63-
"shutdown_script_timeout",
6460
"order",
6561
} {
6662
value := resource.Primary.Attributes[key]
@@ -109,34 +105,6 @@ func TestAgent_StartupScriptBehavior(t *testing.T) {
109105
require.Equal(t, "non-blocking", state.Primary.Attributes["startup_script_behavior"])
110106
},
111107
},
112-
{
113-
Name: "login_before_ready (deprecated)",
114-
Config: `
115-
resource "coder_agent" "new" {
116-
os = "linux"
117-
arch = "amd64"
118-
login_before_ready = false
119-
}
120-
`,
121-
Check: func(state *terraform.ResourceState) {
122-
require.Equal(t, "false", state.Primary.Attributes["login_before_ready"])
123-
// startup_script_behavior must be empty, this indicates that
124-
// login_before_ready should be used instead.
125-
require.Equal(t, "", state.Primary.Attributes["startup_script_behavior"])
126-
},
127-
},
128-
{
129-
Name: "no login_before_ready with startup_script_behavior",
130-
Config: `
131-
resource "coder_agent" "new" {
132-
os = "linux"
133-
arch = "amd64"
134-
login_before_ready = false
135-
startup_script_behavior = "blocking"
136-
}
137-
`,
138-
ExpectError: regexp.MustCompile("conflicts with"),
139-
},
140108
} {
141109
tc := tc
142110
t.Run(tc.Name, func(t *testing.T) {

provider/app.go

-17
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,6 @@ func appResource() *schema.Resource {
9696
ForceNew: true,
9797
Optional: true,
9898
},
99-
"name": {
100-
Type: schema.TypeString,
101-
Description: "A display name to identify the app.",
102-
Deprecated: "`name` on apps is deprecated, use `display_name` instead",
103-
ForceNew: true,
104-
Optional: true,
105-
ConflictsWith: []string{"display_name"},
106-
},
10799
"subdomain": {
108100
Type: schema.TypeBool,
109101
Description: "Determines whether the app will be accessed via it's own " +
@@ -113,15 +105,6 @@ func appResource() *schema.Resource {
113105
ForceNew: true,
114106
Optional: true,
115107
},
116-
"relative_path": {
117-
Type: schema.TypeBool,
118-
Deprecated: "`relative_path` on apps is deprecated, use `subdomain` instead.",
119-
Description: "Specifies whether the URL will be accessed via a relative " +
120-
"path or wildcard. Use if wildcard routing is unavailable. Defaults to `true`.",
121-
ForceNew: true,
122-
Optional: true,
123-
ConflictsWith: []string{"subdomain"},
124-
},
125108
"share": {
126109
Type: schema.TypeString,
127110
Description: "Determines the level which the application " +

0 commit comments

Comments
 (0)