From 6fc304d2cd32174a79eca6d35042308d5a197ed0 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Tue, 8 Nov 2022 21:15:58 +0900 Subject: [PATCH] updated the storage source naming convention in a coder template --- docker-stack/coder/docker-service-simple/main.tf | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docker-stack/coder/docker-service-simple/main.tf b/docker-stack/coder/docker-service-simple/main.tf index 37d46d2..cb46955 100644 --- a/docker-stack/coder/docker-service-simple/main.tf +++ b/docker-stack/coder/docker-service-simple/main.tf @@ -21,7 +21,11 @@ data "coder_workspace" "me" { } locals { - workspace_name = "${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}" + dcw_owner = replace(replace("${data.coder_workspace.me.owner}", "~", "~~"), "-", "~-") + dcw_name = replace(replace("${data.coder_workspace.me.name}", "~", "~~"), "-", "~-") + + ##workspace_name = "${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}" + workspace_name = "${local.dcw_owner}-${local.dcw_name}" ## this points to the workspace parent directory accessible from the docker host. workspace_dir = "/home/gfs-data/coder/workspace/${local.workspace_name}" @@ -32,6 +36,7 @@ locals { } resource "null_resource" "workspace" { + count = 1 triggers = { dir = local.server_workspace_dir @@ -87,12 +92,12 @@ resource "docker_service" "workspace" { ##depends_on = [local_file.workspace] depends_on = [null_resource.workspace] - ##count = data.coder_workspace.me.start_count + count = data.coder_workspace.me.start_count name = "coder-${data.coder_workspace.me.owner}-${lower(data.coder_workspace.me.name)}" task_spec { container_spec { - image = "codercom/code-server:latest" + image = "codercom/code-server:4.8.3" hostname = lower(data.coder_workspace.me.name) command = ["sh"] ##args = ["-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]