Cloud Advanced
Terraform Modules¶
TerraformModulesIaC 3 min read
Reusable Terraform modules. Structure, registry and best practices.
Custom Module¶
# modules/vpc/main.tf
variable "cidr" { default = "10.0.0.0/16" }
resource "aws_vpc" "main" {
cidr_block = var.cidr
tags = { Name = var.name }
}
output "vpc_id" { value = aws_vpc.main.id }
# Usage
module "vpc" {
source = "./modules/vpc"
cidr = "10.0.0.0/16"
name = "production"
}
Registry Modules¶
module "eks" {
source = "terraform-aws-modules/eks/aws"
version = "~> 20.0"
cluster_name = "my-cluster"
cluster_version = "1.29"
}
Summary¶
Modules = DRY principle for infrastructure. Use registry modules where possible, custom ones for specific logic.
Need Help with Implementation?¶
Our team has experience designing and implementing modern architectures. We’re happy to help.