Skip to content

Terraform RabbitMQ module facilitates the deployment of RabbitMQ using Helm on AWS, Azure, or GCP, providing a flexible and scalable messaging solution across multiple cloud environments.

License

Notifications You must be signed in to change notification settings

squareops/terraform-kubernetes-rabbitmq

Repository files navigation

RabbitMQ

squareops_avatar

SquareOps Technologies Your DevOps Partner for Accelerating cloud journey.


This Terraform module allows you to deploy a RabbitMQ message broker on a Kubernetes cluster. It uses the [official RabbitMQ](https://github.com/bitnami/charts/tree/main/bitnami/rabbitmq) Helm chart to create a scalable, highly-available RabbitMQ cluster.

The module provides a simple way to configure and deploy RabbitMQ on Kubernetes, including the ability to:

  1. Customize the name and environment of the RabbitMQ deployment
  2. Specify the number of replicas in the cluster
  3. Set up persistent storage using a specific storage class and volume size
  4. Deploy a RabbitMQ exporter to collect metrics for Grafana
  5. Control whether or not to create the Kubernetes namespace for the deployment

The module also includes sensible defaults for all configuration options, making it easy to get up and running with RabbitMQ on Kubernetes quickly.

Supported Versions:

Rabbitmq Helm Chart Version K8s supported version (EKS, AKS & GCP)
14.4.6 1.23,1.24,1.25,1.26,1.27,1.28,1.29

Usage Example

locals {
  name        = "rabbitmq"
  region      = "us-east-2"
  environment = "prod"
  additional_tags = {
    Owner      = "organization_name"
    Expires    = "Never"
    Department = "Engineering"
  }
  create_namespace                 = true
  namespace                        = "rabbitmq"
  store_password_to_secret_manager = false
  custom_credentials_enabled       = false
  custom_credentials_config = {
    rabbitmq_password     = "aa0z1IoRjOgRuon3aG",
    erlangcookie_password = "bbddff0z1IoRuon3aG"
  }
}

module "aws" {
  source                           = "https://github.com/sq-ia/terraform-kubernetes-rabbitmq.git//modules/resources/aws"
  environment                      = local.environment
  name                             = local.name
  store_password_to_secret_manager = local.store_password_to_secret_manager
  custom_credentials_enabled       = local.custom_credentials_enabled
  custom_credentials_config        = local.custom_credentials_config
}

module "rabbitmq" {
  source           = "https://github.com/sq-ia/terraform-kubernetes-rabbitmq.git"
  create_namespace = local.create_namespace
  namespace        = local.namespace
  rabbitmq_config = {
    name                             = local.name
    hostname                         = "rabbitmq.squareops.in"
    environment                      = local.environment
    values_yaml                      = ""
    volume_size                      = "50Gi"
    replica_count                    = 2
    storage_class_name               = "infra-service-sc"
    store_password_to_secret_manager = local.store_password_to_secret_manager
  }
  rabbitmq_exporter_enabled  = true
  recovery_window_aws_secret = 0
  custom_credentials_enabled = local.custom_credentials_enabled
  custom_credentials_config  = local.custom_credentials_config
  rabbitmq_password          = local.custom_credentials_enabled ? "" : module.aws.rabbitmq_password
  erlangcookie_password      = local.custom_credentials_enabled ? "" : module.aws.erlangcookie_password
}

IAM Permissions

The required IAM permissions to create resources from this module can be found here

Important Notes

  1. In order to enable the exporter, it is required to deploy Prometheus/Grafana first.
  2. The exporter is a tool that extracts metrics data from an application or system and makes it available to be scraped by Prometheus.
  3. Prometheus is a monitoring system that collects metrics data from various sources, including exporters, and stores it in a time-series database.
  4. Grafana is a data visualization and dashboard tool that works with Prometheus and other data sources to display the collected metrics in a user-friendly way.
  5. To deploy Prometheus/Grafana, please follow the installation instructions for each tool in their respective documentation.
  6. Once Prometheus and Grafana are deployed, the exporter can be configured to scrape metrics data from your application or system and send it to Prometheus.
  7. Finally, you can use Grafana to create custom dashboards and visualize the metrics data collected by Prometheus.
  8. This module is compatible with EKS, AKS & GKE which is great news for users deploying the module on an AWS, Azure & GCP cloud. Review the module's documentation, meet specific configuration requirements, and test thoroughly after deployment to ensure everything works as expected.

Requirements

No requirements.

Providers

Name Version
helm n/a
kubernetes n/a

Modules

No modules.

Resources

Name Type
helm_release.rabbitmq resource
kubernetes_namespace.rabbitmq resource

Inputs

Name Description Type Default Required
chart_version Version of the RabbitMQ chart that will be used to deploy the message broker. string "14.4.6" no
create_namespace Specify whether or not to create the namespace if it does not already exist. Set it to true to create the namespace. string true no
custom_credentials_config Specify the configuration settings for Rabbitmq to pass custom credentials during creation. any
{
"erlangcookie_password": "",
"rabbitmq_password": ""
}
no
custom_credentials_enabled Specifies whether to enable custom credentials for Rabbitmq. bool false no
erlangcookie_password password for Rabbitmq erlangcookie string "" no
namespace Name of the Kubernetes namespace where the RabbitMQ deployment will be deployed. string "rabbitmq" no
rabbitmq_config Specify the configuration settings for RabbitMQ, including the name, environment, storage options, replication settings, and custom YAML values. any
{
"environment": "",
"hostname": "",
"name": "",
"replica_count": 2,
"storage_class_name": "",
"store_password_to_secret_manager": "",
"values_yaml": "",
"volume_size": ""
}
no
rabbitmq_exporter_enabled Specify whether or not to deploy RabbitMQ exporter to collect RabbitMQ metrics for monitoring in Grafana. bool true no
rabbitmq_password password for Rabbitmq string "" no
recovery_window_aws_secret Number of days that AWS Secrets Manager will wait before deleting a secret. This value can be set to 0 to force immediate deletion, or to a value between 7 and 30 days to allow for recovery. number 0 no
username Username that will be used for authentication when connecting to the RabbitMQ cluster. string "admin" no

Outputs

Name Description
rabbitmq_credential Rabbitmq credentials used in the Kubernetes cluster.
rabbitmq_endpoints Rabbitmq endpoints in the Kubernetes cluster.

Contribution & Issue Reporting

To report an issue with a project:

  1. Check the repository's issue tracker on GitHub
  2. Search to see if the issue has already been reported
  3. If you can't find an answer to your question in the documentation or issue tracker, you can ask a question by creating a new issue. Be sure to provide enough context and details so others can understand your problem.

License

Apache License, Version 2.0, January 2004 (http://www.apache.org/licenses/).

Support Us

To support a GitHub project by liking it, you can follow these steps:

  1. Visit the repository: Navigate to the GitHub repository.

  2. Click the "Star" button: On the repository page, you'll see a "Star" button in the upper right corner. Clicking on it will star the repository, indicating your support for the project.

  3. Optionally, you can also leave a comment on the repository or open an issue to give feedback or suggest changes.

Starring a repository on GitHub is a simple way to show your support and appreciation for the project. It also helps to increase the visibility of the project and make it more discoverable to others.

Who we are

We believe that the key to success in the digital age is the ability to deliver value quickly and reliably. That’s why we offer a comprehensive range of DevOps & Cloud services designed to help your organization optimize its systems & Processes for speed and agility.

  1. We are an AWS Advanced consulting partner which reflects our deep expertise in AWS Cloud and helping 100+ clients over the last 5 years.
  2. Expertise in Kubernetes and overall container solution helps companies expedite their journey by 10X.
  3. Infrastructure Automation is a key component to the success of our Clients and our Expertise helps deliver the same in the shortest time.
  4. DevSecOps as a service to implement security within the overall DevOps process and helping companies deploy securely and at speed.
  5. Platform engineering which supports scalable,Cost efficient infrastructure that supports rapid development, testing, and deployment.
  6. 24*7 SRE service to help you Monitor the state of your infrastructure and eradicate any issue within the SLA.

We provide support on all of our projects, no matter how small or large they may be.

To find more information about our company, visit squareops.com, follow us on Linkedin, or fill out a job application. If you have any questions or would like assistance with your cloud strategy and implementation, please don't hesitate to contact us.

About

Terraform RabbitMQ module facilitates the deployment of RabbitMQ using Helm on AWS, Azure, or GCP, providing a flexible and scalable messaging solution across multiple cloud environments.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages