Skip to content

Commit 5a568d8

Browse files
authored
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
1 parent 8df02f4 commit 5a568d8

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

dogfood/main.tf

+17-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,19 @@ terraform {
1111
}
1212
}
1313

14+
# User parameters
15+
16+
variable "dotfiles_uri" {
17+
type = string
18+
description = <<-EOF
19+
default = ""
20+
Dotfiles repo URI (optional)
21+
22+
see https://dotfiles.github.io
23+
EOF
24+
default = ""
25+
}
26+
1427
variable "datocms_api_token" {
1528
type = string
1629
description = "An API token from DATOCMS for usage with building our website."
@@ -39,7 +52,10 @@ resource "coder_agent" "dev" {
3952
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
4053
code-server --auth none --port 13337 &
4154
sudo service docker start
42-
coder dotfiles -y 2>&1 | tee ~/.personalize.log
55+
DOTFILES_URI=${var.dotfiles_uri}
56+
if [ -n "$DOTFILES_URI" ]; then
57+
coder dotfiles var.dotfiles_uri -y 2>&1 | tee ~/.personalize.log
58+
fi
4359
EOF
4460
}
4561

0 commit comments

Comments
 (0)