Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions registry/coder/modules/vault-jwt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This module lets you authenticate with [Hashicorp Vault](https://www.vaultprojec
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.2.2"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_role = "coder" # The Vault role to use for authentication
Expand Down Expand Up @@ -42,7 +42,7 @@ curl -H "X-Vault-Token: ${VAULT_TOKEN}" -X GET "${VAULT_ADDR}/v1/coder/secrets/d
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.2.2"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_auth_path = "oidc"
Expand All @@ -58,7 +58,7 @@ data "coder_workspace_owner" "me" {}
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.2.2"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_role = data.coder_workspace_owner.me.groups[0]
Expand All @@ -71,14 +71,30 @@ module "vault" {
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.2.2"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_role = "coder" # The Vault role to use for authentication
vault_cli_version = "1.2.2"
}
```

### Customize the workspace logs display name

By default the workspace logs entry is labeled `Vault (JWT)`. Override it with `display_name` if you run multiple Vault modules in the same workspace:

```tf
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_role = "coder" # The Vault role to use for authentication
display_name = "Vault (Coder OIDC)"
}
```

### Use a custom JWT token

```tf
Expand Down Expand Up @@ -132,7 +148,7 @@ resource "jwt_signed_token" "vault" {
module "vault" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/vault-jwt/coder"
version = "1.2.2"
version = "1.3.0"
agent_id = coder_agent.example.id
vault_addr = "https://vault.example.com"
vault_jwt_role = "coder" # The Vault role to use for authentication
Expand Down
8 changes: 7 additions & 1 deletion registry/coder/modules/vault-jwt/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,15 @@ variable "vault_cli_version" {
}
}

variable "display_name" {
description = "The display name of the coder_script resource shown in the workspace logs."
type = string
default = "Vault (JWT)"
}
Comment thread
Copilot marked this conversation as resolved.

resource "coder_script" "vault" {
agent_id = var.agent_id
display_name = "Vault (GitHub)"
display_name = var.display_name
icon = "/icon/vault.svg"
script = templatefile("${path.module}/run.sh", {
CODER_OIDC_ACCESS_TOKEN : var.vault_jwt_token != null ? var.vault_jwt_token : data.coder_workspace_owner.me.oidc_access_token,
Expand Down
Loading