terraform { required_providers { coder = { source = "coder/coder" } kubernetes = { source = "hashicorp/kubernetes" } } } data "coder_parameter" "home_disk" { name = "Disk Size" description = "How large should the disk storing the home directory be?" icon = "https://cdn-icons-png.flaticon.com/512/2344/2344147.png" type = "number" default = 10 mutable = true validation { min = 10 max = 100 } } variable "use_kubeconfig" { type = bool sensitive = true default = true description = <<-EOF Use host kubeconfig? (true/false) Set this to false if the Coder host is itself running as a Pod on the same Kubernetes cluster as you are deploying workspaces to. Set this to true if the Coder host is running outside the Kubernetes cluster for workspaces. A valid "~/.kube/config" must be present on the Coder host. EOF } provider "coder" { } variable "namespace" { type = string sensitive = true description = "The namespace to create workspaces in (must exist prior to creating workspaces)" } variable "create_tun" { type = bool sensitive = true description = "Add a TUN device to the workspace." default = false } variable "create_fuse" { type = bool description = "Add a FUSE device to the workspace." sensitive = true default = false } variable "max_cpus" { type = string sensitive = true description = "Max number of CPUs the workspace may use (e.g. 2)." } variable "min_cpus" { type = string sensitive = true description = "Minimum number of CPUs the workspace may use (e.g. .1)." } variable "max_memory" { type = string description = "Maximum amount of memory to allocate the workspace (in GB)." sensitive = true } variable "min_memory" { type = string description = "Minimum amount of memory to allocate the workspace (in GB)." sensitive = true } provider "kubernetes" { # Authenticate via ~/.kube/config or a Coder-specific ServiceAccount, depending on admin preferences config_path = var.use_kubeconfig == true ? "~/.kube/config" : null } data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} resource "coder_agent" "main" { os = "linux" arch = "amd64" startup_script = <