Added hcloud token to terraform

This commit is contained in:
2023-11-06 18:07:21 +01:00
parent 4465165da0
commit 09ddd2f454
4 changed files with 29 additions and 1 deletions
+2
View File
@@ -63,4 +63,6 @@ module "test_cluster" {
client_secret : var.vault_client_secret client_secret : var.vault_client_secret
} }
vault_allowed_namespaces = ["wahlrecht"] vault_allowed_namespaces = ["wahlrecht"]
hcloud_token_enabled = true
hcloud_token = var.hcloud_token
} }
@@ -113,6 +113,9 @@ resource "hcloud_server" "manager" {
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 allowed_namespaces : var.vault_allowed_namespaces
hcloud_token_enabled : var.hcloud_token_enabled
hcloud_token : var.hcloud_token
hcloud_namespace : var.hcloud_namespace
})) }))
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"))
argocd_values : base64encode(file("${path.module}/templates/helm/argocd-values.yaml")) argocd_values : base64encode(file("${path.module}/templates/helm/argocd-values.yaml"))
@@ -5,4 +5,8 @@ vault:
applicationNamespaces: applicationNamespaces:
%{ for namespace in allowed_namespaces ~} %{ for namespace in allowed_namespaces ~}
- ${namespace} - ${namespace}
%{ endfor ~} %{ endfor ~}
hcloud:
enabled: ${hcloud_token_enabled}
token: ${hcloud_token}
namespace: {$hcloud_namespace}
@@ -153,4 +153,23 @@ variable "vault_allowed_namespaces" {
description = "Namespaces that are allowed to access secrets from the Vault" description = "Namespaces that are allowed to access secrets from the Vault"
type = list(string) type = list(string)
default = [] default = []
}
variable "hcloud_token_enabled" {
description = "If true, the hcloud token will be injected into the cluster as a secret"
type = bool
default = true
}
variable "hcloud_token" {
description = "Contains the hcloud token. If enabled, it must be filled"
type = string
default = ""
sensitive = true
}
variable "hcloud_namespace" {
description = "Namespace in which the hcloud token will be created"
type = string
default = "hcloud"
} }