Skip to content

Files

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

readme.md

Notes and diagrams of Day01 Video

What is Infra as a Code

  • Provisioning your infra through code

image

Why do we use Infra as a code?

  • When you can do that from the Azure console, login to the portal and create, drag, and drop.
  • Why take the pain of writing code for drag and drop?
image
  • Let's assume you have to provision the infra to deploy a three-tier application Time taken: 2 hours
image

it's good for a personal project or when you are learning something

  • What if you are working somewhere in a company and let's say you have 4 environments? Time taken: 8 hours no big deal? right
image
  • How about 100s of servers to be deployed? Tricky? That's not it
  • To save the cost , decommission every day(not possible) keep running and keep accumulating the cost
  • Identical environment, works on my machine
  • Automate the provisioning, manage and destroy the infra
  • Reliability, efficiency, and security?
image

Benefits of IaaC:

  • Consistent environment
  • Easy to track cost
  • Write once, deploy many (single code base)
  • Time saving
  • Human error
  • Cost saving
  • Version control, changes are tracked in git
  • Automated cleanup/scheduled destruction
  • Easy to set and destroy
  • The developer can focus on app development
  • Easy to create an identical production environment for troubleshooting

What is Terraform

IaaC tool that helps do all these tasks

image

How it works

Write your terraform files --> Run terraform commands --> Call the target cloud provider API to provision the infra using Terraform Provider

image

Phases: init --> validate --> plan --> apply --> destroy

Task for Day02

Install Terraform

https://developer.hashicorp.com/terraform/install

Common Error

brew install hashicorp/tap/terraform
Error: No developer tools installed.
Install the Command Line Tools:
  xcode-select --install
  • Install the code tool for mac --> popup will appear, install using that

Use below commands

terraform -install-autocomplete
alias tf=terraform
terraform -version