Assignment-4 . Terraform
Terraform
Terraform is an open source “Infrastructure as Code” tool, created by HashiCorp.
Terraform was in GO Language.It can manage not only existing on-prem solutions but also can work for almost all popular cloud service providers like AWS, Azure, GCP
A declarative coding tool, Terraform enables developers to use a high-level configuration language called HCL (HashiCorp Configuration Language) to describe the desired “end-state” cloud or on-premises infrastructure for running an application. It then generates a plan for reaching that end-state and executes the plan to provision the infrastructure.
Example Terraform program
provider “github” {
token = “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”
owner = “Yarra Lakshmi Bhavani”
}
resource “github_repository” “example” {
name = “Lakshmi Bhavani”
description = “My awesome codebase “
visibility = “public”
}
Five Commands of Terraform
Terraform init – It initializes a working directory containing terraform configuration files
Terraform apply – Executes the actions.
Terraform show – Is used to provide human readable output from state file.
Terraform plan – It evaluates a terraform configuration to determine the desired state of all the resources it declares. Which lets to preview the changes that terraform plans to make to your infrastructure.
Terraform destroy – It is a convenient way to destroy all remote objects managed by particular terraform configuration
Terraform get – Downloads and updates modules defined in the root module