Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: addorder property to agent_metadata#187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
mtojek merged 3 commits intomainfrom8487-metadata-order
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletionsdocs/resources/agent.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,6 +26,23 @@ resource "coder_agent" "dev" {
web_terminal = true
ssh_helper = false
}

metadata {
display_name = "CPU Usage"
key = "cpu_usage"
script = "coder stat cpu"
interval = 10
timeout = 1
order = 2
}
metadata {
display_name = "RAM Usage"
key = "ram_usage"
script = "coder stat mem"
interval = 10
timeout = 1
order = 1
}
}

resource "kubernetes_pod" "dev" {
Expand DownExpand Up@@ -97,4 +114,5 @@ Required:
Optional:

- `display_name` (String) The user-facing name of this value.
- `order` (Number) The order determines the position of agent metadata in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by key (ascending order).
- `timeout` (Number) The maximum time the command is allowed to run in seconds.
17 changes: 17 additions & 0 deletionsexamples/resources/coder_agent/resource.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,23 @@ resource "coder_agent" "dev" {
web_terminal = true
ssh_helper = false
}

metadata {
display_name = "CPU Usage"
key = "cpu_usage"
script = "coder stat cpu"
interval = 10
timeout = 1
order = 2
}
metadata {
display_name = "RAM Usage"
key = "ram_usage"
script = "coder stat mem"
interval = 10
timeout = 1
order = 1
}
}

resource "kubernetes_pod" "dev" {
Expand Down
5 changes: 5 additions & 0 deletionsprovider/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -239,6 +239,11 @@ func agentResource() *schema.Resource {
ForceNew: true,
Required: true,
},
"order": {
Type: schema.TypeInt,
Optional: true,
Description: "The order determines the position of agent metadata in the UI/CLI presentation. The lowest order is shown first and parameters with equal order are sorted by key (ascending order).",
},
},
},
},
Expand Down
2 changes: 2 additions & 0 deletionsprovider/agent_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -225,6 +225,7 @@ func TestAgent_Metadata(t *testing.T) {
script = "ps aux | wc -l"
interval = 5
timeout = 1
order = 7
}
}
`,
Expand All@@ -244,6 +245,7 @@ func TestAgent_Metadata(t *testing.T) {
require.Equal(t, "ps aux | wc -l", attr["metadata.0.script"])
require.Equal(t, "5", attr["metadata.0.interval"])
require.Equal(t, "1", attr["metadata.0.timeout"])
require.Equal(t, "7", attr["metadata.0.order"])
return nil
},
}},
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp