coder / coder/terraform-provider-coder

Add `order` to `coder_metadata`

Open
#325 0 comments 1 reaction 1 assignee Claimed by @BrunoQuaresma View on GitHub
customer-requested
Dominant language
Go
Stars
60
Forks
27
Avg merge
1d 21h
Merged PRs (30d)
2

Description

Agent metadata currently does not support ordering in the same way users can order [apps](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/app#order-7) or [agents](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#order-1). 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:

```terraform
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:

```terraform
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!
}
}

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.