Skip to content

leylilee/cemeweLab1

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧩 cemewe DevOps Course for beginners 🚀

Terraform Lab 1 — Infrastructure as Code (IaC)

This lab demonstrates the use of Terraform to provision and manage infrastructure as code.
It includes configuration files for defining variables, resources, and state management.


1. 🧰 Prerequisites

Before starting this lab, make sure you have the following tools installed and configured on your system:

🧱 Core Tools


🧩 Recommended VS Code Setup

Use Visual Studio Code (VS Code) as your IDE for this lab.
It provides syntax highlighting, linting, and Terraform integration for a smoother workflow.

▶️ Watch: Best VS Code Extensions for Terraform & DevOps


2. 🪞 Fork and Clone This Repository

Before starting the lab, each student should fork this repository into their own GitHub account and then clone it locally.

🧩 Steps to Fork the Repository

  • Go to the main course repository on GitHub (provided by the instructor).

  • Click the “Fork” button in the top-right corner to create a personal copy of the repository under your GitHub account.

  • Once forked, open your forked repository and click “Code” → “Copy HTTPS URL”.

💻 Clone the Repository to Your Local Machine

Run the following commands in your terminal or VS Code:

Navigate to the directory where you want to store the project

cd ~/your-directory

Clone your forked repository (replace with your GitHub username)

git clone https://github.com/<your-github-username>/cemeweLab1.git

Move into the project directory

cd cemeweLab1

3. ⚙️ Configure Git (if not already configured)

If this is your first time using Git on your system, set your username and email:

git config --global user.name "Username"
git config --global user.email "email@example.com"

You can verify your configuration using:

git config --list

If you want to use different identities for specific projects (for example, one for personal projects and one for work), you can configure Git only for the current repository.

git config user.name "Username"
git config user.email "email@example.com"

4. 🧑‍💻 Update Your Student Name

Before running Terraform commands, open the variables.tf file and update the following variable:

variable "student_name" {
  description = "Unique student identifier"
  type        = string
  default     = "test_student1"  # <-- Each student updates this value
}

5. 🪜 Step-by-Step Terraform Workflow

1. 🧰 Initialize Terraform

Run this command to download providers and initialize the working directory:

terraform init

2. 🧪 Validate Configuration

Check that your .tf files are syntactically and structurally correct.

terraform validate

3. 🧭 Create an Execution Plan

See what Terraform will do before actually applying any changes.

terraform plan

4. 🚧 Apply the Configuration

Provision your infrastructure as defined in the .tf files.

terraform apply

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HCL 100.0%