1)What is terraform?
Terraform is an open source “Infrastructure as Code” tool, created by HashiCorp.
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.
2)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)
}
3)List of 5 terraform commands and its use
import Import existing infrastructure into Terraform apply Builds or changes infrastructure get Download and install modules for the configuration push Upload this Terraform module to Terraform Enterprise to run refresh Update local state file against real resources