🚨 𝗠𝘆 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗱𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁 𝗳𝗮𝗶𝗹𝗲𝗱... 𝗮𝗻𝗱 𝘁𝗵𝗲 𝗿𝗲𝗮𝘀𝗼𝗻 𝘀𝘂𝗿𝗽𝗿𝗶𝘀𝗲𝗱 𝗺𝗲! Last week, I was deploying infrastructure on Azure using Terraform. Everything looked perfect — clean code, no syntax errors. I ran `terraform apply`… and boom ❌ The deployment failed. After debugging for a while, I realized the issue wasn’t the code… 👉 it was the 𝘥𝘦𝘱𝘦𝘯𝘥𝘦𝘯𝘤𝘺. 🔍 𝗪𝗵𝗮𝘁 𝗮𝗰𝘁𝘂𝗮𝗹𝗹𝘆 𝘄𝗲𝗻𝘁 𝘄𝗿𝗼𝗻𝗴? I was trying to create a 𝘚𝘶𝘣𝘯𝘦𝘵 before the 𝘝𝘪𝘳𝘵𝘶𝘢𝘭 𝘕𝘦𝘵𝘸𝘰𝘳𝘬 was fully ready. Even though the code looked correct, Terraform didn’t clearly understand the dependency. 💡 𝗧𝗵𝗮𝘁’𝘀 𝘄𝗵𝗲𝗻 𝗶𝘁 𝗰𝗹𝗶𝗰𝗸𝗲𝗱... In Terraform, dependency defines the 𝗼𝗿𝗱𝗲𝗿 𝗶𝗻 𝘄𝗵𝗶𝗰𝗵 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲𝘀 𝗮𝗿𝗲 𝗰𝗿𝗲𝗮𝘁𝗲𝗱. If the order is wrong → your deployment will fail. 🔗 𝗧𝘆𝗽𝗲𝘀 𝗼𝗳 𝗗𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝗰𝘆 ✅ I𝗺𝗽𝗹𝗶𝗰𝗶𝘁 𝗗𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝗰𝘆 (𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗰) When one resource references another, Terraform automatically creates the correct order. ✅ 𝗘𝘅𝗽𝗹𝗶𝗰𝗶𝘁 𝗗𝗲𝗽𝗲𝗻𝗱𝗲𝗻𝗰𝘆 (`𝗱𝗲𝗽𝗲𝗻𝗱𝘀_𝗼𝗻`) When Terraform cannot detect it, you must define it manually. 👉 Correct Flow: Resource Group → Virtual Network → Subnet 💡 𝗟𝗲𝘀𝘀𝗼𝗻 𝗟𝗲𝗮𝗿𝗻𝗲𝗱: Even if your Terraform code is correct… 👉 missing dependency can break everything. 👉 Have you ever faced a similar issue in Terraform? Would love to hear your experience 👇 Learning with DevOps Insiders #Terraform #DevOps #Azure #InfrastructureAsCode #Learning
Rajeev Kumar’s Post
More Relevant Posts
-
🔥 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗟𝗶𝗳𝗲𝗰𝘆𝗰𝗹𝗲 – 𝗧𝗵𝗲 𝗥𝗲𝗮𝗹 𝗗𝗲𝘃𝗢𝗽𝘀 𝗦𝘂𝗽𝗲𝗿𝗽𝗼𝘄𝗲𝗿 (𝗘𝘅𝗽𝗹𝗮𝗶𝗻𝗲𝗱 𝗦𝗶𝗺𝗽𝗹𝘆) 𝗠𝗼𝘀𝘁 𝗯𝗲𝗴𝗶𝗻𝗻𝗲𝗿𝘀 𝗹𝗲𝗮𝗿𝗻 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗰𝗼𝗺𝗺𝗮𝗻𝗱𝘀... But real professionals understand the flow behind those commands. 𝗧𝗵𝗶𝘀 𝗱𝗶𝗮𝗴𝗿𝗮𝗺 𝗰𝗮𝗽𝘁𝘂𝗿𝗲𝘀 𝘁𝗵𝗮𝘁 𝗳𝗹𝗼𝘄 𝗽𝗲𝗿𝗳𝗲𝗰𝘁𝗹𝘆 👇 💡 𝗧𝗵𝗶𝗻𝗸 𝗼𝗳 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗹𝗶𝗸𝗲 𝗯𝘂𝗶𝗹𝗱𝗶𝗻𝗴 𝗮 𝗵𝗼𝘂𝘀𝗲: 🔹 𝟭. 𝗔𝘂𝘁𝗵𝗼𝗿 (𝗗𝗲𝘀𝗶𝗴𝗻 𝗣𝗵𝗮𝘀𝗲) You write .tf files → This is your architecture blueprint What you define here = What gets created in real infrastructure 🔹 𝟮. 𝗜𝗻𝗶𝘁𝗶𝗮𝗹𝗶𝘇𝗲 (𝗦𝗲𝘁𝘂𝗽 𝗣𝗵𝗮𝘀𝗲) terraform init → Prepares everything behind the scenes Downloads providers, sets backend, gets ready to build 🔹 𝟯. 𝗣𝗿𝗲𝘃𝗶𝗲𝘄 (𝗗𝗲𝗰𝗶𝘀𝗶𝗼𝗻 𝗣𝗵𝗮𝘀𝗲) terraform plan → “Agar main run karu toh kya hoga?” It shows exact changes before touching real infrastructure 👉 This is where smart engineers avoid costly mistakes 🔹 𝟰. 𝗗𝗲𝗽𝗹𝗼𝘆 (𝗘𝘅𝗲𝗰𝘂𝘁𝗶𝗼𝗻 𝗣𝗵𝗮𝘀𝗲) terraform apply → Reality starts here Infra gets created/updated exactly as per your code 🔹 𝟱. 𝗥𝗲𝗰𝗹𝗮𝗶𝗺 (𝗖𝗹𝗲𝗮𝗻𝘂𝗽 𝗣𝗵𝗮𝘀𝗲) terraform destroy → Clean exit No unused resources = No unnecessary cloud bills 💸 🧠 𝗠𝗼𝘀𝘁 𝗜𝗺𝗽𝗼𝗿𝘁𝗮𝗻𝘁 𝗖𝗼𝗻𝗰𝗲𝗽𝘁 – 𝗦𝗧𝗔𝗧𝗘 𝗙𝗜𝗟𝗘 (.𝘁𝗳𝘀𝘁𝗮𝘁𝗲) This is not just a file… it’s Terraform’s memory It tracks what exists vs what should exist 👉 Without state = No control 👉 With state = Full automation + consistency 🌍 𝗪𝗵𝘆 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗶𝘀 𝗣𝗼𝘄𝗲𝗿𝗳𝘂𝗹? One code → Works on AWS, Azure, GCP & even On-Prem That’s the real meaning of Infrastructure as Code (IaC) ⚡ 𝗚𝗼𝗹𝗱𝗲𝗻 𝗥𝘂𝗹𝗲 𝘁𝗼 𝗥𝗲𝗺𝗲𝗺𝗯𝗲𝗿: Define → Prepare → Preview → Execute → Destroy 𝗠𝗮𝘀𝘁𝗲𝗿 𝘁𝗵𝗶𝘀 𝗳𝗹𝗼𝘄... and you won’t just use Terraform — you’ll control infrastructure like a pro 💪 If you're serious about DevOps, this lifecycle is not optional… it's foundational. 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗗𝗲𝘃𝗢𝗽𝘀 𝘄𝗶𝘁𝗵 DevOps Insiders #𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 #𝗗𝗲𝘃𝗢𝗽𝘀 #𝗜𝗻𝗳𝗿𝗮𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲𝗔𝘀𝗖𝗼𝗱𝗲 #𝗖𝗹𝗼𝘂𝗱 #𝗔𝗪𝗦 #𝗔𝘇𝘂𝗿𝗲 #𝗚𝗖𝗣 #𝗔𝘂𝘁𝗼𝗺𝗮𝘁𝗶𝗼𝗻 #𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴𝗝𝗼𝘂𝗿𝗻𝗲𝘆 #𝗧𝗲𝗰𝗵𝗖𝗮𝗿𝗲𝗲𝗿𝘀
To view or add a comment, sign in
-
-
🚀 𝗙𝗿𝗼𝗺 𝗖𝗼𝗻𝗳𝘂𝘀𝗶𝗼𝗻 𝘁𝗼 𝗖𝗹𝗮𝗿𝗶𝘁𝘆: 𝗠𝘆 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗟𝗲𝗮𝗿𝗻𝗶𝗻𝗴 𝗝𝗼𝘂𝗿𝗻𝗲𝘆 When I first started working with Terraform, everything looked overwhelming… So many blocks, so many concepts — and honestly, I had no idea how they all connected 🤯 Then I stopped trying to memorize everything… and started understanding it like a 𝗳𝗹𝗼𝘄 👇 🧩 It all begins with: 🔹 𝘁𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗯𝗹𝗼𝗰𝗸 → sets the foundation (providers & versions) 🔹 𝗽𝗿𝗼𝘃𝗶𝗱𝗲𝗿 𝗯𝗹𝗼𝗰𝗸 → connects you to Azure ⚙️ Then comes the real action: 🔹 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗯𝗹𝗼𝗰𝗸 → creates actual infrastructure (RG, VNet, VM) 🔹 𝗱𝗮𝘁𝗮 𝗯𝗹𝗼𝗰𝗸 → fetches existing resources 🎯 To make it dynamic & reusable: 🔹 𝘃𝗮𝗿𝗶𝗮𝗯𝗹𝗲 𝗯𝗹𝗼𝗰𝗸 → inputs you can change anytime 🔹 𝗹𝗼𝗰𝗮𝗹𝘀 𝗯𝗹𝗼𝗰𝗸 → reusable internal values 📦 Scaling & structuring: 🔹 𝗺𝗼𝗱𝘂𝗹𝗲 𝗯𝗹𝗼𝗰𝗸 → reuse code like a pro 📤 Final touches: 🔹 𝗼𝘂𝘁𝗽𝘂𝘁 𝗯𝗹𝗼𝗰𝗸 → shows important results 🔹 𝗽𝗿𝗼𝘃𝗶𝘀𝗶𝗼𝗻𝗲𝗿 𝗯𝗹𝗼𝗰𝗸 → runs commands after deployment 💡 𝗧𝗵𝗲 𝗺𝗼𝗺𝗲𝗻𝘁 𝗶𝘁 𝗰𝗹𝗶𝗰𝗸𝗲𝗱 𝗳𝗼𝗿 𝗺𝗲: Terraform is not about isolated blocks… It’s about how these blocks 𝗳𝗹𝗼𝘄 𝘁𝗼𝗴𝗲𝘁𝗵𝗲𝗿 𝘁𝗼 𝗯𝘂𝗶𝗹𝗱 𝗿𝗲𝗮𝗹 𝗶𝗻𝗳𝗿𝗮𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲. Once you see it as a process (like in the diagram), everything becomes 10x easier 🔥 👉 If you're learning Terraform: Don’t just learn blocks — understand the 𝗳𝗹𝗼𝘄 𝗯𝗲𝘁𝘄𝗲𝗲𝗻 𝘁𝗵𝗲𝗺 💬 Which Terraform block confused you the most when you started? hashtag #Terraform #Azure #DevOps #InfrastructureAsCode #DevOpsInsider DevOps Insiders
To view or add a comment, sign in
-
-
🔥 𝗘𝘃𝗲𝗿 𝘄𝗼𝗻𝗱𝗲𝗿𝗲𝗱 𝘄𝗵𝘆 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝘀𝗼𝗺𝗲𝘁𝗶𝗺𝗲𝘀 “𝗿𝗲𝗰𝗿𝗲𝗮𝘁𝗲𝘀” 𝘁𝗵𝗶𝗻𝗴𝘀 𝘆𝗼𝘂 𝗱𝗶𝗱𝗻’𝘁 𝘁𝗼𝘂𝗰𝗵? Welcome to the world of State Drift — one of the most underrated (and misunderstood) concepts in DevOps. Let’s break it down in a super simple way 👇 🧩 𝗛𝗼𝘄 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗮𝗰𝘁𝘂𝗮𝗹𝗹𝘆 𝘄𝗼𝗿𝗸𝘀: You write code → Terraform checks the state file → compares it with real infrastructure on Microsoft Azure → then decides what to do. But here’s the twist… 👉 If anything changes outside Terraform, things can get messy. 💥 𝗥𝗲𝗮𝗹-𝗪𝗼𝗿𝗹𝗱 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼𝘀 𝗬𝗼𝘂’𝗹𝗹 𝗗𝗲𝗳𝗶𝗻𝗶𝘁𝗲𝗹𝘆 𝗙𝗮𝗰𝗲 🔹 𝟭. 𝗬𝗼𝘂 𝗮𝗱𝗱𝗲𝗱 𝗮 𝗻𝗲𝘄 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗶𝗻 𝘆𝗼𝘂𝗿 .𝘁𝗳 𝗳𝗶𝗹𝗲 Terraform: “Cool, I’ll create it.” ✅ ✔ 𝘱𝘭𝘢𝘯 shows addition ✔ 𝘢𝘱𝘱𝘭𝘺 creates it ✔ State updated 🔹 2. 𝗦𝗼𝗺𝗲𝗼𝗻𝗲 𝗱𝗲𝗹𝗲𝘁𝗲𝘀 𝗮 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗳𝗿𝗼𝗺 𝗔𝘇𝘂𝗿𝗲 𝗣𝗼𝗿𝘁𝗮𝗹 😬 Terraform: “Wait… where did it go?” ✔ r𝘦𝘧𝘳𝘦𝘴𝘩 detects it's missing ✔ 𝘢𝘱𝘱𝘭𝘺 recreates it automatically 🔄 👉 This is Terraform saying: “Don’t worry, I got you.” 🔹 3. 𝗬𝗼𝘂 𝗰𝗵𝗮𝗻𝗴𝗲𝗱 𝗻𝗼𝘁𝗵𝗶𝗻𝗴, 𝗯𝘂𝘁 𝘀𝘁𝗶𝗹𝗹 𝗿𝗮𝗻 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 Terraform: “All good bro, nothing to do.” 😎 ✔ No changes ✔ No impact ✔ Safe run 🔹 4. 𝗬𝗼𝘂 𝘂𝗽𝗱𝗮𝘁𝗲𝗱 𝗮𝗻 𝗲𝘅𝗶𝘀𝘁𝗶𝗻𝗴 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 Terraform: “Depends…” 🤔 ✔ Small change → updates in-place ✔ Major change → destroy + recreate ⚠️ 👉 And THIS is where people get surprised the most! 🧠 𝗟𝗲𝘀𝘀𝗼𝗻𝘀 𝗘𝘃𝗲𝗿𝘆 𝗗𝗲𝘃𝗢𝗽𝘀 𝗘𝗻𝗴𝗶𝗻𝗲𝗲𝗿 𝗦𝗵𝗼𝘂𝗹𝗱 𝗥𝗲𝗺𝗲𝗺𝗯𝗲𝗿 💡 Terraform is your single source of truth 💡 Manual changes = future headaches 💡 Always run 𝘵𝘦𝘳𝘳𝘢𝘧𝘰𝘳𝘮 𝘱𝘭𝘢𝘯 (NEVER skip this!) 💡 Understand which changes trigger recreation 🚀 Pro Tip: If your infra behaves “unexpectedly”, don’t panic… 👉 Just check the state file vs actual resources. 💬 Have you ever faced a weird Terraform behavior in production? Drop your experience — let’s learn from each other 👇 Learn with DevOps Insiders #Terraform #DevOps #Cloud #Azure #InfrastructureAsCode #IaC #CloudEngineering #DevOpsLife
To view or add a comment, sign in
-
-
🚀 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗘𝘅𝗽𝗹𝗮𝗶𝗻𝗲𝗱 𝗟𝗶𝗸𝗲 𝗮 𝗥𝗲𝗮𝗹-𝗟𝗶𝗳𝗲 𝗦𝘁𝗼𝗿𝘆 (𝗬𝗼𝘂 𝗪𝗼𝗻’𝘁 𝗙𝗼𝗿𝗴𝗲𝘁 𝗧𝗵𝗶𝘀 😄) If you’re learning DevOps, you’ve probably faced this confusion 👇 👉 “What exactly will Terraform delete… and are portal-created resources safe?” 𝗟𝗲𝘁’𝘀 𝗳𝗶𝘅 𝘁𝗵𝗶𝘀 𝗼𝗻𝗰𝗲 𝗮𝗻𝗱 𝗳𝗼𝗿 𝗮𝗹𝗹 💥 🏠 𝗧𝗵𝗶𝗻𝗸 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗟𝗶𝗸𝗲 𝗮 𝗛𝗼𝘂𝘀𝗲 👉 Terraform = House 👉 Terraform Tool = Husband (Executor) 👉 .tf files = Wife (Planner) 👉 .tfstate = House Register (Record) 👉 Portal resources = Unofficial (GF 😄) 💡 𝗛𝗼𝘄 𝗜𝘁 𝗔𝗰𝘁𝘂𝗮𝗹𝗹𝘆 𝗪𝗼𝗿𝗸𝘀 👩 .𝘁𝗳 𝗱𝗲𝗰𝗶𝗱𝗲𝘀: ✔ What to build ✔ Where to build ✔ How to build 🧑💻 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺: ✔ Reads plan ✔ Compares with reality ✔ Executes actions 📒 .𝘁𝗳𝘀𝘁𝗮𝘁𝗲: ✔ Tracks everything ✔ Stores IDs ✔ Maintains mapping 🔥 𝗥𝗲𝗮𝗹 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 👉 RG via Terraform 👉 Storage via Portal 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝘀𝗮𝘆𝘀: ❌ “Not my responsibility” 💥 The Twist 👉 𝘁𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗱𝗲𝘀𝘁𝗿𝗼𝘆 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺: “I’m deleting the RG” 𝗔𝘇𝘂𝗿𝗲: “I’m deleting EVERYTHING inside it” 💣 Result: Storage also gone 🎯 𝗢𝗻𝗲-𝗟𝗶𝗻𝗲 𝗘𝘅𝗽𝗹𝗮𝗻𝗮𝘁𝗶𝗼𝗻 👉 Terraform doesn’t manage everything… but if it deletes the parent, everything inside goes with it 😄 𝗙𝗶𝗻𝗮𝗹 𝗧𝗵𝗼𝘂𝗴𝗵𝘁 The wife plans The husband executes The register records But if the house is destroyed… Everything goes with it 💥 💾 𝗦𝗮𝘃𝗲 𝘁𝗵𝗶𝘀 𝗽𝗼𝘀𝘁 💬 Comment your confusion — I’ll try to solve it #terraform #devops #azure #cloudcomputing #infrastructureascode #iac #cloudengineering #automation #learnDevOps #azurecloud #cloudtips #devopscommunity #buildinpublic #techlearning
To view or add a comment, sign in
-
Terraform Concepts Guide – count, for_each, Variables & Real Scenarios Terraform is not just about writing .tf files. Interviews and real projects test how well you understand how Terraform actually works behind the scenes. This guide explains core Terraform concepts with practical examples used in real infrastructure setups. 📘 What this guide covers: ✅ count & count.index • Creating multiple resources using count • Using count.index for dynamic naming • Handling indexed resource creation • Using count for EC2 and subnet creation ✅ for_each vs count • Looping over maps and lists • Using each.key and each.value • Creating uniquely named resources • Safer updates compared to count ✅ Interpolation & Expressions • Using ${} for dynamic values • Combining variables inside strings • Referencing resource attributes • Building dynamic names and configs ✅ Terraform Functions • Using length() for dynamic resource count • Using element() to fetch list values • Index-based value selection • Handling lists, maps, and strings ✅ Maps & Variables • Key-value structure in Terraform • Using maps for AMIs, subnets, configs • Accessing values using keys • Reusable variable-driven infrastructure ✅ Locals & Code Reusability • Using locals for cleaner code • Reducing duplication • Creating reusable tag structures • Improving readability and maintainability ✅ Data Sources & Existing Resources • Fetching existing AWS resources • Using data blocks for AMIs and VPCs • Avoiding resource duplication • Integrating external infrastructure ✅ Workspaces & Environment Management • Managing dev, qa, prod environments • Using terraform workspace • Isolating state per environment • Avoiding code duplication ✅ Provisioners & Automation • Running scripts after resource creation • remote-exec and local-exec usage • Bootstrapping servers • When (and when not) to use provisioners 💡 Why this matters: Terraform is widely used in production. Understanding concepts like count, for_each, variables, and state isolation is critical for building scalable and maintainable infrastructure. #Terraform #DevOps #SRE #AWS #InfrastructureAsCode #IaC #CloudEngineering #Automation #TerraformTips #DevOpsCommunity #CloudOps #PlatformEngineering #TechLearning #CareerGrowth #PlatformEngineering #CloudArchitecture #SiteReliabilityEngineering #CloudOps #DevOpsCommunity #InfraAsCode #TechDeepDive #LearningInPublic #BuildInPublic
To view or add a comment, sign in
-
🚀 Terraform Concept Every DevOps Engineer Must Know 👉 Implicit vs Explicit Dependency 🔍 What is Dependency in Terraform? Dependency defines the 𝗼𝗿𝗱𝗲𝗿 𝗼𝗳 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗰𝗿𝗲𝗮𝘁𝗶𝗼𝗻. Terraform uses a 𝗗𝗔𝗚 (𝗗𝗶𝗿𝗲𝗰𝘁𝗲𝗱 𝗔𝗰𝘆𝗰𝗹𝗶𝗰 𝗚𝗿𝗮𝗽𝗵) to decide what runs first. ⚡ Implicit Dependency (Automatic) 👉 When one resource references another Example: EC2 uses Security Group → Terraform auto-manages order ✔ No extra code ✔ Clean & scalable ✔ Best practice 💡 Insight: "Terraform is smart enough to understand relationships if you write clean references." ⚙️ Explicit Dependency (Manual) 👉 Defined using depends_on Used when Terraform 𝙘𝙖𝙣𝙣𝙤𝙩 𝙙𝙚𝙩𝙚𝙘𝙩 𝙙𝙚𝙥𝙚𝙣𝙙𝙚𝙣𝙘𝙮 ✔ Full control on execution ✔ Useful for hidden dependencies ⚠️ But: Overuse makes code complex 🎯 Real Interview Tip 💬 Best Answer: "I prefer implicit dependencies for cleaner architecture and rely on explicit dependencies only when Terraform cannot infer relationships." 🔥 Pro Tip If you are using too many depends_on 👉 You are solving the problem incorrectly 📌 Final Thought "Good engineers write Terraform code. Great engineers design dependency flow." #Terraform #DevOps #Cloud #AWS #Azure #InfrastructureAsCode #Automation #DevOpsEngineer Learning with DevOps Insiders
To view or add a comment, sign in
-
-
🚀 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗥𝗲𝗮𝗹𝗶𝘁𝘆 𝗖𝗵𝗲𝗰𝗸 — 𝗘𝘃𝗲𝗿𝘆𝗼𝗻𝗲 𝗦𝗵𝗼𝘂𝗹𝗱 𝗞𝗻𝗼𝘄 𝗧𝗵𝗶𝘀! Today, a simple diagram made a powerful concept crystal clear 👇 💡 𝗚𝗼𝗹𝗱𝗲𝗻 𝗥𝘂𝗹𝗲: 👉 Terraform = Code + State + Real Infrastructure (Cloud) And the interaction between these three is what true DevOps understanding is all about 🔥 --- 🔍 𝗟𝗲𝘁’𝘀 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱 𝘄𝗶𝘁𝗵 𝗿𝗲𝗮𝗹 𝘀𝗰𝗲𝗻𝗮𝗿𝗶𝗼𝘀: 🟢 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟭: 𝗔𝗱𝗱𝗲𝗱 𝗮 𝗻𝗲𝘄 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗶𝗻 𝘁𝗵𝗲 `.𝘁𝗳` 𝗳𝗶𝗹𝗲 ➡️ Terraform will generate a plan → on apply, the infrastructure gets created ➡️ The state file is also updated with the new entry --- 🔴 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟮: 𝗥𝗲𝗺𝗼𝘃𝗲𝗱 𝗮 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗳𝗿𝗼𝗺 𝘁𝗵𝗲 `.𝘁𝗳` 𝗳𝗶𝗹𝗲 ➡️ Plan will indicate “this needs to be deleted” ➡️ On apply, the resource is deleted and the state is cleaned --- ⚠️ 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟯: 𝗠𝗮𝗻𝘂𝗮𝗹𝗹𝘆 𝗱𝗲𝗹𝗲𝘁𝗲𝗱 𝘁𝗵𝗲 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗳𝗿𝗼𝗺 𝘁𝗵𝗲 𝗽𝗼𝗿𝘁𝗮𝗹 (𝗲.𝗴., 𝗔𝘇𝘂𝗿𝗲) ➡️ Terraform performs a refresh ➡️ Plan says “this resource is missing!” ➡️ It recreates the resource 🔁 --- 🟡 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟰: 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗺𝗮𝗻𝘂𝗮𝗹𝗹𝘆 𝘂𝗽𝗱𝗮𝘁𝗲𝗱 (𝗱𝗿𝗶𝗳𝘁) ➡️ Terraform detects that the configuration doesn’t match ➡️ It updates or replaces the resource to bring it back to the desired state --- 🧠 𝗞𝗲𝘆 𝗜𝗻𝘀𝗶𝗴𝗵𝘁 (𝘁𝗵𝗮𝘁 𝗺𝗮𝗻𝘆 𝗽𝗲𝗼𝗽𝗹𝗲 𝗺𝗶𝘀𝘀): 👉 Terraform does not blindly follow code 👉 It compares the 𝘀𝘁𝗮𝘁𝗲 𝗳𝗶𝗹𝗲 with the 𝗮𝗰𝘁𝘂𝗮𝗹 𝗶𝗻𝗳𝗿𝗮𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲 👉 That’s why `terraform refresh + plan` is where the real magic happens --- 💥 𝗥𝗲𝗺𝗲𝗺𝗯𝗲𝗿 𝘁𝗵𝗶𝘀 𝘀𝗶𝗺𝗽𝗹𝗲 𝗳𝗼𝗿𝗺𝘂𝗹𝗮: * 𝘁𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗽𝗹𝗮𝗻 = refresh + compare + execution plan * 𝘁𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺 𝗮𝗽𝗽𝗹𝘆 = plan + approval + execution --- Learning with DevOps Insiders #Terraform #DevOps #InfrastructureAsCode #Azure #CloudComputing #DevOpsInsiders
To view or add a comment, sign in
-
-
🚀 Terraform Workflow Made Simple (fmt → init → validate → plan → apply) If you're starting with Terraform, understanding the core workflow is a must! Let’s break it down step by step 👇 🧹 1. terraform fmt ➡️ Formats your code into a clean and standard structure 👉 Keeps your code readable & consistent ⚙️ 2. terraform init ➡️ Initializes your project 👉 Downloads providers & sets up backend ✅ 3. terraform validate ➡️ Checks whether your configuration is syntactically correct 👉 Helps catch errors early 📊 4. terraform plan ➡️ Shows what Terraform will do before making changes 👉 Safe preview of infrastructure changes 🚀 5. terraform apply ➡️ Executes the plan and creates/updates resources 👉 This is where your infrastructure comes to life! 📌 Simple Workflow Flow: fmt → init → validate → plan → apply 💡 Pro Tip: Never skip terraform plan — it helps avoid unexpected changes in production! 🔥 Master these 5 commands and you’ve already taken a big step into Infrastructure as Code (IaC) #Terraform #DevOps #CloudComputing #IaC #Automation #Azure #AWS #Learning #Tech DevOps Insiders
To view or add a comment, sign in
-
-
🚀 𝗪𝗮𝗻𝘁 𝘁𝗼 𝘁𝗿𝘂𝗹𝘆 𝘂𝗻𝗱𝗲𝗿𝘀𝘁𝗮𝗻𝗱 𝗧𝗲𝗿𝗿𝗮𝗳𝗼𝗿𝗺? 𝗠𝗮𝘀𝘁𝗲𝗿 𝘁𝗵𝗲𝘀𝗲 𝟰 𝘀𝗰𝗲𝗻𝗮𝗿𝗶𝗼𝘀! Infrastructure as Code sounds simple, but the real clarity comes when you understand how 𝗰𝗼𝗱𝗲, 𝘀𝘁𝗮𝘁𝗲, 𝗮𝗻𝗱 𝗰𝗹𝗼𝘂𝗱 𝗶𝗻𝘁𝗲𝗿𝗮𝗰𝘁. 👉 Simple concept: .𝘁𝗳 𝗳𝗶𝗹𝗲𝘀 (𝗰𝗼𝗱𝗲) = 𝗦𝗼𝘂𝗿𝗰𝗲 𝗼𝗳 𝗧𝗿𝘂𝘁𝗵 𝗦𝘁𝗮𝘁𝗲 𝗳𝗶𝗹𝗲 = 𝗦𝗻𝗮𝗽𝘀𝗵𝗼𝘁 𝗼𝗳 𝗰𝘂𝗿𝗿𝗲𝗻𝘁 𝗿𝗲𝗮𝗹𝗶𝘁𝘆 𝗖𝗹𝗼𝘂𝗱 (𝗔𝘇𝘂𝗿𝗲) = 𝗔𝗰𝘁𝘂𝗮𝗹 𝗶𝗻𝗳𝗿𝗮𝘀𝘁𝗿𝘂𝗰𝘁𝘂𝗿𝗲 Terraform’s job? 👉 Keep all three in sync. 🔥 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟭: 𝗡𝗲𝘄 𝗿𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗮𝗱𝗱𝗲𝗱 𝗶𝗻 𝗰𝗼𝗱𝗲 ➡️ Plan shows it needs to be created ➡️ Apply → Resource gets created + state updated ✅ Expected behavior 🔥 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟮: 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗿𝗲𝗺𝗼𝘃𝗲𝗱 𝗳𝗿𝗼𝗺 𝗰𝗼𝗱𝗲 ➡️ Plan shows it should be destroyed ➡️ Apply → Resource deleted + state cleaned 🧹 No leftovers 🔥 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟯: 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝗱𝗲𝗹𝗲𝘁𝗲𝗱 𝗺𝗮𝗻𝘂𝗮𝗹𝗹𝘆 𝗳𝗿𝗼𝗺 𝗽𝗼𝗿𝘁𝗮𝗹 ➡️ Refresh + Plan detects drift ➡️ Terraform plans to recreate it ⚠️ Avoid manual changes in cloud 🔥 𝗦𝗰𝗲𝗻𝗮𝗿𝗶𝗼 𝟰: 𝗥𝗲𝘀𝗼𝘂𝗿𝗰𝗲 𝘂𝗽𝗱𝗮𝘁𝗲𝗱 𝗶𝗻 𝗰𝗼𝗱𝗲 ➡️ Plan decides: in-place update or replacement ➡️ Apply → Change implemented or resource recreated 🔄 Depends on resource type 💡 𝗚𝗼𝗹𝗱𝗲𝗻 𝗥𝘂𝗹𝗲: 👉 𝘵𝘦𝘳𝘳𝘢𝘧𝘰𝘳𝘮 𝘱𝘭𝘢𝘯 = Think before action 👉 𝘵𝘦𝘳𝘳𝘢𝘧𝘰𝘳𝘮 𝘢𝘱𝘱𝘭𝘺 = Execute with confidence And remember: 𝗔𝗽𝗽𝗹𝘆𝗶𝗻𝗴 𝘄𝗶𝘁𝗵𝗼𝘂𝘁 𝗽𝗹𝗮𝗻𝗻𝗶𝗻𝗴 = 𝗕𝗹𝗶𝗻𝗱 𝗱𝗲𝗽𝗹𝗼𝘆𝗺𝗲𝗻𝘁 😄 ✨ Strong fundamentals in Terraform = Strong foundation in DevOps DevOps Insiders #DevOpsInsiders #Terraform #DevOps #Azure #InfrastructureAsCode #Cloud #IaC #Tech
To view or add a comment, sign in
-
-
“Terraform becomes powerful only when you understand its core commands. Here’s a quick cheat sheet that every DevOps engineer should know!” 🚀 Mastering Terraform Commands – Your Quick Cheat Sheet! If you're working with Infrastructure as Code, understanding Terraform commands is a game changer. Here’s a simple breakdown that can level up your workflow 👇 🔹 terraform init The starting point. It initializes your workspace, downloads required provider plugins, and sets up backend state configuration. 🔹 terraform plan Your preview mode. It shows exactly what changes Terraform will make—before anything is applied. Think of it as a safety checkpoint ✅ 🔹 terraform apply Time to execute! This command provisions or updates your infrastructure based on the plan. You’ll be prompted before real changes happen. 🔹 terraform destroy Need to tear everything down? This command safely removes all resources defined in your configuration. 🔹 terraform validate Catches syntax errors early. A must-run before planning or applying changes. 🔹 terraform fmt Keeps your code clean and consistent. Automatically formats your configuration files for better readability ✨ 🔹 terraform show & terraform state Provides deep visibility into your infrastructure state and helps manage it effectively. 💡 Pro Tip: Always run terraform plan before apply — it can save you from costly mistakes! #Terraform #DevOps #CloudComputing #InfrastructureAsCode #AWS #Azure #Automation #TechTips
To view or add a comment, sign in
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development