Skip to content

Terraform

Terraform is an open-source infrastructure as code software tool that provides a consistent CLI workflow cloud services

https://learn.hashicorp.com/terraform

Terraform CLI

To install terraform CLI : https://learn.hashicorp.com/tutorials/terraform/install-cli?in=terraform/docker-get-started

The main workflow consists of 3 steps once you have written your Terraform configuration :

  • Initialize : prepares the working directory so Terraform can run the configuration.
  • Plan : lets you preview any changes before you apply them.
  • Apply : executes the changes defined by your configuration to create, update or destroy resources.

The phase of cleaning up the previously-created resources corresponds to Destroy.

terraform --help
terraform init
terraform plan
terraform apply # --auto-approve # -var "xy=xx"
terraform destroy

Providers - Modules

Don't Repeat Yourself - Terragrunt

Keep your Terraform code DRY with terragrunt