Terraform helps user to build, manage or change infrastructure through code.
Terraform Vs Ansible
- Manage infrastructure with the help of code
- It's the code used to provision resources including virtual machines such as instances on AWS , Network infrastructure including gateways etc
- You write and execute the code to define, deploy, update and destroy your infrastructure
- Code is tracked in a SCM repository
- Automation makes the provisioning process consistent, repeatable and updates fast and reliable.
- Ability to programmatically deploy and configure resources
- IAC standardize your deployment workflow
- IAC can be shared, reused and versioned.
• IAC Tools:
1.Terraform
2.CloudFormation
3.Azure Resource Manager
4.Google Cloud Deployment Manager
Terraform Overview:
• Terraform is an Infrastructure Building Tool (Provisioning Infrastructure)
• Written in Go Language
• Integrates with configuration management and provisioning tools like Chef, Puppet and Ansible.
• Extension of the file is .tf or .tf.json (Json Based)
• Terraform maintain a state with the .tfstate extension
• Deployment of infrastructure happens with a push-based approach (no agent to be installed on remote machines)
• Terraform is Immutable. It can’t be changed after it’s created and destroy is the only option.
• Terraform is using a Declarative method, Declarative Language is Describing what you're trying to achieve without instructing how to do it.
• Terraform is Idempotent ,what ever looking for you which already is present means don't apply and exit without any changes.
• Providers are services or systems that Terraform interacts with to build infrastructure on.
• Current Terraform Version is 1.11
• Terraform is cloud-agnostic but requires a specific provider for the cloud platform
• Single Terraform configuration file can be used to manage multiple providers
• Terraform can simplify both management and orchestration of deploying large-scale, multi-cloud infrastructure
• Terraform is designed to work with both public cloud platforms and on-premises infrastructure (private cloud)
• Terraform Workflow
1.Scope 2.Author 3.Intilaize 4.Plan 5.Apply
Configuration file of Terraform:
Terraform is consist of 3 blocks such as terraform block, provider block and resources block.
Terraform Block:
It defined a terraform required version and required provider of terraform.
Provider Block:
It define the cloud provider plugin along with region where need to provision the infra structure.
Resource Block:
It provide the resource allocation or built a infra structure of your requirement. For example
It provide the resource allocation or built a infra structure of your requirement. For example
"aws instance" is an AWS API and Web server is a Terraform name of the block.
resource "aws instance" "Web server" {
ami ="image name"
instance type = "t2.micro"
tag = {
Name = "Web Instance"
}
No comments:
Post a Comment