Skip to content

Conversation

georeeve
Copy link
Contributor

@georeeve georeeve commented Apr 4, 2025

Issue # (if applicable)

Closes #34050.

Reason for this change

Allows Backup indexes to be configured on specific resource types.

Description of changes

I have matched the CFN schema by creating BackupPlanIndexActionProps and IndexActionResourceType. I'm not sure if it makes sense for indexActions to be an array in its current state, but that's what CFN requires and maybe additional features are planned to utilise multiple actions.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

I have added a unit test, updated the backup integ test and deployed to verify the changes in the AWS console.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Apr 4, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team April 4, 2025 14:25
@github-actions github-actions bot added feature-request A feature should be added or improved. p2 labels Apr 4, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@georeeve georeeve changed the title feat(aws-backup): add indexActions prop to BackupPlanRule feat(backup): add indexActions prop to BackupPlanRule Apr 4, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 4, 2025 14:27

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 4, 2025
@godwingrs22 godwingrs22 self-assigned this May 26, 2025
Comment on lines 87 to 93

/**
* To help search your backups, you can enable Backup indexes by assigning index actions.
*
* @default - no index actions.
*/
readonly indexActions?: BackupPlanIndexActionProps[];
Copy link
Member

Choose a reason for hiding this comment

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

Based on the CloudFormation documentation, IndexActions can have either 0 or 1 per backup rule - this limitation should be added to the property's documentation string. Since CloudFormation defines IndexAction as an array, I think we could flatten the L2 property with enum IndexAction to make the API more intuitive, while keeping it as an array. Though AWS Backup currently accepts only 1 index action per backup rule, using array of enum would be more future-proof I assume if AWS later supports multiple index actions

plan.addRule(new backup.BackupPlanRule({
  indexActions: [backup.IndexAction.S3]
}));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@godwingrs22 I guess my only concern with flattening it is if they're planning to add more props other than ResourceTypes in the future, which perhaps is why it's an array currently? I agree that in its current state it probably doesn't need to have any arrays at all and we could probably get away with indexAction: backup.IndexAction.S3, but if they add another prop then we'd have to make quite a big change and implement something like indexActionsV2.

Whereas with the current implementation, if they add a new prop then we'd only need to add that to the BackupPlanIndexActionProps type.

Currently

indexActions: [{
     resourceTypes: [backup.IndexActionResourceType.S3],
 }],

Hypothetical future prop

indexActions: [
  {
       resourceTypes: [backup.IndexActionResourceType.S3, backup.IndexActionResourceType.EBS],
       xyzProp: true,
   },
  {
       resourceTypes: [backup.IndexActionResourceType.XYZ],
       xyzProp: false,
   },
],

I guess is a bit more simplicity now worth a potential rewrite in the future?

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 437e808
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@godwingrs22 godwingrs22 removed their assignment Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK feature-request A feature should be added or improved. p2 pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

(aws-backup): Add IndexActions support to BackupPlanRule

3 participants