bamhm182 (BytePen)
bamhm182 (BytePen)
CCoder.com
Created by bamhm182 (BytePen) on 11/11/2024 in #help
Is there a way to have a number of coder_agents defined from a single resource block?
I'm looking to have something like the following so that I can define an arbitrary number of nodes and have all of them report their stats in the Coder page. When I do this, I get errors related to duplicate resource definitions. One such example is error: template import provision for start: duplicate metadata resource: libvirt_domain.node Full template's source can be found here. Is something like this possible, or am I going to have to figure out a different way to go about this?
resource "coder_agent" "main" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
...
}

resource "libvirt_domain" "node" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
...
provisioner "remote-exec" {
inline = [ "echo ${coder_agent.main[count.index].token} > ~/.config/coder/token" ]
}
}

resource "coder_metadata" "libvirt_domain_node" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
resource_id = libvirt_domain.node[count.index].id
hide = true
}
resource "coder_agent" "main" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
...
}

resource "libvirt_domain" "node" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
...
provisioner "remote-exec" {
inline = [ "echo ${coder_agent.main[count.index].token} > ~/.config/coder/token" ]
}
}

resource "coder_metadata" "libvirt_domain_node" {
count = data.coder_workspace.me.start_count == 0 ? 0 : data.coder_parameter.node_count
resource_id = libvirt_domain.node[count.index].id
hide = true
}
46 replies
CCoder.com
Created by bamhm182 (BytePen) on 4/26/2024 in #help
Workspaces have been stopping while I am using them
I currently have all of my workspaces set with an auto stop of 24 hours. Ideally, what I'm after is to have my time left extend to that 24 hours each time I use the computer, but I have recently had several times where I am using a workspace, then it drops off. When I dig into it, it shuts off because the auto stop timer hit 0. What's weird is that the "Last used" says "Now" correctly when I am using it, but it does anyway. I'm opening this thread to ask two questions: 1. Under what conditions is that auto stop timer extended and how can I check that it should be being extended? 2. Is there any way to have it extend the auto stop time by a certain number of hours, or just reset it to the max every time there is activity? I am currently using 2 templates. One is kind of pieced together and I'm not surprised when it doesn't behave correctly (though it is overall very good), and the other is basically just the standard Docker template (but used with Podman on the backend). I would expect the Docker one to extend properly, but it has also dropped me in the middle of work. https://github.com/bamhm182/Coder-Templates/blob/wip-initial/podman-coder-ws/main.tf
15 replies
CCoder.com
Created by bamhm182 (BytePen) on 3/25/2024 in #help
Is there any way to create a coder_parameter that assists the user in inputting others' usernames?
I am looking for a way to have a coder_parameter of type "list(string)" that will be used to specify usernames. It currently works, but it requires the user to know all of the usernames they want to add and won't help them if they're spelled wrong and therefore don't exist. Is there any way to validate the list against existing user to ensure they exist, or better yet, help them find member names similar to the admin functionality that allows admins to create workspaces for users?
2 replies
CCoder.com
Created by bamhm182 (BytePen) on 11/26/2023 in #help
[RESOLVED] Having issues getting coder_apps to appear in my Workspace
Hello, I have been familiarizing myself with Coder the past few days, and it is fantastic. I just have one thing that I'm getting pretty stuck on and I'm hoping that I can get some help. I am using the guacamole terraform provider by techBeck03, and it creates a guacamole connection that I can connect to at https://guac.example.com/#/client/abcxyz. I am trying to get that URL as a clickable link on my Coder Workspace, but I can't seem to figure out how to get it to appear. It seems logical that I could create a coder_app resource with the url set to the desired URL and external=true. While building the template doesn't give me issues, it doesn't actually display it anywhere. This is the primary reference material I am looking at: https://coder.com/docs/v2/latest/ides/web-ides I believe that the major disconnect is coming from how my resource is displayed in the Workspace, as I'm not using (what appears to be Kubernetes) in my workspace, I am using libvirt via dmacvicar's libvirt terraform provider. EDIT: It turns out that functionality of ALL coder_app's is dependent on the coder-agent being present on the terraform resources VMs, containers, etc. This apparently includes external apps.
45 replies