← ClaudeAtlas

terranixlisted

Write OpenTofu/Terraform infrastructure-as-code in Nix with terranix instead of hand-writing HCL — scaffold a terranix project (flake + config.nix), convert existing .tf HCL files to terranix, fix ${} interpolation clashes between Nix and Terraform ("undefined variable 'var'" / "variable not found" errors), wire up tofu workflows that consume generated config.tf.json, manage secrets via TF_VAR_ and sensitive variables, or verify a terranix setup with tofu init/validate. Use whenever the user mentions terranix, wants Terraform/OpenTofu configuration written in Nix ("infrastructure as nix code", "tf.json from nix", "opentofu in nix"), or works in a repo whose infra lives in config.nix + config.tf.json. Not for plain HCL authoring without Nix, packaging Terraform providers/plugins for nixpkgs, or deploy tools like nixops, colmena, or deploy-rs.
atvari-eu/nix-skills · ★ 0 · Data & Documents · score 70
Install: claude install-skill atvari-eu/nix-skills
# Terranix [terranix](https://terranix.org) generates [Terraform JSON](https://developer.hashicorp.com/terraform/language/syntax/json) from Nix modules. You write `config.nix`; the `terranix` tool (or a flake build) produces `config.tf.json`, which OpenTofu (`tofu`) applies exactly like HCL — same providers, same state, same plan/apply workflow. Prefer OpenTofu over Terraform when the user hasn't pinned a choice: it's in nixpkgs as `pkgs.opentofu`, command `tofu`, reads the same `.tf.json` files, and resolves providers from its own registry mirror. Two rules that prevent most mistakes: - **`config.tf.json` is a build artifact.** Never hand-edit it; regenerate it. Gitignore it along with state (see below). - **Nix and Terraform share the `${}` syntax** (see [Interpolation escaping](#interpolation-escaping)) — this clash is the single biggest source of broken terranix configs. Don't convert an existing working HCL project to terranix unasked; offer it if the user is clearly Nix-first, but leave plain `.tf` repos alone otherwise. ## Two ways to run terranix | | nixpkgs CLI (`pkgs.terranix`) | flake (`github:terranix/terranix`) | | --- | --- | --- | | Invocation | `terranix -q > config.tf.json` | `nix build -o config.tf.json` | | Reads | `./config.nix` (or path argument) | `modules = [ ./config.nix ]` | | Module args | `lib` is empty as of 2.8.0 | nixpkgs `lib` extended with `lib.tf.ref` / `lib.tfRef` | | Best for | quick one-offs | anything real: pinning, modules, C