Coder Workspace Metadata Display
I am having trouble displaying the Coder Metadata shown in the blue box. I am using the latest version of coder. My goal is to display a value that is in
locals
Docs: https://coder.com/docs/admin/templates/extending-templates/resource-metadata
Solution:
Jump to solution
Thank you! With your help I was able to show metadata in the correct location.
```
locals {
workspace_full_name = "${data.coder_workspace_owner.me.name}-${data.coder_workspace.me.name}-${local.short_workspace_id}"
}...

9 Replies
@Jason Overmier sorry about the delay, were you able to figure it out?
No I haven't. Spent a couple hours and gave up. I assume it is a pretty simple fix if it isn't a bug
try setting the
resource_id
on the coder_metadata
resource to whatever terraform resource is first in this list:
(you'll need to click that symbol in the top left to get this list to appear)
if you click through those resources you should see the metadata on one
I found the resource that shows it. How can it be configure to show up on the first resource (coder)?


Just by changing the
resource_id
on the coder_metadata
to kubernetes_deployment.coder.id
instead of coder_agent.main
coder_metadata
can only be associated to non-coder_*
resources, and since you've associated it to the agent, it's picking what it thinks is the next best resource
if you want to add metadata specifically to the agent, that's done in metadata
blocks on the coder_agent
(the green text metadata in the agent UI)
In fairness, we have quite a few example templates that set resource_id
to an agent ID, and but whether or not it gets you the intended result depends on the template. In your case it unfortunately doesn't 🙁Solution
Thank you! With your help I was able to show metadata in the correct location.

Validation wouldn't pass without adding in the count
@Phorcys closed the thread.