100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Terraform Cheat Sheet

Terraform Cheat Sheet

Terraform HCL syntax, resource blocks, state management, and CLI commands.

2 PagesIntermediateApr 18, 2026

Resource Block

Declare a piece of infrastructure.

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

Variables & Outputs

Parameterize configuration and expose values.

hcl
variable "region" {  type    = string  default = "us-east-1"}output "instance_ip" {  value = aws_instance.web.public_ip}

State Management

Terraform tracks real infra in a state file.

bash
terraform init       # Initialize backend & providersterraform plan        # Preview changesterraform apply       # Apply changesterraform destroy     # Tear down infrastructure

Modules

Reuse configuration across environments.

hcl
module "vpc" {  source = "./modules/vpc"  cidr_block = "10.0.0.0/16"}
Pro Tip

Store state remotely (e.g. S3 + DynamoDB lock table) for any team-shared infrastructure — local state doesn’t survive collaboration.

Was this cheat sheet helpful?

Explore Topics

#Terraform#TerraformCheatSheet#CloudComputing#Intermediate#ResourceBlock#VariablesOutputs#StateManagement#Modules#InfrastructureAsCode#CommandLine#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech

Professional Web Designing Services

  • Responsive Websites
  • E-commerce Solutions
  • SEO Friendly Design
  • Fast & Secure
  • Support & Maintenance
Get a Free Quote

Share this Cheat Sheet