variable "env" {
description = "Target environment"
type = string
default = "staging"
}
computed "config" {
description = "Merged environment configuration"
expression = merge(
{
LOG_LEVEL = "info"
CACHE_TTL = "300"
MAX_WORKERS = "4"
},
var.env == "production" ? {
LOG_LEVEL = "warn"
MAX_WORKERS = "16"
} : {}
)
}
task "run" {
description = "Start the application with the merged config"
commands = [
"LOG_LEVEL=${computed.config["LOG_LEVEL"]} MAX_WORKERS=${computed.config["MAX_WORKERS"]} ./bin/app",
]
}