Skip to content

InfraPlatformer/elastic-terraform-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ Advanced Elasticsearch & Terraform Infrastructure

Enterprise-grade Elasticsearch monitoring stack deployed with Infrastructure as Code (IaC) and automated CI/CD pipelines across multiple cloud providers. Enterprise-grade Elasticsearch monitoring stack deployed with Infrastructure as Code (IaC) and automated CI/CD pipelines across multiple cloud providers (AWS EKS + Azure AKS).

CI/CD Pipeline Terraform Kubernetes Elasticsearch

🎯 Project Overview

This project provides a complete, production-ready Elasticsearch monitoring stack deployed across multiple cloud providers (AWS EKS and Azure AKS) using Terraform. It includes automated CI/CD pipelines, multi-environment support, enterprise-grade security features, and true multi-cloud capabilities.

✨ Key Features

  • πŸ—οΈ Infrastructure as Code - Complete multi-cloud infrastructure defined in Terraform
  • 🌐 Multi-Cloud Support - Deploy on AWS EKS, Azure AKS, or both simultaneously
  • πŸš€ Automated CI/CD - GitHub Actions pipeline with multi-environment deployment
  • πŸ”’ Enterprise Security - X-Pack security, SSL/TLS, and RBAC
  • πŸ“Š Monitoring Stack - Elasticsearch, Kibana, and comprehensive monitoring
  • 🌍 Multi-Environment - Development, Staging, and Production configurations
  • πŸ’° Cost Optimization - Auto-scaling, spot instances, and resource management
  • πŸ”„ GitOps Ready - ArgoCD integration for advanced deployment strategies

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    GitHub Repository                        β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Development   β”‚  β”‚     Staging     β”‚  β”‚ Production  β”‚ β”‚
β”‚  β”‚     Branch      β”‚  β”‚     Branch      β”‚  β”‚   Branch    β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                 GitHub Actions CI/CD                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   Security  β”‚  β”‚   Validate  β”‚  β”‚   Deploy & Test    β”‚ β”‚
β”‚  β”‚    Scan     β”‚  β”‚  Terraform  β”‚  β”‚   Environments     β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
                             β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    Multi-Cloud Infrastructure               β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚     AWS     β”‚  β”‚    Azure    β”‚  β”‚   Elasticsearch     β”‚ β”‚
β”‚  β”‚     EKS     β”‚  β”‚     AKS     β”‚  β”‚   + Kibana Stack    β”‚ β”‚
β”‚  β”‚  (Primary)  β”‚  β”‚ (Secondary) β”‚  β”‚   (Multi-Cloud)     β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Prerequisites

1. Clone Repository

git clone https://github.com/InfraPlatformer/elastic-terraform-demo.git
cd elastic-terraform-demo

2. Configure Cloud Credentials

AWS Configuration

aws configure
# Enter your AWS Access Key ID, Secret Access Key, and Region

Azure Configuration

az login
az account set --subscription "your-subscription-id"

3. Deploy Development Environment

# Navigate to development environment
cd environments/development

# Initialize Terraform
terraform init

# Plan deployment (multi-cloud)
terraform plan

# Apply infrastructure
terraform apply -auto-approve

4. Access Your Multi-Cloud Stack

# Configure kubectl for AWS EKS
aws eks update-kubeconfig --region us-west-2 --name advanced-elastic-development-aws

# Configure kubectl for Azure AKS
az aks get-credentials --resource-group multi-cloud-elastic-rg --name advanced-elastic-development-aws-azure

# Check Elasticsearch on AWS
kubectl get pods -n elasticsearch --context=aws

# Check Elasticsearch on Azure
kubectl get pods -n elasticsearch --context=azure

# Port forward Kibana (AWS)
kubectl port-forward -n elasticsearch svc/advanced-elastic-development-aws-elasticsearch-aws 9200:9200 --context=aws

# Port forward Kibana (Azure)
kubectl port-forward -n elasticsearch svc/advanced-elastic-development-aws-elasticsearch-azure 9200:9200 --context=azure

πŸ”§ CI/CD Pipeline Setup

1. Configure GitHub Secrets

Follow the Secrets Setup Guide to configure:

  • AWS credentials for each environment
  • Azure credentials for each environment
  • Environment protection rules
  • Deployment permissions

2. Push to Trigger Pipeline

git add .
git commit -m "Initial CI/CD setup"
git push origin develop  # Triggers development deployment

3. Monitor Pipeline

  • View runs in GitHub Actions tab
  • Check deployment status in AWS Console
  • Check deployment status in Azure Portal
  • Monitor Kubernetes resources with kubectl

🌍 Environment Configurations

Development Environment

  • Purpose: Local development and testing
  • Resources: Multi-cloud (AWS EKS + Azure AKS)
  • Auto-deploy: βœ… On develop branch
  • Security: Basic (disabled for development)
  • Cloud Providers: AWS (us-west-2) + Azure (West US 2)

