# devICT Infrastructure A repo holding infrastructure-as-code config for devICT services. ## OpenTofu state State lives in one shared DigitalOcean Spaces bucket — `devict-tf-state` in `nyc3` — with a key per OpenTofu root: | Root | Key | | --- | --- | | `atprotopds` | `atprotopds/terraform.tfstate` | | `devserver` | `devserver/terraform.tfstate` | | `matrix` | `matrix/terraform.tfstate` | | `observability` | `observability/terraform.tfstate` | The bucket is created out of band, not by OpenTofu: a root cannot own the bucket holding its own state, since `tofu destroy` there would wipe every root. Locking uses S3 conditional writes (`use_lockfile = true`), so no DynamoDB table is needed. OpenTofu authenticates with the PDS Spaces key. Every root's `.env.local.op` must expose it under the names the S3 backend reads: ``` AWS_ACCESS_KEY_ID=op://Private/env-devict-pds/SPACES_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY=op://Private/env-devict-pds/SPACES_SECRET_ACCESS_KEY ``` Each dir's `tf` recipe wraps `op run` and forwards its arguments to `tofu` (`just tf plan`, `just tf apply`), so the credentials never reach disk or shell history. The `terraform/` dirs and `*.tfstate` keys keep their names: they are the file format, not the tool. Cost: Spaces bills $5/mo per DigitalOcean account, not per bucket (up to 100 buckets, 250 GiB cumulative). The bucket is shared for fewer moving parts, not for price. ## Tools - [Mise](https://mise.jdx.dev/) for managing tools needed to work with this repo - [just](https://just.systems/) for the recipes in each directory (`just --list`) - [OpenTofu](https://opentofu.org/) for provisioning cloud resources - [Ansible](https://docs.ansible.com/projects/ansible) for configuring servers - Docker and [docker compose](https://docs.docker.com/compose/) for running the services ## Checks ```sh just deps # collections the roles use, into .ansible/ just check # everything below ``` No credentials, no hosts. `just check` runs `tofu fmt -check` and offline `tofu validate` in all four roots, `ansible-lint` and `ansible-playbook --syntax-check` in all four `ansible/` dirs, then `yamllint`. `.tangled/workflows/check.yml` runs the same two commands on PRs against `main`. Not covered, and still manual: `tofu plan` (needs the Spaces state key and `TF_VAR`s), and anything that needs the hosts or Infisical — the deploy playbooks, the running services, the alert rules.