Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
What is Terraform?
Terraform is a tool to write a code & it allows to programmatically provision the physical resources to an application requires to run. 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.
Example Terraform program
resources.tf
resource “github_repository” “Sample” {
name = “terraform1”
description = “My first terraform project”
visibility = “public”
}
terraform.tf
provider github
{
token=”ghp_CpzDx9BrikaSXBsOVJ4t90NoK0FZQH3AkrzP”
owner=”Organization”
Terraform commands and its use
- terraform init : used to initialize the directory which consists of configuration files.
- terraform plan : uses to check the configuration to determine the desired state of all the resources it declares.
- terraform apply : used to planned changes to resource using the same type of infrastructure providers API.
- terraform destroy : used to destroy all the resources being managed by current directory.
- terraform show : used to provide an output of plan file in understandable manner.