devops/infra/modules/cluster/management/main.tf

47 lines
1.2 KiB
HCL

resource "minio_s3_object" "kube_config_cluster_yaml" {
bucket_name = var.cluster
object_name = "kube_config.yaml"
content = var.k8s_config_yaml
content_type = "text/plain"
}
resource "minio_s3_object" "ssh_cluster_private_key" {
bucket_name = var.cluster
object_name = "id_rsa"
content = var.ssh_private_key
content_type = "text/plain"
}
resource "minio_s3_object" "ssh_cluster_public_key" {
bucket_name = var.cluster
object_name = "id_rsa.pub"
content = var.ssh_public_key
content_type = "text/plain"
}
resource "minio_s3_object" "vault_secrets" {
count = var.vault_secret_path == null ? 0 : 1
bucket_name = var.cluster
object_name = "vault.secret"
content = file(var.vault_secret_path)
content_type = "text/plain"
}
resource "vault_kv_secret_v2" "hcloud" {
count = var.hcloud_network_id == null && var.hcloud_token == null ? 0 : 1
mount = var.cluster
name = "hcloud"
delete_all_versions = true
data_json = jsonencode({
network_id = var.hcloud_network_id
token = var.hcloud_token
})
depends_on = [var.wait_on]
}
output "installed" {
value = true
}