First of all lets see the Application Delivery process with Traditional Infrastructure -
Suppose a company wants to develop an application and business people comes with the requirement.
Business Analyst — Analyze the requirements of the application, he will provide high level technical Requirements, and next comes the Solutions Architect.
Solutions Architect — Once they get the technical requirements they will design the application like what need to have to run the application, solutions architect decides the application servers, DB servers and LoadBalancers needed.
Now comes the Procurement Team — Procurement team makes a request to the vendors about these infrastructure and vendor will supply the servers and load balancers. Once hardware comes to the datacenter now we have field engineers - they do racking and stacking of the servers and network admins who will configure the networking of the servers, storage and backup admins who takes care of storage and backup of the servers.
After all these are done now application team can deploy the application in the servers , all these process takes a lot of time and if they need additional infrastructure now again request has to made by the procurement team and vendor needs to give the infrastructure. Some of the challenges with these approach is Slow Deployment, Expensive, Human Errors and inconsistency across the environments and also there can be resource wastage as well.
So rather than managing all these by ourselves we can go for cloud providers such as AWS, GCP , Azure, cloud computing has opened a way for automation also it works on Pay-As-You-Go model, We can overcome resource wastage also here based on demand we create servers, storage and networks here. So we can create this infrastructure manually in the cloud platforms , but instead of manual creation we can use Infrastructure as Code tools such as Terraform.
Infrastructure As Code :
It is managing and provisioning of the infrastructure in the cloud platforms with the help of code. Using IaC we can create , edit configurations while ensuring the desired state of the infrastructure.
Benefits of IaC includes :
Speed
Cost Reduction
Consistency
Reusability
How IaC works ?
We need to write Infrastructure specification code in a domain-specific language such as Terraform.
Once code is done we need to send this to master server
Now terraform takes all the necessary steps to create and configure infrastructure resources.
Here we also have Configuration Management tools such as Ansible, the purpose of Configuration Management tools are completely different from this IaC tools. With the help of Configuration Management tools we can install the software or do OS patches / upgrades.
Configuration Management tools are mainly used to maintain consistency of the software. Some popular tools are Ansible, chef, Puppet.
Terraform
Terraform is IaC tool which lets us to define both cloud and on-prem resources in human readable configuration files that we can version , reuse and share.
Terraform is cloud agnostic , open source infrastructure provisioning tool written in Go language and created by HashiCorp.
Terraform can manage low-level components like compute, storage, network and also high-level components like SaaS and DNS entries., SaaS can be RDS, EKS, ECS etc.,
Terraform Working
Write — We will write infrastructure in configuration files
Plan — We will review the changes
Apply — Terraform will provision our infrastructure and upload the state file
So this is it about the Infrastructure as Code.