Turned allowed namespaces into variable

This commit is contained in:
2023-11-06 07:54:51 +01:00
parent 7b1822f242
commit d38d3f12c3
4 changed files with 12 additions and 1 deletions
+1
View File
@@ -62,4 +62,5 @@ module "test_cluster" {
client_id : var.vault_client_id client_id : var.vault_client_id
client_secret : var.vault_client_secret client_secret : var.vault_client_secret
} }
vault_allowed_namespaces = ["wahlrecht"]
} }
@@ -112,6 +112,7 @@ resource "hcloud_server" "manager" {
cluster_setup_values : base64encode(templatefile("${path.module}/templates/helm/cluster-setup-values.yaml", { cluster_setup_values : base64encode(templatefile("${path.module}/templates/helm/cluster-setup-values.yaml", {
client_id : var.vault_service_principal.client_id client_id : var.vault_service_principal.client_id
client_secret : var.vault_service_principal.client_secret client_secret : var.vault_service_principal.client_secret
allowed_namespaces : var.vault_allowed_namespaces
})) }))
argocd_ha_values : base64encode(file("${path.module}/templates/helm/argocd-values-ha.yaml")) argocd_ha_values : base64encode(file("${path.module}/templates/helm/argocd-values-ha.yaml"))
cluster_setup : base64encode(templatefile("${path.module}/templates/scripts/cluster-setup.sh", { cluster_setup : base64encode(templatefile("${path.module}/templates/scripts/cluster-setup.sh", {
@@ -2,4 +2,7 @@ vault:
enabled: true enabled: true
clientId: ${client_id} clientId: ${client_id}
clientSecret: ${client_secret} clientSecret: ${client_secret}
applicationNamespaces: [] applicationNamespaces:
%{ for namespace in allowed_namespaces ~}
- ${namespace}
%{ endfor ~}
@@ -153,4 +153,10 @@ variable "vault_service_principal" {
client_secret : string client_secret : string
}) })
sensitive = true sensitive = true
}
variable "vault_allowed_namespaces" {
description = "Namespaces that are allowed to access secrets from the Vault"
type = list(string)
default = []
} }