Back to articles
Chapter 2: Infrastructure as Code
How-ToDevOps

Chapter 2: Infrastructure as Code

via Dev.to DevOpsGeorge Lukas

Before diving into Terraform, we need to understand the mental shift that Infrastructure as Code (IaC) represents. From Imperative to Declarative Imperative Approach (what we did in Chapter 1): # Step 1: Do this kubectl create namespace ollama # Step 2: Now do that kubectl create secret generic credentials... # Step 3: Then do this other thing helm install ollama... # Like a chef giving instructions: "First heat the oven, # then mix the ingredients, then bake for 30 minutes" Declarative Approach (Infrastructure as Code): # Describe the desired end state resource "kubernetes_namespace" "ollama" { metadata { name = "ollama" } } resource "helm_release" "ollama" { name = "ollama" namespace = kubernetes_namespace . ollama . metadata [ 0 ]. name # ... } # Like a shopping list: "I need flour, eggs, sugar" # The system figures out HOW to get it The difference is subtle but profound: Imperative : You say how to do it Declarative : You say what you want The Three Pillars of IaC 1. Versioning git

Continue reading on Dev.to DevOps

Opens in a new tab

Read Full Article
9 views

Related Articles