{"id":48426729,"url":"https://github.com/alexpialetski/nx-terraform","last_synced_at":"2026-04-06T09:13:55.109Z","repository":{"id":320899010,"uuid":"1083692340","full_name":"alexpialetski/nx-terraform","owner":"alexpialetski","description":"Nx plugin for managing Terraform projects in monorepos with automatic discovery, inferred tasks, and smart dependencies.","archived":false,"fork":false,"pushed_at":"2026-02-15T19:17:08.000Z","size":6942,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-18T14:56:01.496Z","etag":null,"topics":["devops","infrastructure-as-code","monorepo","nx","terraform"],"latest_commit_sha":null,"homepage":"https://alexpialetski.github.io/nx-terraform/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexpialetski.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-26T14:38:42.000Z","updated_at":"2026-02-15T19:17:10.000Z","dependencies_parsed_at":"2025-10-26T17:35:42.892Z","dependency_job_id":null,"html_url":"https://github.com/alexpialetski/nx-terraform","commit_stats":null,"previous_names":["alexpialetski/nx-terraform"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/alexpialetski/nx-terraform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpialetski%2Fnx-terraform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpialetski%2Fnx-terraform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpialetski%2Fnx-terraform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpialetski%2Fnx-terraform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexpialetski","download_url":"https://codeload.github.com/alexpialetski/nx-terraform/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexpialetski%2Fnx-terraform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31466228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-06T08:36:52.050Z","status":"ssl_error","status_checked_at":"2026-04-06T08:36:51.267Z","response_time":112,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devops","infrastructure-as-code","monorepo","nx","terraform"],"created_at":"2026-04-06T09:13:55.040Z","updated_at":"2026-04-06T09:13:55.097Z","avatar_url":"https://github.com/alexpialetski.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n# nx-terraform\n\n### Manage Terraform infrastructure in your Nx monorepo\n\n[![npm version](https://img.shields.io/npm/v/nx-terraform.svg)](https://www.npmjs.com/package/nx-terraform)\n[![npm downloads](https://img.shields.io/npm/dm/nx-terraform.svg)](https://www.npmjs.com/package/nx-terraform)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n[Documentation](https://alexpialetski.github.io/nx-terraform/) • [Quick Start](#quick-start) • [Examples](#examples)\n\n\u003c/div\u003e\n\n---\n\n## Why nx-terraform?\n\nManaging infrastructure-as-code alongside application code is challenging. **nx-terraform** bridges this gap by bringing Terraform projects into your Nx monorepo with:\n\n- **Zero Configuration** - Automatically discovers Terraform projects, no manual setup needed\n- **Smart Dependencies** - Understands relationships between your infrastructure modules\n- **Intelligent Caching** - Speeds up operations without compromising safety\n- **Unified Workflow** - Use familiar Nx commands for all infrastructure operations\n- **Type-Safe Integration** - Keep infrastructure and application code in sync\n\n### The Problem\n\nTraditional Terraform setups struggle with:\n- Manual dependency tracking between modules\n- Slow, repetitive operations without caching\n- Infrastructure isolated from application code\n- Complex multi-environment management\n- No visibility into infrastructure dependencies\n\n### The Solution\n\n```bash\n# Create workspace with Terraform support\nnpx create-nx-terraform-app my-infrastructure\n\n# Nx automatically discovers projects and manages dependencies\nnx graph  # See your infrastructure dependency graph\n\n# Run operations with intelligent caching\nnx run web-infra:terraform-plan   # Fast when inputs haven't changed\nnx run web-infra:terraform-apply  # Full control when needed\n```\n\n## Quick Start\n\n### New Workspace\n\n```bash\nnpx create-nx-terraform-app my-workspace\ncd my-workspace\n\n# Apply backend (if using remote state)\nnx run terraform-setup:terraform-apply\n\n# Deploy your infrastructure\nnx run terraform-infra:terraform-init\nnx run terraform-infra:terraform-plan\nnx run terraform-infra:terraform-apply\n```\n\n### Existing Workspace\n\n```bash\n# Add nx-terraform to your workspace\nnx add nx-terraform\nnx g nx-terraform:init\n\n# Create your first Terraform project\nnx g nx-terraform:terraform-backend terraform-setup\nnx g nx-terraform:terraform-module web-infra --backendProject=terraform-setup\n```\n\n## Key Features\n\n### 🔍 Automatic Project Discovery\nNo manual configuration. Drop a `main.tf` file in your workspace and nx-terraform finds it.\n\n```bash\nnx show projects  # All Terraform projects automatically discovered\n```\n\n### 🎯 Inferred Terraform Targets\nSeven Terraform operations automatically available for each project:\n\n```bash\nnx run \u003cproject\u003e:terraform-init      # Initialize workspace\nnx run \u003cproject\u003e:terraform-plan      # Create execution plan\nnx run \u003cproject\u003e:terraform-apply     # Apply changes\nnx run \u003cproject\u003e:terraform-destroy   # Destroy infrastructure\nnx run \u003cproject\u003e:terraform-validate  # Validate configuration\nnx run \u003cproject\u003e:terraform-fmt       # Format code\nnx run \u003cproject\u003e:terraform-output    # Show outputs\n```\n\n### 🔗 Smart Dependency Management\nAutomatically detects and manages two types of dependencies:\n\n**Backend Dependencies** - Projects reference their state backend\n```json\n{\n  \"targets\": {\n    \"terraform-init\": {\n      \"metadata\": {\n        \"backendProject\": \"terraform-setup\"\n      }\n    }\n  }\n}\n```\n\n**Module Dependencies** - Terraform code references are detected automatically\n```hcl\nmodule \"networking\" {\n  source = \"../networking\"  # Automatic dependency on networking project\n}\n```\n\n### ⚡ Intelligent Caching\nOperations are cached when safe, always run fresh when state-dependent:\n\n- ✅ **Cached**: `terraform-fmt`, `terraform-validate` (fast when unchanged)\n- 🔄 **Always Fresh**: `terraform-plan`, `terraform-apply` (state-dependent)\n\n### 📦 Three Project Types\n\n**Backend Projects** - Manage state storage infrastructure\n```bash\nnx g nx-terraform:terraform-backend terraform-setup --type=aws-s3\n```\n\n**Stateful Projects** - Deploy actual infrastructure with remote state\n```bash\nnx g nx-terraform:terraform-module web-infra --backendProject=terraform-setup\n```\n\n**Module Projects** - Reusable Terraform code without state\n```bash\nnx g nx-terraform:terraform-module networking --type=module\n```\n\n## Examples\n\n### Multi-Environment Setup\n\n```bash\n# Shared backend\nnx g nx-terraform:terraform-backend terraform-setup\n\n# Environment-specific infrastructure\nnx g nx-terraform:terraform-module dev-infra --backendProject=terraform-setup\nnx g nx-terraform:terraform-module prod-infra --backendProject=terraform-setup\n\n# Deploy with environment-specific variables\nnx run dev-infra:terraform-apply -- -var-file=tfvars/dev.tfvars\nnx run prod-infra:terraform-apply -- -var-file=tfvars/prod.tfvars\n```\n\n### Reusable Modules\n\n```bash\n# Create reusable networking module\nnx g nx-terraform:terraform-module networking --type=module\n\n# Use in your infrastructure\nnx g nx-terraform:terraform-module web-infra --backendProject=terraform-setup\n```\n\nIn `web-infra/main.tf`:\n```hcl\nmodule \"networking\" {\n  source = \"../networking\"\n  vpc_cidr = \"10.0.0.0/16\"\n}\n```\n\nNx automatically detects this dependency: `web-infra` → `networking`\n\n## Documentation\n\n📚 **[Full Documentation](https://alexpialetski.github.io/nx-terraform/)**\n\n- [Getting Started Guide](https://alexpialetski.github.io/nx-terraform/docs/getting-started/quick-start)\n- [Step-by-Step Tutorials](https://alexpialetski.github.io/nx-terraform/docs/tutorials/tutorial-01-create-workspace)\n- [Guides](https://alexpialetski.github.io/nx-terraform/docs/guides/project-types) - Project types, dependencies, caching, best practices\n- [Reference](https://alexpialetski.github.io/nx-terraform/docs/reference/generators/init) - Generators and targets\n- [Examples](https://alexpialetski.github.io/nx-terraform/docs/examples/complete-workflow) - Real-world patterns\n\n## Who Is This For?\n\n**Perfect for:**\n- Teams managing infrastructure in monorepos\n- Organizations with multiple environments (dev/staging/prod)\n- Projects with shared infrastructure modules\n- Teams wanting infrastructure visibility in their dependency graph\n\n**Not ideal for:**\n- Single-file Terraform projects (use Terraform CLI directly)\n- Teams not using Nx (requires Nx workspace)\n\n## Requirements\n\n- Node.js 18+\n- Nx workspace (or create new with `create-nx-terraform-app`)\n- Terraform CLI (optional but recommended)\n\n## Support\n\n- 📖 [Documentation](https://alexpialetski.github.io/nx-terraform/)\n- 🐛 [Report Issues](https://github.com/alexpialetski/nx-terraform/issues)\n- 💬 [GitHub Discussions](https://github.com/alexpialetski/nx-terraform/discussions)\n\n## Contributing\n\nContributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## Resources\n\n- [Nx Documentation](https://nx.dev)\n- [Terraform Documentation](https://developer.hashicorp.com/terraform/docs)\n- [GitHub Repository](https://github.com/alexpialetski/nx-terraform)\n- [npm Package](https://www.npmjs.com/package/nx-terraform)\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpialetski%2Fnx-terraform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexpialetski%2Fnx-terraform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexpialetski%2Fnx-terraform/lists"}