This project provisions a scalable, secure, and reusable Azure infrastructure using Terraform. It consists of several modules to manage key Azure resources. The goal is to make the infrastructure easily deployable and customizable for multiple clients.
- Provisions an Azure Virtual Network (VNET), Subnet, and associates a Network Security Group (NSG) to protect the network traffic.
- Resources Created:
- Virtual Network
- Subnet
- Network Security Group (NSG)
- Creates an Azure Storage Account and an associated container.
- Resources Created:
- Storage Account
- Storage Container
- Provisions an Azure Linux Virtual Machine and connects it to the VNET.
- Resources Created:
- Linux Virtual Machine
- Network Interface (NIC)
- VM Disk
- Provisions an Azure Key Vault and stores sensitive secrets, including the Virtual Machine credentials and Storage Account Access Keys.
- Resources Created:
- Azure Key Vault
- Key Vault Secrets (VM credentials, Storage Account Access Key)
Before using this Terraform configuration, ensure you have the following:
- Azure Subscription: You need a valid Azure subscription to provision resources.
- Azure CLI: Install the Azure CLI and ensure you are authenticated using:
az login
- Terraform CLI: Install the Terraform CLI
- Service Principal (Optional): If automating, create an Azure service principal and configure it in your environment:
az ad sp create-for-rbac --name terraform --role Contributor
- Configure Variables: Create/Edit the terraform.tfvars file with your specific values.
- Initialize Terraform: Run the following command to initialize the working directory that contains the configuration files:
terraform init
- Plan the Infrastructure: Use the terraform plan command to preview the infrastructure changes and verify if the configuration is correct:
terraform plan -out="main.tfplan"
- Apply the Changes: Once you're satisfied with the plan, apply the changes to create the resources in Azure:
terraform apply "main.tfplan"
- Destroy the Infrastructure: If you want to tear down the infrastructure created by this configuration, use the following command:
terraform destroy