Your question
We’re running the official Docker image (v0.16.9) on NixOS and manage our config declaratively now - stalwart-cli (1.0.8, installed separately since it’s not in the image) runs apply on every deploy from plan files in git.
What I want is that the same plan converges no matter the current state, empty or already populated. For singletons that’s straightforward, update always works. For non-singletons I’m not sure what the intended pattern is.
destroy {filter} + create is state-independent on its own, but as soon as another object references the one I’m replacing, the destroy gets rejected, e.g.:
destroy failed for id <id>: error: objectIsLinked
Object id: Directory#<id>
Linked by: Authentication#singleton
(That’s just one example - a Directory referenced by Authentication. The same applies to anything referenced by another object.)
Putting the referencing object’s update in the same plan doesn’t help, since apply runs all destroys before the creates/updates, so the link is still there when the destroy fires. And a plain update by id only works if the object already exists, so it isn’t state-independent - it breaks on a fresh server.
I’ve read through these but couldn’t quite work out how this case is meant to be handled:
So for non-singletons that are referenced anywhere, I can’t find a single plan that converges from both states. What’s the recommended way to handle this? Is there ordering control within a plan, a create-or-update behaviour, or is the intended approach to split it into multiple applies (clear the references first, then replace and re-link)?
Thanks.
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on