Terraform
DevOps 🟡 MidDefinition
Outil IaC (Infrastructure as Code) de HashiCorp. Déclare l'infrastructure en HCL, planifie les changements et les applique de manière idempotente.
Analogie
Un architecte avec un plan : tu dessines l'infrastructure souhaitée et Terraform construit ou modifie pour correspondre.
Exemple de code
resource "aws_instance" "api" {
ami = "ami-0c55b159cbfafe1f0"
instance_type = "t3.micro"
tags = { Name = "api-server" }
}
# terraform plan -> terraform apply
Cas d'usage
Gérer toute l'infrastructure cloud de manière versionnée, reproductible et auditable.
Anti-pattern
terraform apply sans plan ni review : modifications non contrôlées en prod.