Skip to content

Commit 4db90b2

Browse files
authored
Merge pull request #28 from MicrosoftCloudEssentials-LearningHub/expressroute
overview expressroute sample
2 parents bb9d65b + 16958fa commit 4db90b2

File tree

6 files changed

+180
-0
lines changed

6 files changed

+180
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Terraform Template - Azure ExpressRoute
2+
3+
Costa Rica
4+
5+
[![GitHub](https://img.shields.io/badge/--181717?logo=github&logoColor=ffffff)](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 ExpressRoute circuit, including provider, peering location, and bandwidth settings.
13+
14+
> [!NOTE]
15+
> ExpressRoute circuits require coordination with your chosen service provider.
16+
17+
<p align="center">
18+
<img width="700" alt="image" src="https://github.com/user-attachments/assets/7001446c-e5cc-4a16-b443-5a5689f31f68">
19+
</p>
20+
21+
## File Descriptions
22+
23+
- **main.tf**: Contains the main configuration for creating the Azure ExpressRoute circuit.
24+
- **variables.tf**: Defines the input variables used in the Terraform configuration.
25+
- **terraform.tfvars**: Provides default values for the variables defined in `variables.tf`.
26+
- **outputs.tf**: Defines the outputs such as ExpressRoute circuit ID and service key.
27+
28+
## Variables
29+
30+
| Variable Name | Description | Type | Example Value |
31+
|------------------------ |--------------------------------------------------|--------|-----------------------------|
32+
| `subscription_id` | The Azure subscription ID | string | `"00000000-0000-0000-0000-000000000000"` |
33+
| `resource_group_name` | The name of the resource group | string | `"my-expressroute-rg"` |
34+
| `location` | The Azure region to deploy resources | string | `"eastus"` |
35+
| `expressroute_name` | The name of the ExpressRoute circuit | string | `"my-expressroute"` |
36+
| `service_provider_name` | The name of the ExpressRoute service provider | string | `"Equinix"` |
37+
| `peering_location` | The peering location for the ExpressRoute circuit| string | `"Silicon Valley"` |
38+
| `bandwidth_in_mbps` | The bandwidth in Mbps for the circuit | number | `200` |
39+
| `sku_tier` | The SKU tier for ExpressRoute | string | `"Standard"` |
40+
| `sku_family` | The SKU family for ExpressRoute | string | `"MeteredData"` |
41+
42+
## Usage
43+
44+
1. Clone the repository and navigate to the expressroute directory.
45+
2. Update the `terraform.tfvars` file with your values.
46+
3. Initialize and apply the Terraform configuration:
47+
48+
```bash
49+
terraform init
50+
terraform plan
51+
terraform apply
52+
```
53+
54+
## Outputs
55+
56+
| Output Name | Description |
57+
|----------------------------|---------------------------------------------|
58+
| `expressroute_id` | The ID of the ExpressRoute circuit |
59+
| `expressroute_service_key` | The service key of the ExpressRoute circuit |
60+
61+
<div align="center">
62+
<h3 style="color: #4CAF50;">Total Visitors</h3>
63+
<img src="https://profile-counter.glitch.me/brown9804/count.svg" alt="Visitor Count" style="border: 2px solid #4CAF50; border-radius: 5px; padding: 5px;"/>
64+
</div>

3_networking/expressroute/main.tf

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# main.tf
2+
# This file contains the main configuration for creating an Azure ExpressRoute circuit.
3+
4+
# Resource Group
5+
resource "azurerm_resource_group" "er" {
6+
name = var.resource_group_name
7+
location = var.location
8+
}
9+
10+
# ExpressRoute Circuit
11+
resource "azurerm_express_route_circuit" "er" {
12+
name = var.expressroute_name
13+
location = azurerm_resource_group.er.location
14+
resource_group_name = azurerm_resource_group.er.name
15+
service_provider_name = var.service_provider_name
16+
peering_location = var.peering_location
17+
bandwidth_in_mbps = var.bandwidth_in_mbps
18+
19+
sku {
20+
tier = var.sku_tier
21+
family = var.sku_family
22+
}
23+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# outputs.tf
2+
# This file defines the outputs for the ExpressRoute configuration.
3+
4+
output "expressroute_id" {
5+
description = "The ID of the ExpressRoute circuit"
6+
value = azurerm_express_route_circuit.er.id
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# provider.tf
2+
# This file configures the Azure provider to interact with Azure resources.
3+
# It specifies the required provider and its version, along with provider-specific configurations.
4+
5+
terraform {
6+
required_version = ">= 1.8, < 2.0"
7+
# Specify the required provider and its version
8+
required_providers {
9+
azurerm = {
10+
source = "hashicorp/azurerm" # Source of the AzureRM provider
11+
version = "~> 4.16.0" # Version of the AzureRM provider
12+
}
13+
}
14+
}
15+
16+
provider "azurerm" {
17+
features {} # Enable all features for the AzureRM provider
18+
subscription_id = var.subscription_id # Use the subscription ID variable
19+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# terraform.tfvars
2+
# This file provides default values for the variables defined in variables.tf.
3+
# These values can be overridden by specifying different values during Terraform execution.
4+
5+
# Azure Subscription
6+
subscription_id = "" # "your-subscription-id"
7+
8+
# Resource Group
9+
resource_group_name = "RG-expressroute-test"
10+
location = "eastus"
11+
12+
# ExpressRoute Configuration
13+
expressroute_name = "my-expressroute"
14+
service_provider_name = "Equinix"
15+
peering_location = "Silicon Valley"
16+
bandwidth_in_mbps = 200
17+
sku_tier = "Standard"
18+
sku_family = "MeteredData"
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# variables.tf
2+
# This file defines the input variables used in the Terraform configuration.
3+
4+
variable "subscription_id" {
5+
description = "The Azure subscription ID"
6+
type = string
7+
}
8+
9+
variable "resource_group_name" {
10+
description = "The name of the resource group"
11+
type = string
12+
}
13+
14+
variable "location" {
15+
description = "The Azure region to deploy resources"
16+
type = string
17+
}
18+
19+
variable "expressroute_name" {
20+
description = "The name of the ExpressRoute circuit"
21+
type = string
22+
}
23+
24+
variable "service_provider_name" {
25+
description = "The name of the ExpressRoute service provider"
26+
type = string
27+
}
28+
29+
variable "peering_location" {
30+
description = "The peering location for the ExpressRoute circuit"
31+
type = string
32+
}
33+
34+
variable "bandwidth_in_mbps" {
35+
description = "The bandwidth in Mbps for the ExpressRoute circuit"
36+
type = number
37+
}
38+
39+
variable "sku_tier" {
40+
description = "The SKU tier for ExpressRoute (Standard or Premium)"
41+
type = string
42+
default = "Standard"
43+
}
44+
45+
variable "sku_family" {
46+
description = "The SKU family for ExpressRoute (MeteredData or UnlimitedData)"
47+
type = string
48+
default = "MeteredData"
49+
}

0 commit comments

Comments
 (0)