terraform an infrastructure as code tool that can provision resources in the cloud from simple declarative code when building an app in the cloud you may find yourself using the graphical user interface of your favorite cloud provider clicking on buttons and paying for products just like you would on an e-commerce site the only drawback of this approach is that it's complete and total chaos you might click a thousand different buttons to get your vm configured properly but what happens when you need to reproduce the same thing again in the future terraform provides a way to build
change and version infrastructure safely and efficiently by representing your infrastructure and all that settings with the hashicorp configuration language or optionally json think of it like a human readable blueprint that can execute and automate everything you do in the cloud it's free and open source and the first step to get started is to install the cli on your local system then from your project create a file ending in tf at the top we have a terraform block that controls global settings for terraform itself most importantly we can define providers here which are like plugins that
can connect to different cloud providers like aws google cloud azure etc below that we have a provider block which gives terraform the necessary credentials to connect to our google cloud account from there we can create actual cloud infrastructure using a resource block it takes a type as its first argument which corresponds to a product on google cloud then a custom name to identify it as the second argument inside the block we can customize the settings of the resource like its machine type zone and anything else you can imagine now that our infrastructure is defined as
code we can run terraform init to initialize the project then terraform apply to make the actual changes to google cloud it'll require a confirmation before making the changes then after it's complete the terraform show command can be used to inspect the current state of the infrastructure what's awesome is that as we add more resources to the configuration terraform keeps track of the changes or diff similar to a version control system like git just run terraform apply again to deploy any changes to the configuration now once your startup has failed and it comes time to tear
down the project use the terraform destroy command as the inverse of apply to delete everything in your configuration file this has been infrastructure as code with terraform in 100 seconds make sure to hit the like button if you want to see more short videos like this thanks for watching and i will see you in the next one