Post-3 Terraform
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
What is terraform?
Terraform is a tool which is used to write a code for infrastructure and it allows to programmatically provision the physical resources an application requires to run. This helps to manages the application infrastructure through programming. It is used to automate the provisioning of your cloud resources. Terraform is an open-source, cloud-agnostic provisioning tool developed by HashiCorp and written in GO language.
One example terraform program.
resources.tf
resource “github_repository” “Sample” {
name = “Proj1”
description = “My first project”
visibility = “public”
}
terraform.tf
provider github
{
token=”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”
owner=”Organization”
}
List of 5 terraform commands and its use
- terraform init – It is used to initialize the directory which consists of configuration files.
- terraform plan – It checks the configuration to determine the desired state of all the resources it declares.
- terraform apply – It carries out the planned changes to resource using the same type of infrastructure providers API.
- terraform destroy – It destroys all the resources being managed by current directory.
- terraform show – It provides an output of plan file in understandable manner.