Terraform and CloudFormation

Three templates stand up the reference layout from public cloud: a host running the Compose appliance, a managed PostgreSQL, a write-only backup bucket, DNS. A platform team can then review a plan instead of a runbook, and re-create the environment in minutes:

TemplateCreatesAccess to the host
deploy/terraform/awsEC2 (Ubuntu 24.04) + EIP, RDS for PostgreSQL 16 (PITR, TLS forced), versioned S3 bucket (host may write and read, never delete), optional Route 53 record, instance roleSSM Session Manager; no SSH, no key pair
deploy/cloudformation/coverops.yamlthe same, as one stackSSM
deploy/terraform/azureVM with managed identity + public IP, Azure Database for PostgreSQL Flexible Server (private access, PITR, TLS forced), GRS storage account with versioning and soft delete (identity writes backups), data disk, optional Azure DNS record, AcrPull on your ACRBastion / az ssh; SSH key for break-glass only

All three are validated in CI (terraform validate, cfn-lint) and are starting points you own: adjust sizes, tags, naming and the network pieces to your standards. What they deliberately leave to you: the VPC/VNet (every organisation has one), the WAF/ALB/Application Gateway in front (the appliance's built-in edge terminates TLS with Let's Encrypt when none is wanted), and the identity provider.

How the host configures itself

Cloud-init (user_data / custom_data) installs Docker and chrony, formats and mounts the data disk at /srv/coverops, writes coverops.env from the template inputs (including the generated database URL, the TLS mode, the backup destination) and runs install.sh with the tls and backups profiles, against the managed database (--scale postgres=0).

Two things it needs that a template cannot carry:

  • The install directory (deploy/onprem/) at /srv/coverops/onprem. Host a release tarball on an internal URL and set it in the script, or copy the directory over SSM / az vm run-command after the first boot and re-run the script (it is idempotent).
  • Registry credentials: a Secrets Manager secret ({"username","password"}) for our registry, or none when the images are in your ECR/ACR and the instance role / managed identity may pull.

Backups go off-host with no keys on disk: rclone uses the instance role on AWS (env_auth = true) and the managed identity on Azure (use_msi = true).

AWS with Terraform

cd deploy/terraform/aws
terraform init
terraform plan \
  -var vpc_id=vpc-0123 -var public_subnet_id=subnet-0abc \
  -var 'db_subnet_ids=["subnet-0def","subnet-0fed"]' \
  -var coverops_host=coverops.example.com -var route53_zone_id=Z0123 \
  -var coverops_version=2026.11.10 \
  -var registry_secret_arn=arn:aws:secretsmanager:eu-central-1:123456789012:secret:coverops-registry
terraform apply

Inputs worth deciding: instance_type and db_instance_class from the sizing tiers; db_multi_az=true for Enterprise; allowed_cidrs to your users' and agents' ranges; tls_mode=files with your certificate if Let's Encrypt is not allowed (copy the files to /srv/coverops/onprem/certs).

Outputs: the public IP, the dashboard URL, the RDS endpoint, the bucket, and the aws ssm start-session command.

AWS with CloudFormation

aws cloudformation deploy --stack-name coverops \
  --template-file deploy/cloudformation/coverops.yaml \
  --capabilities CAPABILITY_IAM \
  --parameter-overrides VpcId=vpc-0123 PublicSubnetId=subnet-0abc \
    DbSubnetIds=subnet-0def,subnet-0fed CoverOpsHost=coverops.example.com \
    HostedZoneId=Z0123 CoverOpsVersion=2026.11.10 \
    RegistrySecretArn=arn:aws:secretsmanager:…:secret:coverops-registry

The stack keeps the database password in Secrets Manager (<stack>-db), snapshots the database on delete, and blocks deletion while it exists. The DbEngineVersion parameter defaults to a current PostgreSQL 16 minor; check aws rds describe-db-engine-versions --engine postgres in your region.

Azure with Terraform

cd deploy/terraform/azure
terraform init
terraform apply \
  -var resource_group=rg-coverops -var location=westeurope \
  -var subnet_id=/subscriptions/…/subnets/app \
  -var db_subnet_id=/subscriptions/…/subnets/pg \
  -var db_private_dns_zone_id=/subscriptions/…/privateDnsZones/privatelink.postgres.database.azure.com \
  -var coverops_host=coverops.example.com -var dns_zone_name=example.com \
  -var coverops_version=2026.11.10 \
  -var coverops_registry=acmeregistry.azurecr.io -var acr_id=/subscriptions/…/registries/acmeregistry \
  -var admin_ssh_public_key="$(cat ~/.ssh/id_ed25519.pub)"

The Flexible Server needs a delegated subnet and the private DNS zone, the two inputs most often missing; the module does not create them because they are usually shared. With acr_id set the VM's identity gets AcrPull and cloud-init does az acr login with it; copy the images into the ACR first (public cloud → ACR).

Kubernetes

For a cluster, the unit of deployment is the Helm chart, not a VM; see kubernetes. A Terraform helm_release wrapping it is a few lines; the values are the same.

Keeping the templates and the product in step

The templates pin nothing about the product except coverops_version; an upgrade is a new value and a re-run of install.sh on the host (or docker compose pull && up -d), not a new template. Infrastructure changes (a larger instance, a bigger disk, Multi-AZ) are ordinary plans. Treat the state file as the secret it is (it contains the database password).