You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
modules/vault-jwt
Muhammad Atif Ali c9b1651ff5 Clarify role mapping in Vault integration docs 10 months ago
..
README.md Clarify role mapping in Vault integration docs 10 months ago
main.test.ts feat: add Hashicorp Vault JWT integration module 10 months ago
main.tf feat: add Hashicorp Vault JWT integration module 10 months ago
run.sh feat: add Hashicorp Vault JWT integration module 10 months ago

README.md

display_name description icon maintainer_github partner_github verified tags
Hashicorp Vault Integration (JWT) Authenticates with Vault using a JWT from Coder's OIDC provider ../.icons/vault.svg coder hashicorp true
helper
integration
vault
jwt
oidc

Hashicorp Vault Integration (JWT)

This module lets you authenticate with Hashicorp Vault in your Coder workspaces using a JWT from Coder's OIDC provider.

module "vault" {
  source         = "registry.coder.com/modules/vault-jwt/coder"
  version        = "1.0.17"
  agent_id       = coder_agent.example.id
  vault_addr     = "https://vault.example.com"
  vault_jwt_role = "coder" # The Vault role to use for authentication
}

Then you can use the Vault CLI in your workspaces to fetch secrets from Vault:

vault kv get -namespace=coder -mount=secrets coder

or using the Vault API:

curl -H "X-Vault-Token: ${VAULT_TOKEN}" -X GET "${VAULT_ADDR}/v1/coder/secrets/data/coder"

Vault login

Configuration

To configure the Vault module, you must set up a Vault JWT auth method. See the Vault documentation for more information.

Examples

Configure Vault integration with a non standard auth path

module "vault" {
  source              = "registry.coder.com/modules/vault-jwt/coder"
  version             = "1.0.17"
  agent_id            = coder_agent.example.id
  vault_addr          = "https://vault.example.com"
  vault_jwt_auth_path = "oidc"
  vault_jwt_role      = "coder" # The Vault role to use for authentication
}

Configure Vault integration with a role from your OIDC provider by mapping the workspace owner's group to a Vault role

data "coder_workspace_owner" "me" {}

module "vault" {
  source         = "registry.coder.com/modules/vault-jwt/coder"
  version        = "1.0.7"
  agent_id       = coder_agent.example.id
  vault_addr     = "https://vault.example.com"
  vault_jwt_role = data.coder_workspace_owner.me.groups[0]
}

Configure Vault integration and install a specific version of the Vault CLI

module "vault" {
  source            = "registry.coder.com/modules/vault-jwt/coder"
  version           = "1.0.17"
  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.17.5"
}