terraform registry me jake boht sare modules explore kr skte ho

image.png

Purpose: Package and reuse resource configurations.

Module = A folder with .tf files that packages and reuses resource configurations.


What is a Module?

A module is a container for multiple resources used together.

Give it inputs → it creates infrastructure → returns outputs.

Think of it like a function: you call it with arguments, it does the work.


Module Structure

Minimal (must-have files)

my-module/
├── main.tf         # resources go here
├── variables.tf    # input variables
├── outputs.tf      # return values
└── README.md       # documentation

Complete (production-ready)

my-module/
├── main.tf
├── variables.tf
├── outputs.tf
├── README.md
├── modules/        # nested sub-modules
│   ├── nestedA/
│   └── nestedB/
└── examples/       # usage examples
    ├── exampleA/
    └── exampleB/

Key Files

File Purpose
main.tf Define resources
variables.tf Input parameters
outputs.tf Values to return
README.md Documentation

Why Use Modules?