|
| 1 | +# Terraform Template - Azure Load Balancer |
| 2 | + |
| 3 | +Costa Rica |
| 4 | + |
| 5 | +[](https://github.com/) |
| 6 | +[brown9804](https://github.com/brown9804) |
| 7 | + |
| 8 | +Last updated: 2025-06-12 |
| 9 | + |
| 10 | +---------- |
| 11 | + |
| 12 | +> This template contains Terraform configurations to create and manage an Azure Load Balancer with its associated components including public IP, backend pool, health probe, and load balancing rules. |
| 13 | +
|
| 14 | +> [!NOTE] |
| 15 | +> The Load Balancer configuration uses Standard SKU which provides enhanced features and scalability compared to Basic SKU. |
| 16 | +
|
| 17 | +<p align="center"> |
| 18 | + <img width="750" alt="image" src="https://github.com/user-attachments/assets/b4f46023-3b27-4ff3-a637-dfc9deedf4aa"> |
| 19 | +</p> |
| 20 | + |
| 21 | +## File Descriptions |
| 22 | + |
| 23 | +- **main.tf**: Contains the main configuration for creating the Azure Load Balancer and its associated resources. |
| 24 | +- **variables.tf**: Defines the input variables used in the Terraform configuration. |
| 25 | +- **provider.tf**: Configures the Azure provider to interact with Azure resources. |
| 26 | +- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`. |
| 27 | +- **outputs.tf**: Defines the outputs such as Load Balancer ID and public IP address. |
| 28 | + |
| 29 | +## Variables |
| 30 | + |
| 31 | +> Below is a list of variables used in this template, their expected values, types, and examples: |
| 32 | +
|
| 33 | +| Variable Name | Description | Type | Example Value | |
| 34 | +|--------------|-------------|------|---------------| |
| 35 | +| `subscription_id` | The Azure subscription ID | string | `"your-subscription-id"` | |
| 36 | +| `resource_group_name` | The name of the resource group | string | `"my-resource-group"` | |
| 37 | +| `location` | The Azure region to deploy resources | string | `"eastus"` | |
| 38 | +| `load_balancer_name` | The name of the load balancer | string | `"my-load-balancer"` | |
| 39 | +| `public_ip_name` | The name of the public IP address | string | `"my-lb-public-ip"` | |
| 40 | +| `frontend_ip_configuration_name` | Name of the frontend IP configuration | string | `"frontend-ip-config"` | |
| 41 | +| `backend_pool_name` | Name of the backend address pool | string | `"backend-pool"` | |
| 42 | +| `health_probe_name` | Name of the health probe | string | `"health-probe"` | |
| 43 | +| `lb_rule_name` | Name of the load balancer rule | string | `"lb-rule"` | |
| 44 | +| `lb_sku` | SKU of the load balancer | string | `"Standard"` | |
| 45 | +| `probe_protocol` | Protocol for health probe | string | `"Tcp"` | |
| 46 | +| `probe_port` | Port for health probe | number | `80` | |
| 47 | +| `frontend_port` | Frontend port for load balancer rule | number | `80` | |
| 48 | +| `backend_port` | Backend port for load balancer rule | number | `80` | |
| 49 | +| `tags` | Tags to apply to all resources | map | `{ "Environment": "Production" }` | |
| 50 | + |
| 51 | +## Usage |
| 52 | + |
| 53 | +1. Clone the repository and navigate to the load balancer directory |
| 54 | +2. Update the `terraform.tfvars` file with your values |
| 55 | +3. Initialize and apply the Terraform configuration: |
| 56 | + |
| 57 | +```bash |
| 58 | +terraform init |
| 59 | +terraform plan |
| 60 | +terraform apply |
| 61 | +``` |
| 62 | + |
| 63 | +## Outputs |
| 64 | + |
| 65 | +| Output Name | Description | |
| 66 | +|-------------|-------------| |
| 67 | +| `load_balancer_id` | The ID of the Load Balancer | |
| 68 | +| `public_ip_address` | The public IP address of the Load Balancer | |
| 69 | +| `backend_pool_id` | The ID of the Backend Address Pool | |
| 70 | +| `frontend_ip_configuration_id` | The ID of the Frontend IP Configuration | |
| 71 | + |
| 72 | +<div align="center"> |
| 73 | + <h3 style="color: #4CAF50;">Total Visitors</h3> |
| 74 | + <img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/> |
| 75 | +</div> |
0 commit comments