Skip to content

Commit 562eb3e

Browse files
blink-so[bot]M Atif Ali
andcommitted
Update coder-login module to use environment variables
Changed from template variables to environment variables for CODER_USER_TOKEN and CODER_DEPLOYMENT_URL to improve security and flexibility. Co-authored-by: M Atif Ali <[email protected]>
1 parent 97b036e commit 562eb3e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

registry/coder/modules/coder-login/main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ data "coder_workspace_owner" "me" {}
1919

2020
resource "coder_script" "coder-login" {
2121
agent_id = var.agent_id
22-
script = templatefile("${path.module}/run.sh", {
23-
CODER_USER_TOKEN : data.coder_workspace_owner.me.session_token,
24-
CODER_DEPLOYMENT_URL : data.coder_workspace.me.access_url
25-
})
22+
script = templatefile("${path.module}/run.sh", {})
2623
display_name = "Coder Login"
2724
icon = "/icon/coder.svg"
2825
run_on_start = true
2926
start_blocks_login = true
30-
}
31-
27+
env = {
28+
CODER_USER_TOKEN = data.coder_workspace_owner.me.session_token
29+
CODER_DEPLOYMENT_URL = data.coder_workspace.me.access_url
30+
}
31+
}

registry/coder/modules/coder-login/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ printf "$${BOLD}Logging into Coder...\n\n$${RESET}"
99

1010
if ! coder list > /dev/null 2>&1; then
1111
set +x
12-
coder login --token="${CODER_USER_TOKEN}" --url="${CODER_DEPLOYMENT_URL}"
12+
coder login --token="$CODER_USER_TOKEN" --url="$CODER_DEPLOYMENT_URL"
1313
else
1414
echo "You are already authenticated with coder."
1515
fi

0 commit comments

Comments
 (0)