Terraform - infrastructure as code
Source: Terraform explained in 15 mins | Terraform Tutorial for Beginners - YouTube
Introduction and More Details
Section titled “Introduction and More Details”See Infrastructure as Code with Terraform - DevOps Bootcamp - Infrastructure as Code with Terraform
What is Terraform used for, Use Cases
Section titled “What is Terraform used for, Use Cases”Provision infrastructure, platforms, and services.
Use Case, you want:
- Provisioning infrastructure - To use AWS to build 3 containers and deploy your apps, services, private network space, EC2 server instances, install Docker and tools
- Deploy applications
Terraform is used for infrastructure provisioning such as creating infrastructure, user permissions, create servers, install services.
Continuing with the use case, you created the infrastructure, now you want:
- Add more servers
- Increase security
- Reconfigure infrastructure
Terraform can automate continuous changes. Such as promote infrastructure changes in DEV to PROD and/or create same infrastructure in PROD.
Terraform and Ansible Differences and When to Use Them
Section titled “Terraform and Ansible Differences and When to Use Them”They appear to do the same thing?
Ansible | Terraform |
---|---|
Infrastructure as Code | Same |
Mainly Configuration tool | Mainly Infrastructure Provisioning tool |
Configure existing infrastructure | |
Install/update software | Can deploy apps |
Mature | Newer |
Advanced in orchestration |
- Ansible is better for configuring existing infrastructure
- Terraform is better for infrastructure
Both tools should be used together for their strengths.
Declarative vs Imperative Approach
Section titled “Declarative vs Imperative Approach”- Terraform uses Declarative language - you define the end state
- Imperative approach defines exact steps to get to end state