From a4cfdf9023024fe5a69ff2e60257297033ce9a5b Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 13 Aug 2024 22:48:31 +0300 Subject: [PATCH 1/6] feat(dotfiles): Add an optional coder app to update dotfiles on-demand --- dotfiles/main.tf | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index bfb67e44..c62607b2 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -39,9 +39,14 @@ variable "coder_parameter_order" { default = null } -data "coder_parameter" "dotfiles_uri" { - count = var.dotfiles_uri == null ? 1 : 0 +variable "manual_update" { + type = bool + description = "Choose whether to enable a Coder app to update dotfiles on demand. This will add a button to workspace page to update dotfiles on demand." + default = false +} +data "coder_parameter" "dotfiles_uri" { + count = var.dotfiles_uri == null ? 1 : 0 type = "string" name = "dotfiles_uri" display_name = "Dotfiles URL" @@ -68,6 +73,18 @@ resource "coder_script" "dotfiles" { run_on_start = true } +resource "coder_app" "dotfiles" { + count = var.manual_update + agent_id = var.agent_id + display_name = "Update Dotfiles" + slug = "dotfiles" + icon = "/icon/dotfiles.svg" + command = templatefile("${path.module}/run.sh", { + DOTFILES_URI : local.dotfiles_uri, + DOTFILES_USER : local.user + }) +} + output "dotfiles_uri" { description = "Dotfiles URI" value = local.dotfiles_uri From 10ec56426a59dca2ec5b9cd20abd0148caffa6fe Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 13 Aug 2024 22:50:43 +0300 Subject: [PATCH 2/6] `bun fmt` --- dotfiles/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index c62607b2..f52e0f45 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -79,7 +79,7 @@ resource "coder_app" "dotfiles" { display_name = "Update Dotfiles" slug = "dotfiles" icon = "/icon/dotfiles.svg" - command = templatefile("${path.module}/run.sh", { + command = templatefile("${path.module}/run.sh", { DOTFILES_URI : local.dotfiles_uri, DOTFILES_USER : local.user }) From a561ab471e018b28741f54b5211e14c1af276a09 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Tue, 13 Aug 2024 22:56:11 +0300 Subject: [PATCH 3/6] fixup! --- dotfiles/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index f52e0f45..1b5161fd 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -74,7 +74,7 @@ resource "coder_script" "dotfiles" { } resource "coder_app" "dotfiles" { - count = var.manual_update + count = var.manual_update ? 1 : 0 agent_id = var.agent_id display_name = "Update Dotfiles" slug = "dotfiles" From 5f743d49eabee7567b2032639cde32772b4d7acd Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 14 Aug 2024 09:59:34 +0300 Subject: [PATCH 4/6] Update dotfiles/main.tf Co-authored-by: Chris Golden <551285+cirego@users.noreply.github.com> --- dotfiles/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index 1b5161fd..a2656659 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -41,7 +41,7 @@ variable "coder_parameter_order" { variable "manual_update" { type = bool - description = "Choose whether to enable a Coder app to update dotfiles on demand. This will add a button to workspace page to update dotfiles on demand." + description = "Choose whether to enable a Coder app to refresh dotfiles on demand. This will add a button to workspace page to refresh dotfiles on demand." default = false } From 94bfa31e63177cf72da0d59e0a8b6c123e94e67e Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Wed, 14 Aug 2024 10:00:15 +0300 Subject: [PATCH 5/6] Update --> Refresh --- dotfiles/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index a2656659..c4862d85 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -76,7 +76,7 @@ resource "coder_script" "dotfiles" { resource "coder_app" "dotfiles" { count = var.manual_update ? 1 : 0 agent_id = var.agent_id - display_name = "Update Dotfiles" + display_name = "Refresh Dotfiles" slug = "dotfiles" icon = "/icon/dotfiles.svg" command = templatefile("${path.module}/run.sh", { From b18bab5f7039ed7c95dc937d3f0a62e307ff0d8e Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Fri, 20 Sep 2024 16:54:09 +0500 Subject: [PATCH 6/6] Update dotfiles/main.tf Co-authored-by: Michael Smith --- dotfiles/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotfiles/main.tf b/dotfiles/main.tf index c4862d85..9bc3735e 100644 --- a/dotfiles/main.tf +++ b/dotfiles/main.tf @@ -41,7 +41,7 @@ variable "coder_parameter_order" { variable "manual_update" { type = bool - description = "Choose whether to enable a Coder app to refresh dotfiles on demand. This will add a button to workspace page to refresh dotfiles on demand." + description = "If true, this adds a button to workspace page to refresh dotfiles on demand." default = false }