Terraform - Essential Cheat Sheet

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
Search for a command to run...

Hi there! I'm Dinesh, a passionate Cloud and DevOps enthusiast. I love to dive into the latest new technologies and sharing my journey through blog.
No comments yet. Be the first to comment.
1. Difference between Docker and Kubernetes Docker → Builds and runs containers.Kubernetes → Orchestrates containers across multiple nodes. Key points: Docker = container runtime. Kubernetes = container orchestration tool. Kubernetes provides auto...
In this session, we learn how to monitor a Kubernetes cluster using Prometheus and Grafana.This is not just theory — there is a GitHub repository containing all installation commands and demo steps.The repo will also be enhanced later with advanced K...
1. What is a ConfigMap in Kubernetes? A ConfigMap is used to store non-sensitive configuration data that your application needs — such as: Database port Connection type Any general configuration values In normal applications (non-Kubernetes), de...
Kubernetes normally supports built-in resources like: Deployment Service Pod ConfigMap Secret Ingress These are called native resources. Sometimes companies (Istio, ArgoCD, Prometheus Operator, Kyverno, etc.) want to add new features that Kub...
1. Why Kubernetes Services Are Needed When a Pod is created in Kubernetes, it receives a dynamic IP address.If the Pod dies and restarts, its IP changes.So other Pods (like checkout → payments) cannot rely on Pod IP because it changes, creating issue...
Terraform is a powerful Infrastructure as Code (IaC) tool that allows you to define and manage your infrastructure with simple, human-readable configuration files. As you dive into Terraform, mastering its essential commands is key to effectively managing your cloud infrastructure.
1. terraform init
Initializes a working directory. Run this first to set up your environment.
terraform init
Output:

2. terraform plan
Generates an execution plan, allowing you to preview the changes Terraform will make to your infrastructure. It helps you avoid unintended changes.
terraform plan
Output:

3. terraform apply
Applies the changes defined in your Terraform configuration. This command provisions or updates your infrastructure.
terraform apply
Output:

If everything looks good, type yes to proceed

Terraform will then provision the resources

4. terraform destroy
Removes all resources managed by Terraform. Use this when you want to clean up or decommission an environment.
terraform destroy
Output:

5.terraform refresh
Updates the Terraform state file to reflect the current state of your infrastructure
terraform refresh
6. terraform import
Allows you to bring existing infrastructure under Terraform management.
terraform import