mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
feat(infrastructure): add basic terraform resources
This commit is contained in:
61
tofu/main.tf
Normal file
61
tofu/main.tf
Normal file
@@ -0,0 +1,61 @@
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "kubernetes" {
|
||||
config_path = "./kubeconfig"
|
||||
}
|
||||
|
||||
provider "kubectl" {
|
||||
config_path = "./kubeconfig"
|
||||
}
|
||||
|
||||
|
||||
provider "helm" {
|
||||
kubernetes = {
|
||||
config_path = "./kubeconfig"
|
||||
}
|
||||
}
|
||||
|
||||
module "loadbalancer" {
|
||||
source = "${path.module}/config/metallb"
|
||||
depends_on = [ module.storage ]
|
||||
|
||||
metallb_ip_range = var.metallb_ip_range
|
||||
}
|
||||
|
||||
|
||||
module "database" {
|
||||
source = "${path.module}/config/maxscale"
|
||||
depends_on = [ module.storage, module.loadbalancer ]
|
||||
|
||||
mariadb_password = var.mariadb_password
|
||||
mariadb_root_password = var.mariadb_root_password
|
||||
mariadb_user_name = var.mariadb_user_name
|
||||
mariadb_user_host = var.mariadb_user_host
|
||||
mariadb_user_password = var.mariadb_user_password
|
||||
|
||||
maxscale_ip = var.metallb_maxscale_ip
|
||||
service_ip = var.metallb_service_ip
|
||||
primary_ip = var.metallb_primary_ip
|
||||
secondary_ip = var.metallb_secondary_ip
|
||||
|
||||
phpmyadmin_enabled = var.phpmyadmin_enabled
|
||||
}
|
||||
|
||||
module "storage" {
|
||||
source = "${path.module}/config/storage"
|
||||
}
|
||||
Reference in New Issue
Block a user