-
Notifications
You must be signed in to change notification settings - Fork 426
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
fix: Don't require var.zone
for read_replica
instances
#513
fix: Don't require var.zone
for read_replica
instances
#513
Conversation
Currently, a value is required for either `var.read_replicas[replica]["zone"]` or `var.zone` as a fallback. This commit tweaks that behaviour to use _either_ `var.zone` or a random available zone as the fallback. Backwards compatibility should be retained, as `local.zone` already prefers the value of `var.zone` over a random available zone. Also worth noting that `local.zone` is already used in the `location_preference {}` block.
The `lookup()` func was causing errors such as `Invalid value for "str" parameter: argument must not be null.` on the `region` and `encryption_key_name` fields. I believe this is related to hashicorp/terraform#32157. By switching to `coalesce()`, the first non-null value will be returned, which I believe is the intended behaviour with the previous `lookup()` usage.
This mirrors the API behaviour, and fixes an issue with the `coalesce()` function not finding a value for `edition`.
/gcbrun |
This avoids a constant flapping reported by Terraform if the variable default is `ENTERPRISE`.
With a count that depends on `var.zone`, I was getting the following error: ``` The "count" value depends on resource attributes that cannot be determined until apply, so Terraform cannot predict how many instances will be created. ``` Update references to use resource without the count index.
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
/gcbrun |
@fatmcgav - sorry for the delay on this. Can you please sign the CLA? |
@g-awmalik no worries... So I've changed jobs since opening this PR, but will see if can sort the cla out tomorrow 👍 |
This PR is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days |
Currently, a value is required for either
var.read_replicas[replica]["zone"]
orvar.zone
as a fallback.This commit tweaks that behaviour to use either
var.zone
or a randomavailable zone as the fallback.
Backwards compatibility should be retained, as
local.zone
alreadyprefers the value of
var.zone
over a random available zone.Also worth noting that
local.zone
is already used in thelocation_preference {}
block.