Overview
This guide will show you how to create a JWT Authentication Method, and how to configure env zero to utilize OIDC to authenticate to your vault cluster to retrieve secrets. Refer to env zero’s OIDC configuration. We are going to follow the Vault documentation on how to create a JWT AuthenticationJWT Authentication Method
- Login to your vault cluster
- In the side navigation bar click on
Access - Choose
Authentication Methodsin the left side menu - Click on the
Enable new methodbutton and it will open the Authentication method creation wizard - Choose
JWT - Expand
Method Optionsadd a description and the relevant configuration and click on theEnabled Methodbutton - In the
Configure JWTpage under theJwks urlenterhttps://login.app.env0.com/.well-known/jwks.json - Expand
JWT Optionsand set theBound issuerto behttps://login.app.env0.com/ - Click on the
Savebutton

Configure JWT
Setup Secrets Store and Create Policy
Create a KV store in vault to save and fetch secrets.Create Login Role
To create the role that binds the policy,sub, aud and env0 custom claims we will use the vault CLI. Make sure you have it installed on your machine and that you have access to vault. Export the following environment variables:
VAULT_TOKEN environment variable to authenticate but if you prefer, you can skip it and use vault login instead.
Now execute the following command to create the role:
More ClaimsIn this example we only set the
aud, the organizationId and the apiKeyType claims, however you can also set any additional claims you would like from the list of claims we support. The list is located hereAuthenticating to Vault with env zero Credential
Go to the organization’s credentials page and create a new deployment credential. SelectVault OIDC type and enter the following fields:
Address- The vault address, including portVersion- The vault version to useRole Name- Vault role nameJWT Auth Backend Path- Path to the new authentication methodNamespace- Optional, the vault namespace

Authenticating to Vault with Terraform Provider
To configure the vault terraform provider all you need is the vault provider block and theVAULT OIDC deployment credentials set on the project. Example:
VAULT OIDC deployment credentials are used to authenticate with the vault server along with the ENV0_OIDC_TOKEN JWT token which then sets the VAULT_TOKEN variable with the actual session token that is returned from the vault server used for authentication/authorization.