-
Notifications
You must be signed in to change notification settings - Fork 0
/
kubernetes-auth-backend.tf
31 lines (25 loc) · 1.04 KB
/
kubernetes-auth-backend.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
locals {
is_kubernetes = lower(var.authentication_method) == "kubernetes"
}
resource "vault_auth_backend" "kubernetes_auth_backend" {
count = local.is_kubernetes ? 1 : 0
type = var.authentication_method
path = var.mount_path
description = var.description
dynamic "tune" {
for_each = var.method_options != null ? [1] : []
content {
default_lease_ttl = var.method_options.default_lease_ttl
max_lease_ttl = var.method_options.max_lease_ttl
listing_visibility = var.method_options.listing_visibility
}
}
}
resource "vault_kubernetes_auth_backend_config" "kubernetes_auth_backend_config" {
count = local.is_kubernetes ? 1 : 0
backend = vault_auth_backend.kubernetes_auth_backend[0].path
kubernetes_host = var.kubernetes_config.host
kubernetes_ca_cert = var.kubernetes_config.ca_certificate
token_reviewer_jwt = var.kubernetes_config.token_reviewer_jwt
issuer = var.kubernetes_config.issuer != null ? var.kubernetes_config.issuer : "kubernetes/serviceaccount"
}