This repository holds infrastructure as code. OpenTofu is used to provision the infrastructure.
You need to install the CLI tool for the cloud provider you are using:
- Azure CLI
- gcloud CLI
- uv (Astral's Python environment manager)
Set up your development environment:
make install_devIf you want to commit changes to scripts,
you need to install ShellCheck, e.g. with:
brew install shellcheckThe pre-commit hooks for OpenTofu come from pre-commit-terraform. When running them outside the provided Docker image, point them at the OpenTofu binary:
export PCT_TFPATH=tofuThis is a one-time setup. It is not part of this infra-as-code.
Populate the backend.conf with the required values.
Create a storage account and a container to store the OpenTofu state.
NOTE: It might be required to add the object_id of the principal running tofu apply to the key vault with Get key permissions.
A first deploy will typically fail because the Key Vault is not yet populated with the required secrets.
One can deploy the Key Vault separately:
tofu apply -target=azurerm_key_vault.key_vaultThen manually add the "db-password" secret in the Key Vault. Then run tofu apply again to finish the deployment.
Create a bucket to store the OpenTofu state.
No service account keys are exported by this configuration. Workloads rely on ambient credentials, such as the service account attached to Cloud Run or workload identity federation.
Initialize (one-time setup) with
# NOTE: Populate the variables.
CSP= IDENTIFIER= bash scripts/init.sh.For local use, you can create symbolic links to the API and UI repository.
ln -s {absolute_path_to_api_repo} api
ln -s {absolute_path_to_ui_repo} uiThen use the deploy script to build and deploy the infrastructure:
# NOTE: Populate the variables.
CSP= IDENTIFIER= REGISTRY_NAME= REPOSITORY_NAME= bash scripts/deploy.sh- Run
alembic upgrade headagainst the database. - Populate with any data required. E.g., follow the instructions in the API repository.
- Create a separate backend, e.g.,
backend.conf, for each environment. - Create a separate
terraform.tfvarsfor each environment. - Use the
-backend-configflag withtofu initto specify the backend configuration file. - Use the
-var-fileflag withtofu planandtofu applyto specify the variables file.