← Back to all products

IaC Patterns Library

$49

Design patterns for Infrastructure as Code: modules, composition, testing, drift detection, and cost management.

22 filesv1.0.0
ShellTerraformMarkdownJSONAWS

Product Preview

Try the interactive reader and demo tools below, or get the full product with all content unlocked.

Interactive Reader (Free Preview) ⚙ Try Demo Tools Download Free Sample

File Structure 22 files

infrastructure-as-code-patterns/ ├── LICENSE ├── README.md ├── guides/ │ └── iac-patterns.md ├── modules/ │ └── tags/ │ ├── main.tf │ └── variables.tf ├── patterns/ │ ├── ecs-fargate-service/ │ │ ├── main.tf │ │ ├── outputs.tf │ │ └── variables.tf │ ├── lambda-api/ │ │ ├── main.tf │ │ └── variables.tf │ ├── rds-aurora/ │ │ ├── main.tf │ │ └── variables.tf │ ├── static-site/ │ │ ├── main.tf │ │ └── variables.tf │ └── vpc-three-tier/ │ ├── main.tf │ ├── outputs.tf │ └── variables.tf ├── scripts/ │ └── tf-wrapper.sh └── terragrunt/ ├── environments/ │ ├── dev/ │ │ └── terragrunt.hcl │ └── prod/ │ └── terragrunt.hcl └── terragrunt.hcl

Documentation Preview README excerpt

Infrastructure as Code Patterns

Production-ready Terraform patterns and Terragrunt configurations for AWS infrastructure.

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)

[![Terraform](https://img.shields.io/badge/Terraform-1.6+-purple.svg)]()

[![AWS](https://img.shields.io/badge/AWS-Provider%205.x-orange.svg)]()

Stop reinventing the wheel. Battle-tested IaC patterns for VPC, ECS, RDS, Lambda, and more.

What You Get

  • 5 production Terraform patterns covering the most common AWS architectures
  • Reusable tagging module for consistent resource labeling across all stacks
  • Terragrunt configurations with DRY environment management (dev/prod)
  • Terraform wrapper script with locking, state management, and plan output
  • Comprehensive guide on IaC patterns, module design, state management, and cost estimation

File Tree


infrastructure-as-code-patterns/
├── README.md
├── manifest.json
├── LICENSE
├── patterns/
│   ├── vpc-three-tier/          # VPC with public/private/data subnets × 3 AZs
│   │   ├── main.tf
│   │   ├── variables.tf
│   │   └── outputs.tf
│   ├── ecs-fargate-service/     # ECS Fargate + ALB + auto-scaling
│   │   ├── main.tf
│   │   ├── variables.tf
│   │   └── outputs.tf
│   ├── rds-aurora/              # Aurora cluster with read replicas
│   │   ├── main.tf
│   │   └── variables.tf
│   ├── lambda-api/              # API Gateway + Lambda + DynamoDB
│   │   ├── main.tf
│   │   └── variables.tf
│   └── static-site/             # S3 + CloudFront + Route53 + ACM
│       ├── main.tf
│       └── variables.tf
├── modules/
│   └── tags/                    # Consistent tagging module
│       ├── main.tf
│       └── variables.tf
├── terragrunt/
│   ├── terragrunt.hcl           # Root Terragrunt config
│   └── environments/
│       ├── dev/terragrunt.hcl
│       └── prod/terragrunt.hcl
├── scripts/
│   └── tf-wrapper.sh            # Terraform wrapper script
└── guides/
    └── iac-patterns.md          # Patterns guide

... continues with setup instructions, usage examples, and more.

Code Sample .tf preview

modules/tags/main.tf # ============================================================================ # Tags Module # Consistent, enforced tagging across all infrastructure resources # ============================================================================ # Datanest Digital — datanest.dev # ============================================================================ # # Usage: # module "tags" { # source = "../../modules/tags" # project = "myapp" # environment = "prod" # team = "platform" # cost_center = "engineering" # } # # resource "aws_instance" "example" { # ... # tags = module.tags.tags # } # ============================================================================ terraform { required_version = ">= 1.5.0" } locals { # Base required tags applied to every resource required_tags = { Project = var.project Environment = var.environment ManagedBy = "terraform" Team = var.team CostCenter = var.cost_center } # Optional tags, only included when set optional_tags = merge( var.service != null ? { Service = var.service } : {}, var.owner != null ? { Owner = var.owner } : {}, var.repository != null ? { Repository = var.repository } : {}, var.data_classification != null ? { DataClassification = var.data_classification } : {}, var.compliance != null ? { Compliance = var.compliance } : {}, ) # Timestamp tags for auditing audit_tags = var.enable_audit_tags ? { CreatedBy = var.created_by CreatedDate = var.created_date != null ? var.created_date : formatdate("YYYY-MM-DD", timestamp()) } : {} # ... 50 more lines ...