Phase1
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
terraform {
|
||||||
|
backend "azurerm" {
|
||||||
|
resource_group_name = "terraform"
|
||||||
|
storage_account_name = "tfstoracccom"
|
||||||
|
container_name = "tfstate"
|
||||||
|
key = "dev.terraform.tfstate"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
terraform {
|
||||||
|
required_providers {
|
||||||
|
azurerm = {
|
||||||
|
source = "hashicorp/azurerm"
|
||||||
|
version = "4.46.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
provider "azurerm" {
|
||||||
|
# Configuration options
|
||||||
|
}
|
||||||
@@ -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 }
|
||||||
|
}
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user