Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Terraform

HungryHub manages all AWS infrastructure as code using Terraform in the hungryhub-terraform repository.

For the full architecture, module map, secrets management, and operations guide see: hungryhub-terraform — Architecture and Operations

Quick reference

GitHub → hungryhub-terraform → Actions → "Terraform Plan/Apply" → Run workflow
  module:      e.g. hungryhub-apps
  environment: dev | prod
  action:      plan | apply

Run locally (emergency / one-off)

aws sts get-caller-identity --profile prod   # confirm correct account

./build.sh plan  prod hungryhub-apps         # plan only
./build.sh apply prod hungryhub-apps         # apply

Add a new environment variable to hh-server

  1. Declare it in hungryhub-apps/variable.tf.
  2. Add the value to AWS Secrets Manager:
    aws secretsmanager get-secret-value \
      --secret-id terraform/tfvars/prod/<suffix> \
      --profile prod --region ap-southeast-1 \
      --query SecretString --output text | \
    python3 -c "import json,sys; d=json.load(sys.stdin); d['MY_VAR']='value'; print(json.dumps(d))" | \
    aws secretsmanager put-secret-value \
      --secret-id terraform/tfvars/prod/<suffix> \
      --profile prod --region ap-southeast-1 \
      --secret-string file:///dev/stdin
    
  3. Reference it in hungryhub-apps/configmap.tf.
  4. Open a PR — CI will plan automatically; apply after merge.