Skip to content

Files

Latest commit

 

History

History
67 lines (52 loc) · 3.01 KB

File metadata and controls

67 lines (52 loc) · 3.01 KB
page_title subcategory description
coder_agent Resource - terraform-provider-coder
Use this resource to associate an agent.

coder_agent (Resource)

Use this resource to associate an agent.

Example Usage

data "coder_workspace" "me" {
}

resource "coder_agent" "dev" {
  os   = "linux"
  arch = "amd64"
  dir  = "/workspace"
}

resource "kubernetes_pod" "dev" {
  count = data.coder_workspace.me.start_count
  spec {
    container {
      command = ["sh", "-c", coder_agent.dev.init_script]
      env {
        name  = "CODER_AGENT_TOKEN"
        value = coder_agent.dev.token
      }
    }
  }
}

Schema

Required

  • arch (String) The architecture the agent will run on. Must be one of: "amd64", "armv7", "arm64".
  • os (String) The operating system the agent will run on. Must be one of: "linux", "darwin", or "windows".

Optional

  • auth (String) The authentication type the agent will use. Must be one of: "token", "google-instance-identity", "aws-instance-identity", "azure-instance-identity".
  • connection_timeout (Number) Time in seconds until the agent is marked as timed out when a connection with the server cannot be established. A value of zero never marks the agent as timed out.
  • dir (String) The starting directory when a user creates a shell session. Defaults to $HOME.
  • env (Map of String) A mapping of environment variables to set inside the workspace.
  • login_before_ready (Boolean) This option defines whether or not the user can (by default) login to the workspace before it is ready. Ready means that e.g. the startup_script is done and has exited. When enabled, users may see an incomplete workspace when logging in.
  • motd_file (String) The path to a file within the workspace containing a message to display to users when they login via SSH. A typical value would be /etc/motd.
  • shutdown_script (String) A script to run before the agent is stopped. The script should exit when it is done to signal that the workspace can be stopped.
  • shutdown_script_timeout (Number) Time in seconds until the agent lifecycle status is marked as timed out during shutdown, this happens when the shutdown script has not completed (exited) in the given time.
  • startup_script (String) A script to run after the agent starts. The script should exit when it is done to signal that the agent is ready.
  • startup_script_timeout (Number) Time in seconds until the agent lifecycle status is marked as timed out during start, this happens when the startup script has not completed (exited) in the given time.
  • troubleshooting_url (String) A URL to a document with instructions for troubleshooting problems with the agent.

Read-Only

  • id (String) The ID of this resource.
  • init_script (String) Run this script on startup of an instance to initialize the agent.
  • token (String, Sensitive) Set the environment variable "CODER_AGENT_TOKEN" with this token to authenticate an agent.