allow a SA from factory project (ansible orchestrator) to read cms cloudflare turnstile values for crowdsec captcha
All checks were successful
Helm Charts / Detect changed charts (push) Successful in 23s
Helm Charts / Library charts tool (push) Has been skipped
Helm Charts / Application charts pgcat (push) Has been skipped

This commit is contained in:
2025-12-03 15:18:20 +01:00
parent c490d37fd7
commit 2d5ec8a859

View File

@@ -0,0 +1,25 @@
locals {
factory_crowdsec_conf_sa_name = "factory-ansible-tool-crowdsec-traefik-plugin"
}
data "vault_policy_document" "factory_crowdsec_conf" {
rule {
path = "kvv2/data/cms/factory/*" # cms.git//cloudflare/iac.tf
capabilities = ["read", "list"]
}
}
resource "vault_policy" "factory_crowdsec_conf" {
name = "factory_crowdsec_conf"
policy = data.vault_policy_document.factory_crowdsec_conf.hcl
}
resource "vault_kubernetes_auth_backend_role" "factory_crowdsec_conf" {
backend = vault_auth_backend.kubernetes.path
role_name = "factory_crowdsec_conf"
bound_service_account_names = [local.factory_crowdsec_conf_sa_name]
bound_service_account_namespaces = ["kube-system"]
token_ttl = 3600
token_policies = ["default", vault_policy.factory_crowdsec_conf.name]
audience = "vault"
alias_name_source = "serviceaccount_name"
}