This commit is contained in:
Sam
2025-09-26 09:36:07 +00:00
parent bdb8e87790
commit 8496c9de14
7 changed files with 97 additions and 3 deletions
+27
View File
@@ -0,0 +1,27 @@
name: Terraform
on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
- name: Terraform Init
run: terraform -chdir=environments/dev init
- name: Terraform Validate
run: terraform -chdir=environments/dev validate
- name: Terraform Plan
run: terraform -chdir=environments/dev plan
+3
View File
@@ -1,6 +1,9 @@
# Terraform
.terraform/ .terraform/
*.tfstate *.tfstate
*.tfstate.backup *.tfstate.backup
.terraform.lock.hcl .terraform.lock.hcl
# Local configs
terraform.tfvars terraform.tfvars
*.override.tf *.override.tf
+20
View File
@@ -1 +1,21 @@
# Terraform Azure Bootcamp # Terraform Azure Bootcamp
This repo contains hands-on Terraform projects on Azure, following a structured learning path:
1. Foundations (VM, Virtual Network)
2. Modules
3. Remote State & Environments
4. Scaling & Advanced Patterns
5. Security & Testing
6. Production-Ready 3-Tier Architecture
## 📂 Structure
- `modules/` → reusable Terraform modules (network, compute, database, etc.)
- `environments/` → environment-specific configs (`dev`, `prod`)
- `.github/workflows/terraform.yml` → CI/CD with GitHub Actions
## 🚀 Usage
```bash
cd environments/dev
terraform init
terraform plan
terraform apply
+8
View File
@@ -0,0 +1,8 @@
terraform {
backend "azurerm" {
resource_group_name = "terraform"
storage_account_name = "tfstoracccom"
container_name = "tfstate"
key = "dev.terraform.tfstate"
}
}
+12
View File
@@ -0,0 +1,12 @@
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "4.46.0"
}
}
}
provider "azurerm" {
# Configuration options
}
+7 -1
View File
@@ -1 +1,7 @@
output "vnet_id" { value = "<placeholder>" } output "vnet_id" {
value = azurerm_virtual_network.main.id
}
output "subnet_ids" {
value = { for s in azurerm_subnet.subnets : s.name => s.id }
}
+19 -1
View File
@@ -1 +1,19 @@
variable "resource_group_name" { type = string } variable "resource_group_name" {
description = "Name of the resource group"
type = string
}
variable "location" {
description = "Azure region"
type = string
}
variable "address_space" {
description = "CIDR for the Virtual Network"
type = list(string)
}
variable "subnets" {
description = "Map of subnet names and CIDRs"
type = map(string)
}