This project demonstrates secure deployment of PostgreSQL database in Azure using Cosmos DB for PostgreSQL. The architecture follows security and scalability best practices.
- Virtual Network (VNet): Isolated network environment with CIDR block 10.0.0.0/16
- Database Subnet: Dedicated subnet for database (10.0.1.0/24)
- Private Endpoint Subnet: Subnet for private endpoints (10.0.2.0/24)
- Network Security Groups (NSG): Traffic control at subnet level
- Cosmos DB for PostgreSQL: Fully managed PostgreSQL service
- Private Endpoint: Private connection without internet access
- RBAC: Role-based access control
- Managed Identity: Secure authentication without passwords
- Private DNS Zone: Name resolution for private endpoints
- Key Vault: Storage for secrets and encryption keys
- Zero Trust: All connections are verified and authorized
- Defense in Depth: Multi-layered protection
- Least Privilege: Minimum necessary access rights
- Network Segmentation: Component isolation
├── README.md # Project documentation
├── main.tf # Main Terraform configuration
├── variables.tf # Variables
├── outputs.tf # Output values
├── terraform.tfvars.example # Variable examples
├── versions.tf # Provider versions
├── modules/ # Terraform modules
│ ├── networking/
│ ├── database/
│ └── security/
└── .github/workflows/ # CI/CD pipelines
- Terraform >= 1.5.0
- Azure CLI >= 2.40.0
- Active Azure subscription
- Permissions to create Azure resources
# Clone repository
git clone <repository-url>
cd AzureProblem
# Azure authentication
az login
# Terraform initialization
terraform init# Copy variable examples
cp terraform.tfvars.example terraform.tfvars
# Edit variables according to your requirements
nano terraform.tfvars# Check deployment plan
terraform plan
# Apply configuration
terraform applyAfter deployment, the database is accessible only through private network:
- From virtual machine in the same VNet
- Through VPN Gateway for connection from on-premises network
- Through Azure Bastion for secure administrative access
# Connection via psql
psql "host=<private-endpoint-fqdn> port=5432 dbname=postgres user=<username>"The project includes GitHub Actions workflow for:
- Terraform code validation
- Linting and formatting
- Automated testing
- Secure deployment
- Azure Monitor for performance monitoring
- Log Analytics for centralized logging
- Azure Security Center for security tracking
- Automatic backups
The architecture complies with:
- Azure Well-Architected Framework
- GDPR data protection requirements
- SOC 2 security standards
- PCI DSS for payment data processing
For questions and issues, create an issue in the repository or contact the Platform team.