Self-heal Discord role sync on refresh
When a member wasn't in the guild at create() time (or drifted afterwards), read() only reported the drift. Pulumi would not trigger update() because the inputs hadn't changed, so the member stayed permanently out of sync. Call syncMemberRoles() directly from read() when drift is detected so roles are applied on the next refresh without needing an input change.
This commit is contained in:
parent
183e9db575
commit
c193ff654b
1 changed files with 7 additions and 4 deletions
|
|
@ -378,14 +378,17 @@ const discordMemberRoleSyncProvider: pulumi.dynamic.ResourceProvider = {
|
|||
Array.from(currentRoles).some((r) => managedRoles.has(r) && !expectedRoles.has(r));
|
||||
|
||||
if (outOfSync) {
|
||||
// Return current state but note it needs update
|
||||
// Self-heal: apply the expected roles now. Without this, refresh would
|
||||
// only observe drift, and since inputs are unchanged Pulumi would never
|
||||
// trigger update() — leaving members who joined after create() stuck.
|
||||
const { addedRoles, removedRoles, memberNotFound } = await syncMemberRoles(props);
|
||||
return {
|
||||
id,
|
||||
props: {
|
||||
...props,
|
||||
addedRoles: [],
|
||||
removedRoles: [],
|
||||
memberNotFound: false,
|
||||
addedRoles,
|
||||
removedRoles,
|
||||
memberNotFound,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue