Useful terraform commands

Useful terraform Commands

$ terraform plan                                  # plan
$ terraform apply                                 # shortcut for plan & apply - avoid this in production
$ terraform plan -out out.terraform      # terraform plan and write the plan to out file
$ terraform apply out.terraform            # apply terraform plan using out file
$ terraform show                                  # show current state
$ cat terraform.tfstate                           # show state in JSON format


What is terraform?

An IaaC which provides automation of our infrastructure, by ensuring our infrastructure is kept on a state.
Infrastructure change is managed in VCS.
Terraform (HCL hashicorp configuration language)


create a seperate terraform work directory:

mkdir terraform-test

cd terraform-test

create a main.tf file:

vi main.tf


----------------------------------------------------------------------------------------------------------------------

variable "myvar" {
    type = "string"
    default = "hello world"
    
}   

}













Comments

Popular Posts