-
-
Save bpmct/89cd29a356f8613778f6276df8dac753 to your computer and use it in GitHub Desktop.
Example of Coder template with Dotfiles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
variable "dotfiles_uri" { | |
description = <<EOT | |
Optional: specify a URL for your dotfiles repo | |
- see: https://dotfiles.github.io | |
EOT | |
sensitive = false # user-level variable | |
} | |
resource "coder_agent" "dev" { | |
arch = "amd64" | |
auth = "aws-instance-identity" | |
os = "linux" | |
init_script<<EOT | |
# add dotfiles | |
if [ -n "${var.dotfiles_uri}" ]; then | |
git clone ${var.dotfiles_uri} dotfiles/ | |
cd dotfiles/ | |
if [[ -x "install.sh" ]]; then | |
# run install script | |
install.sh | |
else | |
shopt -s nullglob | |
for dotfile in "$DOTFILES_CLONE_PATH/".*; do | |
# Skip `..` and '.' | |
[[ $dotfile =~ \.{1,2}$ ]] && continue | |
ln -sf "$dotfile" "$HOME" | |
done | |
dotfiles/install.sh | |
fi | |
fi | |
EOT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment