Terraform Infrastructure

יצירת שרתי Web באמצעות Terraform

גרסה 3.0.0 עודכן: 20/02/2025

סקירה כללית

תשתית מודולרית המבוססת על Terraform ליצירה וניהול של תשתיות בענן. הפרויקט כולל מודולים מוכנים לשימוש עבור שירותי AWS נפוצים, עם דגש על אבטחה, יתירות וסקיילביליות.

תכונות עיקריות

  • מודולים מוכנים לשימוש
  • תצורות אבטחה מובנות
  • ניהול סביבות מרובות
  • תמיכה ב-Remote State

מודולים זמינים

VPC Module


module "vpc" {
    source = "./modules/vpc"
    name = "prod-vpc"
    cidr = "10.0.0.0/16"
    azs  = ["eu-west-1a", "eu-west-1b"]
}
                        

EC2 Module


module "ec2_cluster" {
    source = "./modules/ec2"
    instance_count = 3
    instance_type = "t3.micro"
    subnet_ids = module.vpc.subnet_ids
}
                        

הוראות התקנה


# Clone the repository
git clone https://github.com/devops-israel/terraform-infra

# Initialize Terraform
terraform init

# Plan the deployment
terraform plan

# Apply the configuration
terraform apply
                    

מבנה הפרויקט


terraform-infra/
├── environments/
│   ├── prod/
│   │   ├── main.tf
│   │   └── variables.tf
│   └── staging/
│       ├── main.tf
│       └── variables.tf
├── modules/
│   ├── vpc/
│   ├── ec2/
│   ├── rds/
│   └── s3/
└── shared/
    ├── outputs.tf
    └── variables.tf
                    

משתני תצורה


# variables.tf
variable "environment" {
    type = string
    description = "Environment name (prod/staging)"
}

variable "region" {
    type = string
    default = "eu-west-1"
}

variable "instance_type" {
    type = string
    default = "t3.micro"
}