Skip to content

Commit 0e8e6c9

Browse files
authored
sample added
1 parent 128962c commit 0e8e6c9

File tree

5 files changed

+116
-0
lines changed

5 files changed

+116
-0
lines changed

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)