Staging Environment

  • Purpose: Pre-production testing
  • Resources: Medium (t3.large instances)
  • Auto-deploy: βœ… On main branch
  • Security: Production-like with SSL
  • Cloud Providers: AWS (us-west-2)

Production Environment

  • Purpose: Live production workloads
  • Resources: High (m5.large/xlarge instances)
  • Auto-deploy: ❌ Manual approval required
  • Security: Enterprise-grade with full encryption
  • Cloud Providers: AWS (us-west-2)

πŸ“ Project Structure

elastic-terraform/
β”œβ”€β”€ .github/                          # GitHub Actions CI/CD
β”‚   β”œβ”€β”€ workflows/
β”‚   β”‚   └── terraform-deploy.yml     # Main CI/CD pipeline
β”‚   └── SETUP_SECRETS.md             # Secrets configuration guide
β”œβ”€β”€ environments/                     # Environment-specific configs
β”‚   β”œβ”€β”€ development/
β”‚   β”‚   β”œβ”€β”€ main.tf                  # Development environment main config
β”‚   β”‚   β”œβ”€β”€ variables.tf             # Development environment variables
β”‚   β”‚   β”œβ”€β”€ outputs.tf               # Development environment outputs
β”‚   β”‚   └── terraform.tfvars         # Development environment variables
β”‚   β”œβ”€β”€ staging/
β”‚   β”‚   └── terraform.tfvars         # Staging environment variables
β”‚   └── production/
β”‚       └── terraform.tfvars         # Production environment variables
β”œβ”€β”€ modules/                          # Reusable Terraform modules
β”‚   β”œβ”€β”€ eks/                         # EKS cluster module
β”‚   β”œβ”€β”€ azure-aks/                   # Azure AKS cluster module
β”‚   β”œβ”€β”€ elasticsearch/               # Elasticsearch module
β”‚   β”œβ”€β”€ kibana/                      # Kibana module
β”‚   β”œβ”€β”€ monitoring/                  # Monitoring stack module
β”‚   β”œβ”€β”€ networking/                  # VPC and networking module
β”‚   └── multi-cloud-elasticsearch/   # Multi-cloud Elasticsearch module
β”œβ”€β”€ elasticsearch-values.yaml         # Elasticsearch Helm values
β”œβ”€β”€ kibana-values.yaml               # Kibana Helm values
β”œβ”€β”€ main.tf                          # Main Terraform configuration
β”œβ”€β”€ variables.tf                     # Variable definitions
β”œβ”€β”€ outputs.tf                       # Output values
└── README.md                        # This file

πŸ”’ Security Features

  • X-Pack Security: Authentication and authorization
  • SSL/TLS Encryption: In-transit and at-rest encryption
  • RBAC: Role-based access control
  • Network Policies: Kubernetes network security
  • IAM Integration: AWS IAM roles and policies
  • Azure RBAC: Azure role-based access control
  • Secret Management: Kubernetes secrets and cloud provider secret management

πŸ“Š Monitoring & Observability

  • Elasticsearch: Centralized logging and search across clouds
  • Kibana: Data visualization and management
  • Prometheus: Metrics collection
  • Grafana: Advanced dashboards
  • Alerting: Automated notifications
  • Log Aggregation: Centralized log management
  • Multi-Cloud Visibility: Cross-cloud monitoring and alerting

πŸ’° Cost Optimization

  • Auto-scaling: Automatic resource scaling based on demand
  • Spot Instances: Use of AWS spot instances for non-critical workloads
  • Resource Limits: Proper CPU and memory limits
  • Storage Optimization: Efficient EBS volume management
  • Multi-Cloud Cost Management: Cost tracking across cloud providers
  • Monitoring: Cost tracking and optimization recommendations

🚨 Troubleshooting

Common Issues

  1. Multi-Cloud Connection Issues
# Check AWS Elasticsearch status
kubectl get pods -n elasticsearch --context=aws

# Check Azure Elasticsearch status
kubectl get pods -n elasticsearch --context=azure

# Check cross-cloud connectivity
kubectl logs -n elasticsearch elasticsearch-aws-0 --context=aws
kubectl logs -n elasticsearch elasticsearch-azure-0 --context=azure
  1. Terraform State Issues
# Reinitialize Terraform
terraform init -reconfigure

# Import existing resources
terraform import aws_eks_cluster.main cluster-name
terraform import azurerm_kubernetes_cluster.main cluster-name
  1. CI/CD Pipeline Failures
  • Check GitHub Actions logs
  • Verify AWS and Azure credentials
  • Check environment protection rules
  • Verify multi-cloud configuration

Getting Help

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments


⭐ Star this repository if you find it helpful!

πŸ”— Connect with us:

About

Complete Infrastructure as Code solution for deploying Elasticsearch and Kibana on AWS EKS using Terraform

Resources

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published