Assessment 2- Write a terraform file to create an azure express route circuit with 100 Mbps speed, All the code into one single terraform code file.
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Prerequisite
- System ( Windows or Linux)
- Terraform setup file
- Azure CLI
- Access to Azure provider( Subscription)
- Git Bash / PowerShell
- Notepad ++ or any code Editor
Setup to execute the terraform code from git bash CLI. to create an azure express route circuit
- Run the command terraform init for initializing the provider, Prepare your working directory for other commands
- Run the command terraform validate to Check whether the configuration is valid
- Run the command terraform plan Show changes required by the current configuration
- Run the command terraform apply to Create or update infrastructure
# file name create-circute.tf
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "3.12.0"
}
#Provider module and azure Authendiction
provider "azurerm" {
# Configuration options
features {}
subscription_id = "54d18623-a88e-4b6e-bcfe-a772406993b0"
client_id = "7e757450-7239-4c36-88f8-6664f3e49a49"
client_secret = "yhJ8Q~T7ycWjr4PjQ2ZUkTKgLeKTQ82YYGdiscP9"
tenant_id = "bc0f52a6-5a6d-45f4-8842-36ab113a5eb5"
}
#creating new RG call rg-hub-network
resource "azurerm_resource_group" "er-circute" {
name = "rg-hub-network"
location = "West Europe"
}
# code to create express route circuit
resource "azurerm_express_route_circuit" "er-circute" {
name = "ct-dc-azure-west-eu"
resource_group_name = azurerm_resource_group.er-circute.name
location = azurerm_resource_group.er-circute.location
service_provider_name = "Equinix"
peering_location = "Silicon Valley"
bandwidth_in_mbps = 100
sku {
tier = "Standard"
family = "MeteredData"
}
tags = {
environment = "Production"
}
}