Files
uis-cloud-computing/tofu/modules/rabbitmq/main.tf

78 lines
1.7 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"
}
kustomization = {
source = "kbst/kustomization"
version = "0.9.6"
}
time = {
source = "hashicorp/time"
version = "0.13.1"
}
}
}
# Define the Helm release for RabbitMQ.
# This resource will install the RabbitMQ chart from the Bitnami repository.
resource "helm_release" "rabbitmq" {
# The name of the release in Kubernetes.
name = "rabbitmq"
# The repository where the chart is located.
repository = "https://charts.bitnami.com/bitnami"
# The name of the chart to deploy.
chart = "rabbitmq"
# The version of the chart to deploy. It's best practice to pin the version.
version = "14.4.1"
# The Kubernetes namespace to deploy into.
# If the namespace doesn't exist, you can create it with a kubernetes_namespace resource.
namespace = "rabbitmq"
create_namespace = true
# Override default chart values.
# This is where you customize your RabbitMQ deployment.
set = [
{
name = "auth.username"
value = "admin"
},
{
name = "auth.password"
value = var.rabbitmq-password
},
{
name = "persistence.enabled"
value = "true"
},
{
name = "replicaCount"
value = "3"
},
{
name = "podAntiAffinityPreset"
value = "soft"
}
]
}
resource "kubectl_manifest" "rabbitmq_ui" {
yaml_body = templatefile("${path.module}/rabbit-ui.yaml", {
base_domain = var.base_domain
})
depends_on = [helm_release.rabbitmq]
}