Define custom subdomain for app to use with vars.

I want my app to use a specific subdomain. More specificly the workspace name. Is something like that posible?
resource "coder_app" "open-web" {
agent_id = coder_agent.main.id
slug = "open-web"
display_name = "Website"
icon = "/icon/globe_with_meridians.svg"
url = "http://localhost:80"
subdomain = true

healthcheck {
url = "http://localhost:80/healthz"
interval = 10
threshold = 30
}
}
resource "coder_app" "open-web" {
agent_id = coder_agent.main.id
slug = "open-web"
display_name = "Website"
icon = "/icon/globe_with_meridians.svg"
url = "http://localhost:80"
subdomain = true

healthcheck {
url = "http://localhost:80/healthz"
interval = 10
threshold = 30
}
}
8 Replies
Codercord
Codercord2w ago
<#1329725388976553984>
Category
Help needed
Product
Coder (v2)
Platform
Linux
Logs
Please post any relevant logs/error messages.
Phorcys
Phorcys7d ago
hey @WBR_K, I'm not sure what you mean, could you give an example of what you'd like?
WBR_K
WBR_KOP6d ago
resource "coder_app" "open-web" {
agent_id = coder_agent.main.id
slug = "open-web"
display_name = "Website"
icon = "/icon/globe_with_meridians.svg"
url = "http://localhost:80"
subdomain = true
subdomain_url = lower(data.coder_workspace.me.name)

healthcheck {
url = "http://localhost:80/healthz"
interval = 10
threshold = 30
}
}
resource "coder_app" "open-web" {
agent_id = coder_agent.main.id
slug = "open-web"
display_name = "Website"
icon = "/icon/globe_with_meridians.svg"
url = "http://localhost:80"
subdomain = true
subdomain_url = lower(data.coder_workspace.me.name)

healthcheck {
url = "http://localhost:80/healthz"
interval = 10
threshold = 30
}
}
What I'm trying to do is that the workspace has a predefined subdomain for the workspace port 80. See example. I added subdomain_url = lower(data.coder_workspace.me.name).
Scott
Scott6d ago
@WBR_K - Are you wanting something like a dev server of the app you are developing to be a available on a subdomain? If yes, for what purpose?
zounce
zounce6d ago
coder_apps already use <app>--<agent>--<workspace>--<username>.example.com (if the subdomain attribute is true) - I don't believe it's possible to customise it any further
WBR_K
WBR_KOP5d ago
Thanks for your message! I think I may leave a feature request in the Github repo. 👍
Phorcys
Phorcys5d ago
please send the link here if you do!
Codercord
Codercord5d ago
@Phorcys closed the thread.

Did you find this page helpful?