Improve database Module#2810
Conversation
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughEnables RDS deletion protection via a new variable, changes db_skip_final_snapshot and secret_recovery_window_in_days defaults, wires the new inputs into the staging database module, and flips create_rds_proxy to true in staging. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (1)📓 Common learnings🔇 Additional comments (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
infrastructure/modules/database/main.tf (1)
44-44: Consider making deletion_protection configurable via variable.While hardcoding
deletion_protection = trueenhances safety, it may hinder testing workflows where rapid teardown/rebuild is needed. Combined withdb_skip_final_snapshot = false, destroying the RDS instance requires manual intervention (disabling deletion protection via console/CLI).Based on learnings, this infrastructure is used for quick testing purposes. Consider exposing this as a variable with a sensible default:
+variable "db_deletion_protection" { + description = "Enables deletion protection for the RDS instance." + type = bool + default = true +}- deletion_protection = true + deletion_protection = var.db_deletion_protectionThis allows testing environments to optionally disable protection while keeping the safe default.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
infrastructure/modules/database/main.tf(1 hunks)infrastructure/modules/database/variables.tf(2 hunks)infrastructure/staging/main.tf(1 hunks)infrastructure/staging/terraform.tfvars.example(1 hunks)infrastructure/staging/variables.tf(2 hunks)
🧰 Additional context used
🧠 Learnings (4)
📓 Common learnings
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2178
File: frontend/src/app/snapshots/[id]/page.tsx:0-0
Timestamp: 2025-09-21T17:04:48.154Z
Learning: User rudransh-shrivastava confirmed that suggested type safety improvements during Apollo Client migration were no longer relevant, reinforcing their preference to keep migration PRs focused on core migration changes rather than additional improvements.
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2431
File: infrastructure/modules/database/main.tf:22-60
Timestamp: 2025-10-17T15:25:53.713Z
Learning: The infrastructure code in the `infrastructure/` directory is intended for quick testing purposes only, not production-grade deployment. Production-grade security hardening controls (such as IAM database authentication, deletion protection, Performance Insights KMS encryption) are not required for this testing infrastructure.
📚 Learning: 2025-11-08T11:16:25.725Z
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2551
File: infrastructure/modules/parameters/main.tf:1-191
Timestamp: 2025-11-08T11:16:25.725Z
Learning: The parameters module in infrastructure/modules/parameters/ is currently configured for staging environment only. The `configuration` and `settings_module` variables default to "Staging" and "settings.staging" respectively, and users can update parameter values via the AWS Parameter Store console. The lifecycle.ignore_changes blocks on these parameters support manual console updates without Terraform reverting them.
Applied to files:
infrastructure/staging/terraform.tfvars.example
📚 Learning: 2025-11-23T11:52:15.463Z
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2699
File: backend/wsgi.py:13-13
Timestamp: 2025-11-23T11:52:15.463Z
Learning: In the OWASP Nest project, the SSM parameter store setup in backend/wsgi.py (using boto3 to fetch parameters from AWS Systems Manager) is designed for staging and production environments, not just for testing purposes.
Applied to files:
infrastructure/staging/terraform.tfvars.example
📚 Learning: 2025-10-17T15:25:53.713Z
Learnt from: rudransh-shrivastava
Repo: OWASP/Nest PR: 2431
File: infrastructure/modules/database/main.tf:22-60
Timestamp: 2025-10-17T15:25:53.713Z
Learning: The infrastructure code in the `infrastructure/` directory is intended for quick testing purposes only, not production-grade deployment. Production-grade security hardening controls (such as IAM database authentication, deletion protection, Performance Insights KMS encryption) are not required for this testing infrastructure.
Applied to files:
infrastructure/modules/database/main.tf
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Run frontend e2e tests
🔇 Additional comments (5)
infrastructure/modules/database/variables.tf (2)
70-74: LGTM! Default changed to create final snapshots.The change from
truetofalseensures that a final snapshot is created before database deletion, aligning with the PR objectives and providing better data protection.
107-111: LGTM! Recovery window added for safer secret deletion.The default of 7 days provides a recovery window before permanent secret deletion, improving safety over immediate deletion (0 days). This aligns with the PR objectives.
infrastructure/staging/main.tf (1)
34-53: LGTM! Variable properly wired to module.The
secret_recovery_window_in_daysvariable is correctly passed from the staging configuration to the database module, completing the integration of the new parameter.infrastructure/staging/variables.tf (2)
13-17: LGTM! RDS proxy enabled by default in staging.The default change from
falsetotrueenables RDS proxy for staging deployments. While not explicitly mentioned in the PR objectives, this aligns with the staging infrastructure improvements and RDS proxy configuration seen throughout the PR.
132-136: LGTM! Variable properly defined with safe default.The new variable correctly implements the PR objective to default the recovery window to 7 days, providing a safety net before permanent secret deletion.
|



Resolves #2778
Proposed change
db_skip_final_snapshottofalseby default.secret_recovery_window_in_daysto7by default.Checklist
make check-testlocally; all checks and tests passed.