refactor: conditionally use dotfiles in dogfood template (#5332)

* feat: add dotfiles_uri var to dogfood template

* refactor: use dotfiles if dotfiles var exists

This ensures the `coder dotfiles` command only runs if the dotfiles var
in the template is not empty.

* Update dogfood/main.tf

* refactor: assign variable to shell variable

* Update dogfood/main.tf

* fixup!: add default value
This commit is contained in:
Joe Previte
2022-12-13 21:15:25 +00:00
committed by GitHub
parent 8df02f42c0
commit 5a568d8a9b
+17 -1
View File
@@ -11,6 +11,19 @@ terraform {
}
}
# User parameters
variable "dotfiles_uri" {
type = string
description = <<-EOF
default = ""
Dotfiles repo URI (optional)
see https://dotfiles.github.io
EOF
default = ""
}
variable "datocms_api_token" {
type = string
description = "An API token from DATOCMS for usage with building our website."
@@ -39,7 +52,10 @@ resource "coder_agent" "dev" {
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
code-server --auth none --port 13337 &
sudo service docker start
coder dotfiles -y 2>&1 | tee ~/.personalize.log
DOTFILES_URI=${var.dotfiles_uri}
if [ -n "$DOTFILES_URI" ]; then
coder dotfiles var.dotfiles_uri -y 2>&1 | tee ~/.personalize.log
fi
EOF
}