Skip to content

Terraform Module Structure

XxrzxX edited this page May 10, 2025 · 1 revision

πŸ“Œ Terraform Infrastructure Overview

πŸ—‚ Project Structure

Your Terraform project is organized into various modules, each responsible for a specific infrastructure component:

Terraform/
β”œβ”€β”€ modules/
β”‚   β”œβ”€β”€ vm/                 # Virtual Machine 
β”‚   β”œβ”€β”€ vmss/               # Virtual Machine Scale Sets
β”‚   β”œβ”€β”€ Vnet/               # VNet, Subnets, NSGs
β”‚   β”œβ”€β”€ KV/                 # Key Vault, IAM policies
β”‚   β”œβ”€β”€ storage/            # Storage accounts, Blob storage
β”‚   β”œβ”€β”€ db/                 # Databases (PostgreSQL)
β”‚   β”œβ”€β”€ gateway/            # Azure Gateway setup
β”œβ”€β”€ main.tf                 # Root Terraform configuration
β”œβ”€β”€ data.tf                 # Fetches existing cloud resources (e.g., existing VMs, storage, Device Ip)
β”œβ”€β”€ outputs.tf              # Captures values for use in other modules or external systems
β”œβ”€β”€ provider.tf             # Specifies cloud provider configurations (Azure)
β”œβ”€β”€ terraform.tfvars        # Stores variable values for easy customization
└── variables.tf            # Defines input variables to make configurations flexible

πŸ“Š Brainboard Illustration To simplify the logical flow of this infrastructure ⬇


This diagram shows dependencies between key components:

  • Resource Groups define logical units.
  • Virtual Machines & VMSS provide scalable compute resources.
  • Networking & Subnets ensure secure communication across components.
  • Storage & Databases handle persistent data storage.
  • Azure Gateway & Bastion Host secure remote connections.
  • Key Vault protects sensitive information.

πŸ”Ž How It Works

Terraform provisions this infrastructure automatically, ensuring:

  • Modular Design: Each component is reusable & independent.
  • Scalability: VMSS ensures dynamic scaling based on demand.
  • Security: NSGs, IAM policies, and Key Vault enhance protection.
  • Automation: GitHub Actions & Terraform ensure consistent deployment.

πŸ”— Next

Clone this wiki locally