Terraform IaC for Autonomys Network blockchain infrastructure. Manages multiple environments (mainnet, chronos testnet, devnet) across AWS and Cloudflare.
All infrastructure — projects, instances, volumes, DNS records — must be defined in this repository, reviewed via PR, and deployed using IaC.
- Terraform CLI
- Docker (for secrets management via Infisical)
- Bash 4+
- AWS credentials
- Infisical credentials (environment variables):
INFISICAL_CLIENT_IDINFISICAL_CLIENT_SECRETINFISICAL_INFRA_PROJECT_ID
modules/ # Reusable Terraform modules
resources/terraform/ # Individual Terraform projects
templates/ # Shared script templates
logging/ # Logging and monitoring (Grafana Loki, Traefik, VictoriaMetrics)
| Module | Description |
|---|---|
| network-primitives | Core blockchain node infrastructure (consensus, domain, farmer nodes, VPC, security groups, DNS, load balancers) |
| chain-indexer | Blockchain indexing with PostgreSQL + Docker + Traefik |
| chain-alerts | Chain monitoring and alerting with Slack integration |
| operator-reward-distributor | Automated reward distribution |
| node-utils | Docker image with Rust CLI tools for Infisical secret management |
Network:
mainnet-consensus— Mainnet consensus nodesmainnet-domains— Mainnet domain nodesmainnet-foundation— Foundation nodeschronos— Chronos testnetdevnet— Development network
Services:
mainnet-chain-indexer,chronos-chain-indexer— Blockchain indexersmainnet-chain-alerter,chronos-chain-alerter— Monitoring and alertsmainnet-reward-distributor,chronos-reward-distributor— Reward distribution
Other:
dns— Standalone DNS records (autonomys.xyz, autonomys.net, autonomys.network, subspace.network, subspace.net, subspace.foundation, continuum.co, ai3.storage)telemetry— Telemetry API infrastructurepacker— AMI buildingauto-drive— Auto-drive gateway infrastructureauto-kol-memory— KOL memory infrastructure
Each project follows this structure:
<project>/
├── main.tf # Module calls
├── backend.tf # Terraform Cloud backend (org: subspace-sre)
├── variables.tf # Input variables
├── outputs.tf # Outputs
├── providers.tf # Provider configuration
├── common.auto.tfvars # Shared secrets (gitignored, stored in Infisical)
├── common.auto.tfvars.example # Example tfvars template
├── user.auto.tfvars # User-specific variables (gitignored)
└── config.toml # Node keys/secrets (gitignored, stored in Infisical)
export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"All project management goes through resources/terraform/manage.sh:
# Usage: ./resources/terraform/manage.sh <project> <action>
./manage.sh <project> fetch-secrets # Fetch secrets from Infisical
./manage.sh <project> init # Initialize Terraform (also fetches secrets)
./manage.sh <project> upgrade # Upgrade providers (also fetches secrets)
./manage.sh <project> plan # Generate plan file at <project>/<project>.tfplan
./manage.sh <project> apply # Apply plan (also stores secrets back)
./manage.sh <project> destroy # Destroy resources
./manage.sh <project> output # Show Terraform outputs
./manage.sh <project> store-secrets # Store secrets to InfisicalSecrets are managed through Infisical via a Docker container (ghcr.io/autonomys/infra/node-utils).
Never commit .tfvars, config.toml, or proxied.json files — they are gitignored and stored in Infisical.
| Provider | Version | Purpose |
|---|---|---|
| AWS | 6.17.0 | EC2, VPC, EBS, security groups, load balancers |
| Cloudflare | 5.8.2+ | DNS records across 8 domains (some modules use newer versions) |
All projects use Terraform Cloud (org: subspace-sre) with local execution mode — state is stored remotely, execution runs locally.
When creating a new workspace, change the execution mode from remote to local in the workspace settings (Settings > Execution Mode).
- Create a branch from
main - Make infrastructure changes
- Run
./manage.sh <project> planlocally to verify - Open a Pull Request to
mainfor review - After approval, apply changes with
./manage.sh <project> apply
- Docker containers on EC2 instances, provisioned via
null_resourcewithremote-exec - Some nodes run on bare metal (Hetzner) with fixed IPs
- Infrastructure-linked DNS is handled by the
network-primitivesmodule; standalone DNS records are managed in thednsproject
The network nodes use container images from the Autonomys GitHub packages:
- Node:
ghcr.io/autonomys/node - Farmer:
ghcr.io/autonomys/farmer
The logging/ directory contains configuration for the observability stack:
- VictoriaMetrics — Metrics collection and storage
- Grafana Loki — Log aggregation
- Traefik — Reverse proxy for monitoring services
- Do not use root user on instances
- SSH key authentication only — password auth disabled
PermitRootLogin noandPasswordAuthentication noin/etc/ssh/sshd_config