Skip to content
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

Conversation

fatmcgav
Copy link

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.

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.
@fatmcgav fatmcgav requested review from isaurabhuttam and a team as code owners September 14, 2023 13:35
Gavin Williams and others added 3 commits September 15, 2023 11:09
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`.
@g-awmalik
Copy link
Contributor

/gcbrun

Gavin Williams added 2 commits October 2, 2023 11:44
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.
Copy link

github-actions bot commented Dec 1, 2023

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

@github-actions github-actions bot added the Stale label Dec 1, 2023
@imrannayer imrannayer removed the Stale label Dec 4, 2023
@g-awmalik g-awmalik self-assigned this Jan 2, 2024
@fatmcgav fatmcgav requested a review from imrannayer as a code owner February 5, 2024 17:54
@g-awmalik
Copy link
Contributor

/gcbrun

@g-awmalik
Copy link
Contributor

@fatmcgav - sorry for the delay on this. Can you please sign the CLA?

@fatmcgav
Copy link
Author

fatmcgav commented Feb 5, 2024

@g-awmalik no worries... So I've changed jobs since opening this PR, but will see if can sort the cla out tomorrow 👍

@g-awmalik g-awmalik removed their assignment Feb 20, 2024
Copy link

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

@github-actions github-actions bot added the Stale label Apr 20, 2024
@github-actions github-actions bot closed this Apr 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants