Terraform simply explained
Tags: terraform, devops, automation, iac
Published: 2020-07-04 14:30:23

With the below [Terraform Tutorial](https://youtu.be/l5k1ai_GBDE) 🎬  you'll get a good overview of what Terraform is, how Terraform works, how it does its job to get started quickly.

The video covers the following:

###What is Terraform?###
Terraform is a tool for **infrastructure provisioning** to build out infrastructure through code, often called **Infrastructure as Code**.

So, Terraform allows you to **automate and manage your infrastructure, your platform and your services** that run on that platform. 
It's open source and **declarative**, which means you define WHAT you want (the desired "end state") rather then describing exactly each step or HOW to do it.

### What is Terraform used for? Use Cases ###
On the one hand Terraform is used for creating or provision new infrastructure and for **managing existing infrastructure**:
![Terraform Managing Existing Infrastructure](https://dev-to-uploads.s3.amazonaws.com/i/9gf61o7dp3lt26hxhhy0.png)
On the other hand it can be used to **replicate infrastructure**. E.g. when you want to replicate the development setup also for staging or production environment:
![Terraform Replicating Infrastructure](https://dev-to-uploads.s3.amazonaws.com/i/nf6f35reflrspihx6g4b.png)


###How Terraform works? Terraforms Architecture###
Terraform has 2 main components:
- **CORE**

Terraform's Core takes two input sources, which are your configuration files (your desired state) and second the current state (which is managed by Terraform).
With this information the Core then creates a plan of what resources needs to be created/changed/removed.

- **Provider**

The second part of the Architecture are providers. Providers can be **IaaS** (like AWS, GCP, Azure), PaaS (like Heroku, Kubernetes) or SaaS services (like Cloudflare).
Providers expose resources, which makes it possible to create infrastructure across all this platforms.  
![Terraform Architecture](https://dev-to-uploads.s3.amazonaws.com/i/xxva0ol9ysbv8blan4e6.png)


###Terraform Basic Commands###
Terraform has commands to go through different stages:
![Terraform Commands](https://dev-to-uploads.s3.amazonaws.com/i/d3eh00yiowys24y85juh.png)

###Terraform vs Ansible###
One question that comes up always when learning Terraform and which I  want to clarify is "what the difference of Terraform and Ansible is". Which is understandable, because they seem to do the same thing. So, I go through the similarities and differences of those two tools.

###Explaining concepts behind###
I also go one step deeper and explain what the terms and concepts of "infrastructure provisioning", "infrastructure as code" or "declarative vs imperative" mean. 💡

Watch the full video here 🤓
{% youtube l5k1ai_GBDE %}

-----------------
► Get **30% off** - with this code: UDEMY_NANA_NOV2020: [Udemy course here](https://bit.ly/35qF26i)
► **Kubernetes 101**: [Compact and easy-to-read ebook bundle 🚀](https://www.techworld-with-nana.com/e-books) 
It's a handy way to quickly look something up or refresh your knowledge at work and use it as your cheatsheet  😎


**Like, share and follow me** 😍 for more content:
- [Private FB group](https://www.facebook.com/groups/techworldwithnana)
- [Twitter](https://twitter.com/Njuchi_)
- [YouTube](https://www.youtube.com/channel/UCdngmbVKX1Tgre699-XLlUA?sub_confirmation=1)
- [Instagram](https://www.instagram.com/techworld_with_nana/)
- [LinkedIn](linkedin.com/in/nana-janashia)