Skip to content

Killingrace/Terraform_Azure_Module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Terraform Azure Infrastructure Module for Todo List Application

This repository contains a comprehensive Terraform configuration designed to provision the infrastructure required for a Todo List application on Microsoft Azure.

The project heavily emphasizes Terraform modularity and best practices, structuring the deployment into logical, reusable components.

🏗 Project Architecture & Terraform Modules

The infrastructure is broken down into specific, purpose-built Terraform modules to ensure clean code, reusability, and easy maintainability.

1. Root Module

The root directory serves as the main entry point for the infrastructure deployment.

  • main.tf: Orchestrates the execution of child modules and creates the base Azure Resource Group.
  • variables.tf / terraform.tfvars: Centralized configuration for input parameters (locations, sizes, names).
  • outputs.tf: Defines the essential outputs like the VM's Public IP to access the deployed application.
  • backend.tf: Configures the remote state backend using Azure Blob Storage for secure state management and team collaboration.

2. Network Module (modules/network)

Responsible for all networking components.

  • Virtual Network (VNet) & Subnet: Creates the isolated network environment.
  • Network Security Group (NSG): Implements security rules (e.g., allowing SSH and HTTP traffic).
  • Public IP Address: Provisions a dynamically allocated Public IP with a custom DNS label.

3. Compute Module (modules/compute)

Responsible for provisioning the virtual machine and bootstrapping the application.

  • Network Interface (NIC): Attaches the VM to the created Subnet and Public IP.
  • Virtual Machine: Provisions an Ubuntu 22.04 VM (Standard_B1s by default) using SSH key authentication.
  • VM Extension (CustomScript): Automatically executes the install-app.sh script during the VM creation phase to install dependencies and deploy the Todo List application without manual intervention.

4. Storage Module (modules/storage)

Responsible for auxiliary storage requirements.

  • Storage Account & Container: Provisions an Azure Storage Account and a specific container (task-artifacts) which can be used for application backups, state files, or artifact storage.

🚀 Getting Started

Prerequisites

  • Terraform installed (v1.0+ recommended)
  • Azure CLI installed and authenticated (az login)
  • An active Azure Subscription

Deployment Steps

  1. Clone the repository:

    git clone <repository-url>
    cd Terraform_Azure_Module
  2. Configure your variables: Review variables.tf and customize the values in terraform.tfvars if necessary (e.g., provide your ssh_key_public content).

  3. Initialize Terraform: This command downloads the required providers (like azurerm) and initializes the remote backend.

    terraform init
  4. Review the execution plan: See exactly what resources Terraform will create before actually making changes.

    terraform plan
  5. Apply the configuration: Provision the resources on Azure. Type yes when prompted.

    terraform apply
  6. Access the Application: Once applied, Terraform will output the Public IP address of the newly created VM. Open that IP in your web browser to access the Todo List application.

🧹 Cleanup

To avoid incurring unwanted charges, destroy the infrastructure when you are done:

terraform destroy

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors