pull/33/head
Muhammad Atif Ali 2 years ago
parent 2302892929
commit 50eac40f8b

@ -10,7 +10,3 @@ tags: [helper]
# Dotfiles # Dotfiles
Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command. Allow developers to optionally bring their own [dotfiles repository](https://dotfiles.github.io)! Under the hood, this module uses the [coder dotfiles](https://coder.com/docs/v2/latest/dotfiles) command.
TODO:
- [ ] Test it

@ -10,28 +10,28 @@ terraform {
} }
variable "agent_id" { variable "agent_id" {
type = string type = string
description = "The ID of a Coder agent." description = "The ID of a Coder agent."
} }
data "coder_parameter" "dotfiles_uri" { data "coder_parameter" "dotfiles_uri" {
type = "string" type = "string"
display_name = "Dotfiles URL (optional)" display_name = "Dotfiles URL (optional)"
default = "" default = ""
description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace" description = "Enter a URL for a [dotfiles repository](https://dotfiles.github.io) to personalize your workspace"
mutable = true mutable = true
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg" icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
} }
resource "coder_script" "personalize" { resource "coder_script" "personalize" {
agent_id = var.agent_id agent_id = var.agent_id
script =<<-EOT script = <<-EOT
DOTFILES_URI="${data.coder_parameter.dotfiles_uri.value}" DOTFILES_URI="${data.coder_parameter.dotfiles_uri.value}"
if [ -n "$${DOTFILES_URI// }" ]; then if [ -n "$${DOTFILES_URI// }" ]; then
coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.dotfiles.log coder dotfiles "$DOTFILES_URI" -y 2>&1 | tee -a ~/.dotfiles.log
fi fi
EOT EOT
display_name = "Dotfiles" display_name = "Dotfiles"
icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg" icon = "https://raw.githubusercontent.com/jglovier/dotfiles-logo/main/dotfiles-logo-icon.svg"
run_on_start = true run_on_start = true
} }

Loading…
Cancel
Save