Midaz Terraform Foundation is a repository with ready-made Terraform examples to help you create the base infrastructure needed to run Midaz, using the best practices of the main cloud providers: AWS, GCP, or Azure.
This base infrastructure includes:
Network (VPC, subnets)
DNS
Database
Redis/Valkey
Kubernetes cluster (EKS, GKE, or AKS)
AttentionThe Midaz Terraform Foundation templates do not include MongoDB or RabbitMQ. These services aren’t consistently offered as managed services across all major cloud providers (AWS, GCP, Azure).
Provisioning infrastructure shouldn’t be slow, inconsistent, or error-prone. The midaz-terraform-foundation helps you move fast while staying aligned with Lerian’s best practices for security, observability, and scalability. Here’s how it compares to manual or ad-hoc setups:
Easy – modular and versioned for painless updates.
Hard – scripts break easily.
Lerian support
Included – verified and supported by Lerian.
None – not guaranteed.
Estimated deployment time
1 day – including validation.
1–2 weeks – with higher operational risk.
TipLooking for speed, reliability, and long-term support?midaz-terraform-foundation helps you deploy faster, avoid common pitfalls, and scale with confidence — all backed by Lerian’s engineering standards.
This repository provides Terraform examples for deploying foundation infrastructure. It does not include a CI/CD pipeline. You’ll need to create one based on your project’s needs.Already running a Terraform CI/CD pipeline? Here’s what to do:
1
Skip the deployment script; It’s intended for local use only.
2
Copy the relevant example configs into your private Infrastructure as Code repo
3
Integrate the Terraform configs into your pipeline as needed
4
Use your CI/CD platform’s built-in secret management to handle credentials securely
The repository is designed with a unique structure for each cloud provider. This means that every component of the infrastructure is organized to support a modular and controlled approach. You have the flexibility to deploy only what you need, or go all in with the entire foundation if you prefer.
Terraform requires a remote backend to manage its state. To get started with these templates, it’s essential to set up a storage bucket for the Terraform state files first.
When it comes to deploying infrastructure in production environments, managing credentials with care is crucial for maintaining security. Here’s a guide on how to handle credentials securely:
When using the deploy script locally, we highly encourage utilizing cloud provider CLI authentication tools instead of raw credentials. This method is significantly more secure, as it automatically manages credential rotation, MFA, and token refresh for you!Why adopt this approach?
Ensure that all prerequisites are complete and that your remote state bucket has been created.
2
Fill in all the placeholders in the backend.tf files.
3
Make the script executable
Copy
Ask AI
chmod +x deploy.sh
4
Run the script
Copy
Ask AI
./deploy.sh
5
When prompted, select your cloud provider.
6
The script will automatically
i. Check the remaining placeholders.
ii. Run terraform init, plan, and apply for each component.
iii. Deploy in the correct order and stop if something fails.
Using the cloud brings fantastic opportunities, but it also comes with important responsibilities. To help keep your Midaz infrastructure secure, we recommend:
Always use private Kubernetes clusters to limit public exposure.
Access the Kubernetes API via VPN instead of allowing public access.
Set up and enforce RBAC (Role-Based Access Control) to manage user permissions effectively.
Store all secrets in the cloud provider’s secret management service.
Give service accounts only the permissions they truly need.