Provides a resource for managing an JWT auth backend within Vault.
Manage JWT auth backend:
resource "vault_jwt_auth_backend" "example" {
description = "Demonstration of the Terraform JWT auth backend"
path = "jwt"
oidc_discovery_url = "https://myco.auth0.com/"
bound_issuer = "https://myco.auth0.com/"
}
Manage OIDC auth backend:
resource "vault_jwt_auth_backend" "example" {
description = "Demonstration of the Terraform JWT auth backend"
path = "oidc"
type = "oidc"
oidc_discovery_url = "https://myco.auth0.com/"
oidc_client_id = "1234567890"
oidc_client_secret = "secret123456"
bound_issuer = "https://myco.auth0.com/"
tune {
listing_visibility = "unauth"
}
}
Configuring the auth backend with a `provider_config:
resource "vault_jwt_auth_backend" "gsuite" {
description = "OIDC backend"
oidc_discovery_url = "https://accounts.google.com"
path = "oidc"
type = "oidc"
provider_config = {
provider = "gsuite"
fetch_groups = true
fetch_user_info = true
groups_recurse_max_depth = 1
}
}
The following arguments are supported:
namespace
- (Optional) The namespace to provision the resource in.
The value should not contain leading or trailing forward slashes.
The namespace
is always relative to the provider's configured namespace.
Available only for Vault Enterprise.
path
- (Required) Path to mount the JWT/OIDC auth backend
disable_remount
- (Optional) If set, opts out of mount migration on path updates.
See here for more info on Mount Migration
type
- (Optional) Type of auth backend. Should be one of jwt
or oidc
. Default - jwt
description
- (Optional) The description of the auth backend
oidc_discovery_url
- (Optional) The OIDC Discovery URL, without any .well-known component (base path). Cannot be used in combination with jwt_validation_pubkeys
oidc_discovery_ca_pem
- (Optional) The CA certificate or chain of certificates, in PEM format, to use to validate connections to the OIDC Discovery URL. If not set, system certificates are used
oidc_client_id
- (Optional) Client ID used for OIDC backends
oidc_client_secret
- (Optional) Client Secret used for OIDC backends
oidc_response_mode
- (Optional) The response mode to be used in the OAuth2 request. Allowed values are query
and form_post
. Defaults to query
. If using Vault namespaces, and oidc_response_mode
is form_post
, then namespace_in_state
should be set to false
.
oidc_response_types
- (Optional) List of response types to request. Allowed values are 'code' and 'id_token'. Defaults to ["code"]
. Note: id_token
may only be used if oidc_response_mode
is set to form_post
.
jwks_url
- (Optional) JWKS URL to use to authenticate signatures. Cannot be used with "oidc_discovery_url" or "jwt_validation_pubkeys".
jwks_ca_pem
- (Optional) The CA certificate or chain of certificates, in PEM format, to use to validate connections to the JWKS URL. If not set, system certificates are used.
jwt_validation_pubkeys
- (Optional) A list of PEM-encoded public keys to use to authenticate signatures locally. Cannot be used in combination with oidc_discovery_url
bound_issuer
- (Optional) The value against which to match the iss claim in a JWT
jwt_supported_algs
- (Optional) A list of supported signing algorithms. Vault 1.1.0 defaults to [RS256] but future or past versions of Vault may differ
default_role
- (Optional) The default role to use if none is provided during login
provider_config
- (Optional) Provider specific handling configuration. All values may be strings, and the provider will convert to the appropriate type when configuring Vault.
local
- (Optional) Specifies if the auth method is local only.
namespace_in_state
- (Optional) Pass namespace in the OIDC state parameter instead of as a separate query parameter. With this setting, the allowed redirect URL(s) in Vault and on the provider side should not contain a namespace query parameter. This means only one redirect URL entry needs to be maintained on the OIDC provider side for all vault namespaces that will be authenticating against it. Defaults to true for new configs
tune - (Optional) Extra configuration block. Structure is documented below.
The tune
block is used to tune the auth backend:
default_lease_ttl
- (Optional) Specifies the default time-to-live.
If set, this overrides the global default.
Must be a valid duration string
max_lease_ttl
- (Optional) Specifies the maximum time-to-live.
If set, this overrides the global default.
Must be a valid duration string
audit_non_hmac_response_keys
- (Optional) Specifies the list of keys that will
not be HMAC'd by audit devices in the response data object.
audit_non_hmac_request_keys
- (Optional) Specifies the list of keys that will
not be HMAC'd by audit devices in the request data object.
listing_visibility
- (Optional) Specifies whether to show this mount in
the UI-specific listing endpoint. Valid values are "unauth" or "hidden".
passthrough_request_headers
- (Optional) List of headers to whitelist and
pass from the request to the backend.
allowed_response_headers
- (Optional) List of headers to whitelist and allowing
a plugin to include them in the response.
token_type
- (Optional) Specifies the type of tokens that should be returned by
the mount. Valid values are "default-service", "default-batch", "service", "batch".
In addition to the fields above, the following attributes are exported:
accessor
- The accessor for this auth methodJWT auth backend can be imported using the path
, e.g.
$ terraform import vault_jwt_auth_backend.oidc oidc
or
$ terraform import vault_jwt_auth_backend.jwt jwt