Skip to content

feat: Change final_snapshot_identifier when snapshot_identifier changes #591

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

Merged
merged 1 commit into from
Apr 21, 2025

Conversation

vincentclee
Copy link
Contributor

@vincentclee vincentclee commented Apr 4, 2025

Description

This change modifies the random_id.snapshot_identifier resource to include var.snapshot_identifier in the keepers block. This ensures that when the snapshot_identifier input changes, a new final_snapshot_identifier is generated accordingly.

Motivation and Context

Previously, changes to the snapshot_identifier input did not trigger regeneration of the final snapshot identifier. This could lead to the DBSnapshotAlreadyExists error during the deletion of a DB instance. Including snapshot_identifier in the keepers ensures the final snapshot is uniquely tied to the correct input, improving consistency and reliability.

Breaking Changes

No, this change is backward compatible with existing configurations. However, users should be aware that any change to the snapshot_identifier input will now result in a new final_snapshot_identifier.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

Run 0

module "database" {
  source = "../../terraform-aws-rds-vincentclee"

  identifier = "vlee"
...
}

Run 1

module "database" {
  source = "../../terraform-aws-rds-vincentclee"

  identifier          = "vlee"
  snapshot_identifier = "final-vlee-ebd61569"
...
}

Run 2

module "database" {
  source = "../../terraform-aws-rds-vincentclee"

  identifier          = "vlee"
  snapshot_identifier = "final-vlee-5f3f46f8"
...
}

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

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

seems reasonable, thanks

@bryantbiggs bryantbiggs merged commit 9122d19 into terraform-aws-modules:master Apr 21, 2025
27 checks passed
antonbabenko pushed a commit that referenced this pull request Apr 21, 2025
## [6.12.0](v6.11.0...v6.12.0) (2025-04-21)

### Features

* Change `final_snapshot_identifier` when `snapshot_identifier` changes ([#591](#591)) ([9122d19](9122d19))
@antonbabenko
Copy link
Member

This PR is included in version 6.12.0 🎉

Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 22, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants