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.
Terraform is one of the most popular Infrastructure-as-code (IaC) tool, used by DevOps teams to automate infrastructure tasks. 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
variable “include_ec2_instance”
{ type = bool default = true
} resource “aws_instance” “example” {
count = var.include_ec2_instance ? 1 : 0 # (other resource arguments…) }
output “instance_ip_address” { value = one(aws_instance.example[*].private_ip) }
List of 5 terraform commands and its us
terraform init : Prepares a working directory that holds a configuration or checks out a working directory from a version control system.
terraform get : Downloads and updates modules defined in the root module.
terraform workspace : Depending on the specific workspace command — list, select, new, delete or show — this lists available workspaces, chooses a particular option, creates a workspace, deletes a selected workspace or displays the current one.
terraform plan : Creates an execution workflow, also called a plan. When this command runs, it reads the state of remote objects with terraform refresh, identifies the differences between the prior and desired states and lists a set of changes that will synchronize the remote objects with the desired configuration.
terraform apply : Executes the actions created from a Terraform plan.