Skip to content

Add policy pack: Enforce Automated Backup Retention Period for AWS RDS DB Instances #949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rajlearner17
Copy link
Contributor

No description provided.

@rajlearner17 rajlearner17 requested review from Copilot and vkumbha July 11, 2025 16:03
@rajlearner17 rajlearner17 changed the title Add policy pack: Enforce Backup Automated Retention Period for AWS RDS DB Instances Add policy pack: Enforce Automated Backup Retention Period for AWS RDS DB Instances Jul 11, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a new Turbot policy pack to enforce a minimum automated backup retention period on AWS RDS DB instances.
Key changes:

  • Defined Terraform variables and provider configuration for the new policy pack.
  • Created policy settings resources to check/enforce retention period and retention days.
  • Added a README with usage instructions and examples.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
variables.tf Introduce test_resource_id variable (commented default)
providers.tf Configure the Turbot provider requirement
policies.tf Add two turbot_policy_setting resources for backup retention
main.tf Define turbot_policy_pack and a conditional attachment resource
README.md Document usage, testing instructions, and enforcement guidance
Comments suppressed due to low confidence (1)

policy_packs/aws/rds/enforce_backup_retention_period_for_db_instances/main.tf:7

  • [nitpick] The comment instructs to uncomment the attachment block, but the turbot_policy_pack_attachment resource is already active (via count). Either comment out the block by default or update the instruction to reflect the current conditional setup.
# To test this policy pack by attaching it to a specific resource, uncomment the block below and provide a valid resource ID.

variable "test_resource_id" {
description = "The Turbot resource ID to attach the policy pack to for testing."
type = string
# default = "1234567891234567"
Copy link
Preview

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

The test_resource_id variable has no default, making it required on every run. Consider uncommenting or adding default = "" so that the test attachment block is optional without forcing a value.

Suggested change
# default = "1234567891234567"
default = ""

Copilot uses AI. Check for mistakes.

resource "turbot_policy_setting" "backup_retention_days" {
resource = turbot_policy_pack.enforce_backup_retention_period_for_db_instances.id
type = "tmod:@turbot/aws-rds#/policy/types/dbInstanceBackupRetentionPeriodDays"
value = 7
Copy link
Preview

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

[nitpick] The retention days value is hardcoded to 7. It would be more flexible to introduce a variable (e.g., min_backup_retention_days) so this can be adjusted without code changes.

Copilot uses AI. Check for mistakes.

terraform apply -var="test_resource_id=358605999151417"
terraform destroy -var="test_resource_id=358605999151417"
```
**NOTE** This is commented out by default and can be used based in need.
Copy link
Preview

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

Minor grammar: consider changing based in need to as needed for clarity.

Suggested change
**NOTE** This is commented out by default and can be used based in need.
**NOTE** This is commented out by default and can be used as needed.

Copilot uses AI. Check for mistakes.

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.

1 participant