terraform { required_providers { coder = { source = "coder/coder" version = "0.5.3" } kubernetes = { source = "hashicorp/kubernetes" version = "~> 2.12.1" } } } variable "use_kubeconfig" { type = bool sensitive = 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 } variable "namespace" { type = string sensitive = true description = "The namespace to create workspaces in (must exist prior to creating workspaces)" } variable "home_disk_size" { type = number description = "How large would you like your home volume to be (in GB)?" default = 10 validation { condition = var.home_disk_size >= 1 error_message = "Value must be greater than or equal to 1." } } 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" {} resource "coder_agent" "main" { os = "linux" arch = "amd64" startup_script = <