Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add order to coder_metadata #325

Open
stirby opened this issue Jan 7, 2025 · 0 comments
Open

Add order to coder_metadata #325

stirby opened this issue Jan 7, 2025 · 0 comments

Comments

@stirby
Copy link
Contributor

stirby commented Jan 7, 2025

Agent metadata currently does not support ordering in the same way users can order apps or agents. We should use the existing syntax to allow ordering metadata items on any resource. Each resource should have an independent index.

Agent metadata ordering

The existing implementation:

resource "coder_agent" "dev" {
  os   = "linux"
  ...
  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
  }

  order = 1
}

Resource Metadata ordering

Proposal:

resource "coder_metadata" "pod_info" {
  count       = data.coder_workspace.me.start_count
  resource_id = kubernetes_pod.dev[0].id
  # (Enterprise-only) this resource consumes 200 quota units
  daily_cost = 200
  item {
    key   = "pod_uid"
    value = kubernetes_pod.dev[0].uid
    order = 2    # new!
  }
  item {
    key   = "description"
    value = "This description will show up in the Coder dashboard."
    order = 1    # new!
  }
  item {
    key   = "public_key"
    value = tls_private_key.example_key_pair.public_key_openssh
    order = 3     # new!
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant