Terraform Basics
Terraform allows you to define your infrastructure in files.
Installation
bash
sudo apt-get update && sudo apt-get install -y gnupg software-properties-common
# Add HashiCorp GPG key and repo...
sudo apt-get install terraformDefining Resources
Create `main.tf`:
hcl
terraform {
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = "~> 2.0"
}
}
}
variable "do_token" {}
provider "digitalocean" {
token = var.do_token
}
resource "digitalocean_droplet" "web" {
image = "ubuntu-20-04-x64"
name = "web-1"
region = "nyc3"
size = "s-1vcpu-1gb"
}Applying Changes
bash
terraform init
terraform plan
terraform applyPage changelog
Last updated
- 2024-03-15—Initial or baseline update for this page.
Related articles
Getting Started
Tutorials Hub — Learn by Building
Step-by-step workflows that teach deployment, security, and operations by shipping small projects.
Getting Started
Glossary — Infrastructure Terms
Short, clear definitions for common deployment, networking, and security terminology.
Getting Started
Changelog — Documentation Updates
What changed recently in the documentation, plus guidance for versioning docs as code.
Getting Started
Support & FAQ
Quick answers, how to get help, and what information to include when reporting an issue.
Getting Started
Bootstrap — Classic CSS Framework (Fast Layouts)
Use Bootstrap for rapid grids and components, and learn how to override safely with real CSS snippets.
Getting Started
shadcn/ui — Tailwind Components You Own
Add beautiful, accessible components to your app without locking into a hosted UI library. Includes practical examples and structure tips.
Was this page helpful?