This repository contains reusable Terraform modules to deploy and manage Azure resources. These modules are designed to simplify infrastructure provisioning and can be used to create and manage various Azure services such as Virtual Machines, Virtual Networks, Resource Groups, and more.
├── modules
│ ├── analytics
│ │ ├── power_bi # Power Bi module
| ├── containers
| | ├── container_registries # Azure Container Registries module
| | ├── kubernetes # Azure Kubernetes module
| ├── dev_tools
| | ├── load_testing # Azure Load Testing module
│ ├── management
| | ├── application_insights # Application Insights module
| | ├── log_analytics_ws # Log Analytics workspace module
│ │ ├── resource_group # Resource Group module
│ ├── networking
│ │ ├── virtual_network # Virtual Network module
│ │ ├── subnet # Subnet module
│ ├── locals # Shared locals module
├── env # Example configurations
│ ├── dev
├── README.md # Documentation (this file)
- Terraform: Install the latest version of Terraform.
- Azure CLI: Install and configure the Azure CLI.
- Azure Subscription: Ensure you have access to an Azure subscription.
git clone <repository_url>
cd <repository_folder>
Before using the modules, ensure the following:
- You have logged into Azure using
az login. - You have set up your Terraform backend for state management (e.g., Azure Blob Storage).
Run the following command to initialize Terraform:
terraform init
-
Plan: Review the changes Terraform will make:
terraform plan -
Apply: Deploy the resources:
terraform apply
To clean up and remove the resources created by Terraform:
terraform destroy
Creates an Azure Resource Group.
Inputs:
rg: Object with resource group details:name: Name of the resource group.location: Azure region.
tags: Tags to apply to the resource group.
Creates an Azure Virtual Network.
Inputs:
vnet: Object with virtual network details:name: Name of the virtual network.address_space: CIDR blocks.rg_name: Resource group for the VNet.location: Azure region.
Creates an Azure Container Registry.
Inputs:
acr: Object with ACR details:acr_name: Name of the ACR.rg_name: Resource group for the ACR.location: Azure region.sku: Size of the ACR.admin_enabled: Should Admin account enabled.public_network_access_enabled: Should ACR is publicly accessible.
- Backend Configuration: Always configure a remote backend for state management (e.g., Azure Blob Storage).
- Versioning: Use version constraints to lock module and provider versions.
- Environment Isolation: Use separate state files and configurations for different environments (e.g., staging, production).
- Shared Locals: Use the
localsmodule for common variables such astagsand default settings.
Feel free to raise issues, suggest features, or submit pull requests. Follow the contributing guidelines.
This repository is licensed under the MIT License.