-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: Add full subnet group name when prefix is enabled #359
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
Conversation
@@ -1,6 +1,6 @@ | |||
locals { | |||
master_password = var.create_db_instance && var.create_random_password ? random_password.master_password[0].result : var.password | |||
db_subnet_group_name = !var.cross_region_replica && var.replicate_source_db != null ? null : coalesce(var.db_subnet_group_name, module.db_subnet_group.db_subnet_group_id, var.identifier) | |||
db_subnet_group_name = ! var.cross_region_replica && var.replicate_source_db != null ? null : var.create_db_subnet_group ? module.db_subnet_group.db_subnet_group_id : coalesce(var.db_subnet_group_name, var.identifier) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can actually be more succinctly fixed with:
db_subnet_group_name = ! var.cross_region_replica && var.replicate_source_db != null ? null : var.create_db_subnet_group ? module.db_subnet_group.db_subnet_group_id : coalesce(var.db_subnet_group_name, var.identifier) | |
db_subnet_group_name = !var.cross_region_replica && var.replicate_source_db != null ? null : try(module.db_subnet_group.db_subnet_group_id, var.db_subnet_group_name) |
what this does is:
- Try to get the computed subnet group ID, if that fails
- Use the
var.db_subnet_group_name
I can't see a scenario where we don't can get past both the created or provided subnet group names so we can drop the var.identifier
here
@david92rl, any chance you're still looking at this? I'm running into this bug as well. While this is a one-line fix based on the code review, I'm also happy to open a PR against your |
@david92rl, I'm going to give this a go 😃 |
This issue has been resolved in version 4.0.0 🎉 |
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. |
Description
Currently, it's not possible to specify a prefix for the subnet group because
coalesce(var.db_subnet_group_name, module.db_subnet_group.db_subnet_group_id, var.identifier)
will return a simple name even ifdb_subnet_group_use_name_prefix
is set to true.This makes sure we always use the right sunet group id.
Breaking Changes
This is backwards compatible
How Has This Been Tested?
examples/*
projectsUsed the
examples/complete-postgres
example to make sure the db created uses the right subnet group id