Skip to content

feat: add identifier prefixes to recreate resources #258

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

nitrocode
Copy link
Member

@nitrocode nitrocode commented Mar 14, 2025

what

  • feat: add cluster identifier prefixes

why

  • We can avoid name conflicts upon recreation by setting the following inputs
    • parameter_group_name_prefix_enabled
    • rds_cluster_identifier_prefix_enabled
    • db_subnet_group_prefix_enabled
  • One downside is that the *_prefix arguments add an additional 27 characters to each resource which can cause errors upon apply due to it exceeding 64 characters
    • For this reason, it may be advisable to NOT use *_prefix and instead use a random string for each of these resource types

references

@nitrocode nitrocode requested review from a team as code owners March 14, 2025 15:29
@mergify mergify bot added the triage Needs triage label Mar 14, 2025
@nitrocode nitrocode force-pushed the identifier_prefix branch 2 times, most recently from 3635adb to 7824d5a Compare March 14, 2025 15:35
@nitrocode nitrocode added minor New features that do not break anything and removed triage Needs triage labels Mar 14, 2025
@nitrocode
Copy link
Member Author

/terratest

identifier = "${module.rds_identifier[0].id}-${count.index + 1}"
count = local.cluster_instance_count

identifier_prefix = var.rds_cluster_identifier_prefix_enabled ? "${module.rds_identifier[0].id}${module.this.delimiter}${count.index + 1}${module.this.delimiter}" : null
Copy link
Contributor

Choose a reason for hiding this comment

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

The unique name for the aws_rds_cluster_instance should be controlled by the random_pet that feeds into the module.rds_identifier. Why is that not working here?

Copy link
Member Author

Choose a reason for hiding this comment

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

How do you know it's not working?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I see what you're saying. The random pet does go into the rds_identifier. Hmm, maybe I'm not using it correctly

Copy link
Contributor

Choose a reason for hiding this comment

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

@nitrocode there is some history here, I made some changes in #236 but after some FUD some of the changes were taken out in #242. You would probably need to add cluster_identifier back into the random_pet to get the features you want.

@nitrocode nitrocode changed the title feat: add cluster identifier prefixes feat: add identifier prefixes to recreate resources Mar 14, 2025
@nitrocode nitrocode marked this pull request as draft March 14, 2025 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cannot recreate database instance due to create_before_destroy set to true on the cluster instance
2 participants