Terraform Apps and Infra 1 - Introduction
Introduction to TF
- Build, change, version infrastructure safely and efficienty, locally or on the cloud.
graph LR A[terraform_config.tf] B[terraform.tfvars] C[Terraform] D[Terraform.tfstate] E[Cloud provider] F[Cloud environment] G[Team working with terraform] H[Terraform Cloud] A --> C B --> C C --> D C --> E E --> C E --> F F --> E D --> H H --> D G --> H
- Components
- Infrastructure as code
Terraform Configuration Language: describes it using a high-level configuration syntax- versioned: reused and shared
- Execution plans
- Planning steps: avoid any surprises when Terraform manipulates infrastructure.
- Resource graph
- build infra as efficiently as possible
- operators get insight into dependencies and resources
- Change automation
- applied complex changes with minimal interaction.
- combination of the execution plan and resource graph, you will know exactly what Terraform will change and in what order
- avoid many possible human errors
- Infrastructure as code
Setting Up Your Environment
Instalation
Pre-compiled binary: download and add to path
- configure automplete by adding the following line to
~/.bashrc, and restart shell after it1
terraform -install-autocomplete
- configure automplete by adding the following line to
OS package manager
- Windows: Chocolatey
- Mac: homebrew
- Linux: depends on distro and package manager
1
2
3
4sudo yum install -y yum-utils
yum-config-manager --add-repo https:://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install terraform
terraform --help
Nice to have
- Hasicorp Terraform syntax highlight and autompletion plugin/extension for your IDE