8000 feat(dotfiles): Add an optional coder_app to update dotfiles on-demand by matifali · Pull Request #280 · coder/modules · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

feat(dotfiles): Add an optional coder_app to update dotfiles on-demand #280

Merged
merged 7 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions dotfiles/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "If true, this adds a button to workspace page to refresh 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"
Expand All @@ -68,6 +73,18 @@ resource "coder_script" "dotfiles" {
run_on_start = true
}

resource "coder_app" "dotfiles" {
count = var.manual_update ? 1 : 0
agent_id = var.agent_id
display_name = "Refresh 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
Expand Down
0