-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvault.tf
33 lines (30 loc) · 1.11 KB
/
vault.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
32
33
# AppRole for externalsecrets within the hostedcluster
resource "vault_policy" "this" {
count = var.deploy_vault_app_role ? 1 : 0
name = "${local.name}-vault-approle"
policy = <<EOT
path "secret/data/kubernetes/${var.environment}-${var.project}/common/*" {
capabilities = ["read"]
}
path "secret/data/kubernetes/${var.environment}-${var.project}/${var.cluster}/*" {
capabilities = ["read"]
}
EOT
}
resource "vault_approle_auth_backend_role" "this" {
count = var.deploy_vault_app_role ? 1 : 0
backend = "approle"
role_name = "${local.name}-vault-approle"
token_policies = [vault_policy.this[count.index].name]
}
resource "vault_approle_auth_backend_role_secret_id" "this" {
count = var.deploy_vault_app_role ? 1 : 0
backend = "approle"
role_name = vault_approle_auth_backend_role.this[count.index].role_name
}
# Retrieve GitHub oauth credentials from vault
module "github_oauth_idp" {
count = var.github_oauth_enabled ? 1 : 0
source = "git@github.com:3scale-ops/tf-vault-secret.git?ref=tags/0.1.3"
path = "kubernetes/${var.environment}-${var.project}/${var.cluster}/github-oauth-idp"
}