Skip to content

About

A collection of reusable Terraform modules for building Microsoft Azure infrastructure, optimized for serverless and containerized applications to deploy Agent Kernel

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Agent Kernel - Azure Common Infrastructure Modules

A collection of reusable Terraform modules for building Azure infrastructure, optimized for serverless and containerized applications.

πŸ“¦ Available Modules

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

πŸš€ Quick Start

Prerequisites

  • Terraform >= 1.9.5
  • Azure Provider >= 4.57.0, < 5.0.0
  • Docker (for ACR module)

Basic Usage

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"
}

πŸ“š Module Documentation

Each module has its own comprehensive documentation:

πŸ”§ Requirements

Name Version
Terraform >= 1.9.5
Azure Provider >= 4.0.0
Docker Provider 3.6.2 (for ACR)

πŸ’‘ Common Patterns

Serverless Application Stack

# 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]
}

Containerized Application Stack

# 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]
}

πŸ—οΈ Architecture Patterns

Network Architecture

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

Security Best Practices

  • 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

πŸ” Module Dependencies

graph TD
    A[VNet Module] --> B[Redis Module]
    A --> C[Cosmos Module]
    A --> D[ACR Module]
    B --> E[Application]
    C --> E
    D --> E
Loading

Typical deployment order:

  1. VNet (provides networking foundation)
  2. Redis, Cosmos, ACR (can be deployed in parallel)
  3. Application resources (Functions, Container Apps)

🀝 Contributing

Contributions are welcome! Please refer to the main repository for contribution guidelines.

πŸ“„ License

This project is licensed under the terms specified in the LICENSE file.

πŸ”— Related Projects

πŸ“ž Support

For issues, questions, or contributions, please refer to the main repository's issue tracker.


πŸ“ Technical Notes

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.

License

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.

About

A collection of reusable Terraform modules for building Microsoft Azure infrastructure, optimized for serverless and containerized applications to deploy Agent Kernel

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages