Skip to content

Latest commit

 

History

History
58 lines (47 loc) · 1.97 KB

workspace_owner.md

File metadata and controls

58 lines (47 loc) · 1.97 KB
page_title subcategory description
coder_workspace_owner Data Source - terraform-provider-coder
Use this data source to fetch information about the workspace owner.

coder_workspace_owner (Data Source)

Use this data source to fetch information about the workspace owner.

Example Usage

provider "coder" {}

data "coder_workspace_owner" "me" {}

resource "coder_agent" "dev" {
  arch = "amd64"
  os   = "linux"
  dir  = "/workspace"
  env = {
    OIDC_TOKEN : data.coder_workspace_owner.me.oidc_access_token,
  }
}

# Add git credentials from coder_workspace_owner
resource "coder_env" "git_author_name" {
  agent_id = coder_agent.agent_id
  name     = "GIT_AUTHOR_NAME"
  value    = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
}

resource "coder_env" "git_author_email" {
  agent_id = coder_agent.dev.id
  name     = "GIT_AUTHOR_EMAIL"
  value    = data.coder_workspace_owner.me.email
  count    = data.coder_workspace_owner.me.email != "" ? 1 : 0
}

Schema

Read-Only

  • email (String) The email address of the user.
  • full_name (String) The full name of the user.
  • groups (List of String) The groups of which the user is a member.
  • id (String) The UUID of the workspace owner.
  • login_type (String) The type of login the user has.
  • name (String) The username of the user.
  • oidc_access_token (String) A valid OpenID Connect access token of the workspace owner. This is only available if the workspace owner authenticated with OpenID Connect. If a valid token cannot be obtained, this value will be an empty string.
  • session_token (String) Session token for authenticating with a Coder deployment. It is regenerated every time a workspace is started.
  • ssh_private_key (String, Sensitive) The user's generated SSH private key.
  • ssh_public_key (String) The user's generated SSH public key.