-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[BUG FIX] - Fixing bug that prevents postgresql_flexible_server_virtu… #28374
base: main
Are you sure you want to change the base?
Conversation
…al_endpoint from being read if replica server fails over and becomes source
Attempting to fix bug #27796 if anyone sees this please let me know if this needs anything further |
anyone? anyone? :) |
Hey @leonrob - i've run CI on the PR and looks like there are a few things that need to be addressed |
Hey @katbyte - is it possible to have someone finish this up as I'm not sure what it needs. I threw this together as a starting point |
Hey @leonrob, thanks for getting this started! Is there any chance you could provide a series of steps to reproduce this? I saw in your issue that it's easy to do but I'm not very familiar with this resource so I'd appreciate any help I can get so I can play with the code you've given and make sure it's working as intended |
Hey yes - what are you looking for? Would a chat conversation be easier by chance? |
Community Note
Description
I originally logged this bug here: #27796
But haven't received a response. So I figured I'd just fix it and see if you guys can work with what I send.
the Read function does not handle the scenario where the source server and replica server roles switch during a failover. This causes Terraform to interpret the resource as missing or changed, leading to an attempt to recreate it.
In the
Read
function:The state.SourceServerId and state.ReplicaServerId are determined based on the response from the Azure API.
If a failover occurs, the source server and replica server may swap roles, but the Read function does not account for this role reversal.
Terraform detects this as a drift from the expected state and plans to recreate the resource.
PR Checklist
For example: “
resource_name_here
- description of change e.g. adding propertynew_property_name_here
”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
azurerm_resource
- support for thething1
property [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #27796
Note
If this PR changes meaningfully during the course of review please update the title and description as required.