Skip to content

Enable DDL logging for Aurora DBs - #2330

Open
whi-tw wants to merge 1 commit into
mainfrom
enable-database-logging
Open

whi-tw wants to merge 1 commit into
mainfrom
enable-database-logging

Conversation

@whi-tw

@whi-tw whi-tw commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

What problem does this pull request solve?

Trello card: https://trello.com/c/nX2BlJtT/3330-enable-logging-for-our-databases

Audit-level logging for schema changes only

Things to consider when reviewing

  • Ensure that you consider the wider context.
  • Does it work when run on your machine?
  • Is it clear what the code is doing?
  • Do the commit messages explain why the changes were made?
  • Are there all the unit tests needed?
  • Has all relevant documentation been updated?

Reminders

If you've made changes to the deployer role (files in modules/deployer-access):

  • Remember to run make <environment> forms/account apply on the relevant environments (dev, staging and/or prod)
  • Check the #govuk-forms-deployment-notifications Slack channel to ensure the apply-forms-terraform-<environment> pipelines have run successfully

Copilot AI balanced review requested due to automatic review settings October 20, 2026 09:29

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Deployment permissions are missing, and the logging configuration does not ensure that exported content excludes user data and credentials.

3 open issues
What changed in this PR

Enables DDL statement logging for Aurora PostgreSQL databases through the shared RDS module.

Changes:

  • Sets log_statement to ddl with immediate application.
  • Exports PostgreSQL logs to CloudWatch with 30-day retention.
  • Creates the log group before enabling cluster exports.
File Description
infra/​modules/​rds/​rds.tf Configures DDL logging, CloudWatch export, retention, and resource ordering.

Review effort: Balanced

Comment thread infra/modules/rds/rds.tf
Comment on lines +24 to +25
name = "log_statement"
value = "ddl"
Comment thread infra/modules/rds/rds.tf
#checkov:skip=CKV_AWS_158:The log group is already using the default key, which is sufficient

# RDS writes to a log group with this exact name when log exports are enabled
name = "/aws/rds/cluster/aurora-v2-cluster-${var.identifier}/postgresql"
Comment thread infra/modules/rds/rds.tf

enable_http_endpoint = true

enabled_cloudwatch_logs_exports = ["postgresql"]
@whi-tw
whi-tw requested a review from theseanything October 22, 2026 09:00

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants