Skip to content

NeuralgoLyzr/terraform-azure-modules

Repository files navigation

terraform-azure-modules

Versioned Terraform module library for the Lyzr platform. All modules target terraform ~> 1.14 and azurerm ~> 4.0.


Module Catalogue

Module What it builds
vnet VNet, subnets, NSGs, NAT Gateway
application-gateway Application Gateway with WAF, SSL termination, AGIC support
private-endpoint Private Endpoint with Private DNS Zone
aks AKS cluster, node pools, managed identity
container-registry Azure Container Registry
postgresql-flexible PostgreSQL Flexible Server
mysql-flexible MySQL Flexible Server
cosmosdb-mongo Cosmos DB MongoDB API
redis Azure Cache for Redis
storage-account Storage Account, blob containers
service-bus Service Bus namespace, queues, topics
key-vault Key Vault
function-app Linux Function App
application-insights Application Insights, Log Analytics Workspace
virtual-machine Linux Virtual Machine
dns-zone Azure DNS Zone and records (optional)
state-backend Azure Storage for Terraform remote state

Using a Module

1. Source pinning

Always pin to a version tag. Never use ?ref=main.

module "vnet" {
  source = "git::https://github.com/NeuralgoLyzr/terraform-azure-modules.git//modules/vnet?ref=v0.1.0"

  company             = "mycompany"
  product             = "myproduct"
  environment         = "dev"
  location            = "westeurope"
  resource_group_name = "mycompany-myproduct-dev-we-rg"
}

2. Bring your own resources

Every module that could already exist in a client environment supports a create flag:

module "vnet" {
  source = "git::https://github.com/NeuralgoLyzr/terraform-azure-modules.git//modules/vnet?ref=v0.1.0"

  create          = false
  existing_vnet_name = "my-existing-vnet"
  resource_group_name = "my-existing-rg"
  environment     = "prod"
  location        = "westeurope"
}

3. Naming convention

All resource names are built automatically inside locals.tf using this pattern:

{company}-{product}-{environment}-{region-short}-{resource-type}

Example: lyzr-studio-dev-we-vnet

4. Mandatory tags

Every resource gets these tags automatically:

Environment   = var.environment
Product       = var.product
ManagedBy     = "terraform"
Owner         = var.owner
CostCenter    = var.cost_center
TerraformRepo = var.terraform_repo
Module        = "<module-name>"

Pass additional tags via var.tags — they are merged on top.

5. Remote state references

data "terraform_remote_state" "networking" {
  backend = "azurerm"
  config = {
    resource_group_name  = "lyzr-studio-tfstate-we-rg"
    storage_account_name = "lyzrstudiotfstatest"
    container_name       = "tfstate"
    key                  = "dev/networking/terraform.tfstate"
  }
}

subnet_id = data.terraform_remote_state.networking.outputs.subnet_ids["aksSubnet"]

Adding a New Module

See CONTRIBUTING.md for full guidance.


Versioning

Releases are automated by release-please. Commit title drives the version bump:

PR title prefix Version bump
feat(<module>): MINOR
fix(<module>): PATCH
feat(<module>)!: MAJOR
chore: none

Local Development

# Format all modules
terraform fmt -recursive modules/

# Validate a single module
terraform -chdir=modules/vnet init -backend=false && terraform -chdir=modules/vnet validate

# Lint a single module
tflint --init
tflint --chdir=modules/vnet

# Security scan
checkov -d modules/vnet --framework terraform

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages