Menu

Terraform Explained: Infrastructure as Code
πŸ“°

Terraform Explained: Infrastructure as Code

DEV Community: terraformΒ·The Practical DeveloperΒ·1 day ago
#j8Jk2ejL
#devtoterraform#devto#dev#terraform#infrastructure
Reading 0:00
15s threshold

Introduction

Every application needs infrastructure: servers, databases, networks, DNS records. The old way to create them is clicking through cloud consoles β€” slow, error-prone, and impossible to reproduce exactly. Terraform, from HashiCorp, takes a different approach: you describe the infrastructure you want in configuration files, and Terraform creates it, updates it, and tracks it for you. Infrastructure as code, in the same way your application is code.

Configuration: describe, don't click

A Terraform file declares resources β€” things you want to exist β€” in a readable language called HCL:

resource "aws_instance" "web" { ami = "ami-12345678" instance_type = "t3.micro" tags = { Name = "web-server" } }

Enter fullscreen mode

Exit fullscreen mode

Run terraform apply , and Terraform creates that server in AWS. Change t3.micro to t3.small and apply again, and Terraform resizes it. Delete the block and apply, and it destroys the server.…

Continue reading β€” create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.