← Back to all products
$49
IaC Patterns Library
Design patterns for Infrastructure as Code: modules, composition, testing, drift detection, and cost management.
JSONMarkdownShellTerraformAWS
📄 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)
[]()
[]()
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 .sh preview
scripts/tf-wrapper.sh#!/usr/bin/env bash
# ============================================================================
# Terraform Wrapper Script
# Standardized Terraform workflow with locking, validation, and state management
# ============================================================================
# Datanest Digital — datanest.dev
# ============================================================================
set -euo pipefail
# ── Configuration ───────────────────────────────────────────────────────────
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOCK_TIMEOUT="${TF_LOCK_TIMEOUT:-5m}"
PLAN_DIR="${TF_PLAN_DIR:-.plans}"
LOG_DIR="${TF_LOG_DIR:-.logs}"
TF_BINARY="${TF_BINARY:-terraform}"
PARALLELISM="${TF_PARALLELISM:-10}"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# ── Helper Functions ────────────────────────────────────────────────────────
log_info() { echo -e "${BLUE}[INFO]${NC} $(date '+%H:%M:%S') $*"; }
log_ok() { echo -e "${GREEN}[OK]${NC} $(date '+%H:%M:%S') $*"; }
log_warn() { echo -e "${YELLOW}[WARN]${NC} $(date '+%H:%M:%S') $*"; }
log_error() { echo -e "${RED}[ERROR]${NC} $(date '+%H:%M:%S') $*" >&2; }
usage() {
cat <<EOF
Usage: $(basename "$0") <command> [options]
Terraform wrapper with standardized workflow, validation, and safety checks.
Commands:
init Initialize Terraform working directory