A collection of reusable Terraform modules for building Azure infrastructure, optimized for serverless and containerized applications.
This package provides the following Terraform modules:
- ACR - Azure Container Registry with Docker image building and private endpoint integration
- VNet - Virtual Network with specialized subnets for functions and infrastructure
- Redis - Azure Managed Redis Enterprise with private endpoint configuration
- Cosmos - Cosmos DB with Table API for session functionality
- Terraform >= 1.9.5
- Azure Provider >= 4.57.0, < 5.0.0
- Docker (for ACR module)
Each module can be used independently by referencing it as a submodule:
# VNet Module
module "vnet" {
source = "../common/modules/vnet"
resource_group_name = "myapp-prod-rg"
location = "East US"
vnet_cidr = "10.0.0.0/16"
private_subnet_cidrs = ["10.0.3.0/24", "10.0.4.0/24"]
prefix = "myapp-prod"
}
# Redis Module
module "redis" {
source = "../common/modules/redis"
prefix = "myapp-prod-cache"
resource_group_name = "myapp-prod-rg"
vnet_name = module.vnet.vnet_name
subnet_name = module.vnet.private_subnet_name
function_subnet = module.vnet.function_subnet_name
}
# Cosmos DB Module
module "cosmos" {
source = "../common/modules/cosmos"
prefix = "myapp-prod-data"
table_name = "session_store"
resource_group_name = "myapp-prod-rg"
vnet_name = module.vnet.vnet_name
subnet_id = module.vnet.private_subnet_ids[0]
}
# ACR Module
module "acr" {
source = "../common/modules/acr"
prefix = "myapp-prod-api"
source_path = "src/api"
resource_group_name = "myapp-prod-rg"
}Each module has its own comprehensive documentation:
- ACR Module Documentation
- VNet Module Documentation
- Redis Module Documentation
- Cosmos Module Documentation
| Name | Version |
|---|---|
| Terraform | >= 1.9.5 |
| Azure Provider | >= 4.0.0 |
| Docker Provider | 3.6.2 (for ACR) |
# Create VNet for Azure Functions
module "vnet" {
source = "../common/modules/vnet"
resource_group_name = var.resource_group_name
location = var.region
prefix = var.prefix
}
# Create Redis cache with private endpoint
module "redis" {
count = var.create_redis_cluster ? 1 : 0
source = "../common/modules/redis"
prefix = var.prefix
resource_group_name = var.resource_group_name
vnet_name = module.vnet.vnet_name
subnet_name = module.vnet.private_subnet_name
function_subnet = module.vnet.function_subnet_name
is_production = var.is_production
}
# Create Cosmos DB for session storage
module "cosmos" {
count = var.create_cosmosdb_cluster ? 1 : 0
source = "../common/modules/cosmos"
prefix = var.prefix
table_name = "session_store"
resource_group_name = var.resource_group_name
vnet_name = module.vnet.vnet_name
subnet_id = module.vnet.private_subnet_ids[0]
}# Create VNet for Container Apps
module "vnet" {
source = "../common/modules/vnet"
resource_group_name = var.resource_group_name
location = var.region
prefix = var.prefix
}
# Build and store container images
module "docker_image" {
source = "../common/modules/acr"
prefix = var.prefix
source_path = var.package_path
resource_group_name = var.resource_group_name
}
# Create Redis for caching
module "redis" {
count = var.create_redis_cluster ? 1 : 0
source = "../common/modules/redis"
prefix = var.prefix
resource_group_name = var.resource_group_name
vnet_name = module.vnet.vnet_name
subnet_name = module.vnet.private_subnet_name
function_subnet = module.vnet.function_subnet_name
}
# Create Cosmos DB for data storage
module "cosmos" {
count = var.create_cosmosdb_cluster ? 1 : 0
source = "../common/modules/cosmos"
prefix = var.prefix
table_name = "session_store"
resource_group_name = var.resource_group_name
vnet_name = module.vnet.vnet_name
subnet_id = module.vnet.private_subnet_ids[0]
}The modules follow a consistent networking pattern:
- VNet: Creates specialized subnets for different purposes
- Infrastructure Subnet: For private endpoints, Redis, Cosmos DB
- Function Subnet: Dedicated for Azure Functions with proper delegation
- Private Endpoints: All data services use private endpoints for security
- NAT Gateway: Provides secure outbound internet access
- Private by Default: All services disable public access
- VNet Integration: Resources communicate through private networks
- Managed Identity: Services use Azure AD authentication where possible
- Encryption: Data encrypted at rest and in transit
graph TD
A[VNet Module] --> B[Redis Module]
A --> C[Cosmos Module]
A --> D[ACR Module]
B --> E[Application]
C --> E
D --> E
Typical deployment order:
- VNet (provides networking foundation)
- Redis, Cosmos, ACR (can be deployed in parallel)
- Application resources (Functions, Container Apps)
Contributions are welcome! Please refer to the main repository for contribution guidelines.
This project is licensed under the terms specified in the LICENSE file.
- Agent Kernel - The main Agent Kernel project
For issues, questions, or contributions, please refer to the main repository's issue tracker.
This is a registry-compatible root module that contains no resources itself. All functionality is provided through submodules located in the modules/ directory. This structure allows for:
- Selective consumption: Use only the modules you need
- Independent versioning: Each module evolves independently
- Registry compatibility: Conforms to Terraform registry requirements
- Namespace isolation: Clean module paths via
//modules/<name>syntax
Important: Always reference modules using the ../common/modules/<module-name> syntax as shown in the usage examples above.
Unless otherwise specified, all content, including all source code files and documentation files in this repository are:
Copyright (c) 2025-2026 Yaala Labs.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.