feat(anomaly/modules/tmux)!: refactor tmux resource to use coder_utils module and update script handling

This commit is contained in:
35C4n0r 2026-05-06 08:58:41 +05:30
parent c4661ae365
commit ae735e95cb
No known key found for this signature in database
GPG Key ID: 5B71E5C9D18D5675

View File

@ -50,16 +50,16 @@ variable "sessions" {
default = ["default"] default = ["default"]
} }
resource "coder_script" "tmux" { module "coder_utils" {
source = "registry.coder.com/coder/coder-utils/coder"
version = "0.0.1"
agent_id = var.agent_id agent_id = var.agent_id
display_name = "tmux"
icon = "/icon/terminal.svg" icon = "/icon/terminal.svg"
script = templatefile("${path.module}/scripts/run.sh", { install_script = templatefile("${path.module}/scripts/run.sh", {
TMUX_CONFIG = base64encode(var.tmux_config) TMUX_CONFIG = base64encode(var.tmux_config)
SAVE_INTERVAL = var.save_interval SAVE_INTERVAL = var.save_interval
}) })
run_on_start = true module_directory = "$HOME/.coder-modules/anomaly/tmux"
run_on_stop = false
} }
resource "coder_app" "tmux_sessions" { resource "coder_app" "tmux_sessions" {
@ -76,3 +76,8 @@ resource "coder_app" "tmux_sessions" {
SESSION_NAME = each.value SESSION_NAME = each.value
}) })
} }
output "scripts" {
description = "Ordered list of coder exp sync names for the coder_script resources this module actually creates, in run order (pre_install, install, post_install). Scripts that were not configured are absent from the list."
value = module.coder_utils.scripts
}