forgejo/terraform/build_lambda_external.sh
Adam Moussa e4982b87ad
feat(terraform): migrate forgejo to HCP Terraform (PLAT-80) (#100)
* feat(terraform): migrate forgejo to HCP Terraform

Move the prod host onto workspace forgejo-prod in the After Hours VPC and freeze CDK push deploys so cutover can happen without applying into seahaven-prod.

* fix(terraform): restore forgejo.db from the dump tarball

Boot restore was copying data/ and repos/ and leaving the sqlite file at the archive root, so a volume restore started Forgejo with no database.
2026-09-29 22:49:21 +00:00

22 lines
496 B
Bash

#!/usr/bin/env bash
# Terraform external data source entrypoint. Stdout must be JSON only.
set -euo pipefail
ROOT="$(cd "$(dirname "$0")" && pwd)"
bash "${ROOT}/build_lambda.sh" >&2
if command -v sha256sum >/dev/null 2>&1; then
SHA=(sha256sum)
else
SHA=(shasum -a 256)
fi
hash="$(
{
find -P "${ROOT}/build/function" -type f -print0 2>/dev/null \
| sort -z \
| xargs -0 "${SHA[@]}"
} | "${SHA[@]}" | awk '{print $1}'
)"
printf '{"status":"ok","hash":"%s"}\n' "${hash}"