feat: Add support for MOTD file in coder agents (#5147)

This commit is contained in:
Mathias Fredriksson
2022-11-24 12:22:20 +00:00
committed by GitHub
parent 8ff89c4288
commit eff99f78fa
21 changed files with 404 additions and 191 deletions
+2
View File
@@ -24,6 +24,7 @@ type agentAttributes struct {
StartupScript string `mapstructure:"startup_script"`
ConnectionTimeoutSeconds int32 `mapstructure:"connection_timeout"`
TroubleshootingURL string `mapstructure:"troubleshooting_url"`
MOTDFile string `mapstructure:"motd_file"`
}
// A mapping of attributes on the "coder_app" resource.
@@ -130,6 +131,7 @@ func ConvertResources(module *tfjson.StateModule, rawGraph string) ([]*proto.Res
Directory: attrs.Directory,
ConnectionTimeoutSeconds: attrs.ConnectionTimeoutSeconds,
TroubleshootingUrl: attrs.TroubleshootingURL,
MotdFile: attrs.MOTDFile,
}
switch attrs.Auth {
case "token":
+1
View File
@@ -99,6 +99,7 @@ func TestConvertResources(t *testing.T) {
Architecture: "amd64",
Auth: &proto.Agent_Token{},
ConnectionTimeoutSeconds: 1,
MotdFile: "/etc/motd",
}, {
Name: "dev3",
OperatingSystem: "windows",
@@ -2,7 +2,7 @@ terraform {
required_providers {
coder = {
source = "coder/coder"
version = "0.6.1"
version = "0.6.4"
}
}
}
@@ -16,6 +16,7 @@ resource "coder_agent" "dev2" {
os = "darwin"
arch = "amd64"
connection_timeout = 1
motd_file = "/etc/motd"
}
resource "coder_agent" "dev3" {
+10 -1
View File
@@ -17,6 +17,7 @@
"connection_timeout": 120,
"dir": null,
"env": null,
"motd_file": null,
"os": "linux",
"startup_script": null,
"troubleshooting_url": null
@@ -36,6 +37,7 @@
"connection_timeout": 1,
"dir": null,
"env": null,
"motd_file": "/etc/motd",
"os": "darwin",
"startup_script": null,
"troubleshooting_url": null
@@ -55,6 +57,7 @@
"connection_timeout": 120,
"dir": null,
"env": null,
"motd_file": null,
"os": "windows",
"startup_script": null,
"troubleshooting_url": "https://coder.com/troubleshoot"
@@ -94,6 +97,7 @@
"connection_timeout": 120,
"dir": null,
"env": null,
"motd_file": null,
"os": "linux",
"startup_script": null,
"troubleshooting_url": null
@@ -126,6 +130,7 @@
"connection_timeout": 1,
"dir": null,
"env": null,
"motd_file": "/etc/motd",
"os": "darwin",
"startup_script": null,
"troubleshooting_url": null
@@ -158,6 +163,7 @@
"connection_timeout": 120,
"dir": null,
"env": null,
"motd_file": null,
"os": "windows",
"startup_script": null,
"troubleshooting_url": "https://coder.com/troubleshoot"
@@ -200,7 +206,7 @@
"coder": {
"name": "coder",
"full_name": "registry.terraform.io/coder/coder",
"version_constraint": "0.6.1"
"version_constraint": "0.6.4"
},
"null": {
"name": "null",
@@ -238,6 +244,9 @@
"connection_timeout": {
"constant_value": 1
},
"motd_file": {
"constant_value": "/etc/motd"
},
"os": {
"constant_value": "darwin"
}
@@ -19,6 +19,7 @@
"env": null,
"id": "e545d734-f852-4fda-ac8f-39e3ff094e58",
"init_script": "",
"motd_file": null,
"os": "linux",
"startup_script": null,
"token": "c2c47266-af7a-467c-9ffc-30c3270ffecb",
@@ -41,6 +42,7 @@
"env": null,
"id": "b5e18556-d202-478f-80d9-76f34a4cb105",
"init_script": "",
"motd_file": "/etc/motd",
"os": "darwin",
"startup_script": null,
"token": "795082f9-642a-4647-a595-6539edaa74a3",
@@ -63,6 +65,7 @@
"env": null,
"id": "27e1114a-bc92-4e35-ab57-1680f3b7658f",
"init_script": "",
"motd_file": null,
"os": "windows",
"startup_script": null,
"token": "c4fc1679-eb42-4d9f-bca8-fcf9641a7256",