mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 06:57:47 +01:00
Some checks are pending
Deploy Prod / Run Python Tests (push) Waiting to run
Deploy Prod / Build and push image (reusable) (push) Blocked by required conditions
Deploy Prod / Generate Production URLs (push) Blocked by required conditions
Deploy Prod / Frontend - Build and Deploy to Cloudflare Pages (prod) (push) Blocked by required conditions
Deploy Prod / Helm upgrade/install (prod) (push) Blocked by required conditions
83 lines
2.4 KiB
HCL
83 lines
2.4 KiB
HCL
terraform {
|
|
required_providers {
|
|
kubectl = {
|
|
source = "gavinbunney/kubectl"
|
|
version = "1.19.0"
|
|
}
|
|
helm = {
|
|
source = "hashicorp/helm"
|
|
version = "3.0.2"
|
|
}
|
|
kubernetes = {
|
|
source = "hashicorp/kubernetes"
|
|
version = "2.38.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "kubernetes_namespace" "mariadb-operator" {
|
|
metadata {
|
|
name = "mariadb-operator"
|
|
}
|
|
}
|
|
|
|
locals {
|
|
mariadb_secret_yaml = templatefile("${path.module}/mariadb-secret.yaml", {
|
|
password = var.mariadb_password
|
|
user_password = var.mariadb_user_password
|
|
root_password = var.mariadb_root_password
|
|
})
|
|
}
|
|
|
|
resource "kubectl_manifest" "secrets" {
|
|
yaml_body = local.mariadb_secret_yaml
|
|
depends_on = [kubernetes_namespace.mariadb-operator]
|
|
}
|
|
|
|
|
|
resource "helm_release" "mariadb-operator-crds" {
|
|
name = "mariadb-operator-crds"
|
|
repository = "https://helm.mariadb.com/mariadb-operator"
|
|
chart = "mariadb-operator-crds"
|
|
namespace = "mariadb-operator"
|
|
version = "25.8.4"
|
|
depends_on = [kubectl_manifest.secrets]
|
|
timeout = 3600
|
|
}
|
|
|
|
|
|
resource "helm_release" "mariadb-operator" {
|
|
name = "mariadb-operator"
|
|
repository = "https://helm.mariadb.com/mariadb-operator"
|
|
chart = "mariadb-operator"
|
|
depends_on = [helm_release.mariadb-operator-crds, kubectl_manifest.secrets]
|
|
namespace = "mariadb-operator"
|
|
version = "25.8.3"
|
|
timeout = 3600
|
|
}
|
|
|
|
resource "helm_release" "maxscale_helm" {
|
|
name = "maxscale-helm"
|
|
chart = "${path.module}/charts/maxscale-helm"
|
|
version = "1.0.15"
|
|
depends_on = [helm_release.mariadb-operator-crds, kubectl_manifest.secrets]
|
|
timeout = 3600
|
|
|
|
set = [
|
|
{ name = "user.name", value = var.mariadb_user_name },
|
|
{ name = "user.host", value = var.mariadb_user_host },
|
|
{ name = "metallb.maxscale_ip", value = var.maxscale_ip },
|
|
{ name = "metallb.service_ip", value = var.service_ip },
|
|
{ name = "metallb.primary_ip", value = var.primary_ip },
|
|
{ name = "metallb.secondary_ip", value = var.secondary_ip },
|
|
{ name = "phpmyadmin.enabled", value = tostring(var.phpmyadmin_enabled) },
|
|
{ name = "base_domain", value = var.cloudflare_domain },
|
|
{ name = "s3.key_id", value = var.s3_key_id },
|
|
{ name = "s3.key_secret", value = var.s3_key_secret },
|
|
{ name = "s3.enabled", value = var.s3_enabled },
|
|
{ name = "s3.endpoint", value = var.s3_endpoint },
|
|
{ name = "s3.region", value = var.s3_region },
|
|
{ name = "s3.bucket", value = var.s3_bucket },
|
|
]
|
|
}
|