Back to course

Our First Resource: The Local File

Infrastructure as Code (Terraform & OpenTofu Mastery)

Start Small: Local Provider

Before touching the cloud, let's manage a file on our own computer using IaC.

  1. Create a file named main.tf.
  2. Add the following code: hcl resource "local_file" "pet_name" { filename = "pet.txt" content = "My pet is named Fluffy!" }

Why do this?

This proves that IaC isn't just for cloud; it's for managing any resource that has an API (Application Programming Interface). Here, the 'API' is your computer's filesystem.