deploy/do: firewall races droplet tag creation, fails first apply on a fresh account #232
Labels
No labels
bug
discussion
duplicate
enhancement
goal
help wanted
horizon:backlog
horizon:governance
horizon:mvp
invalid
operator-decision
question
roadmap
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-platform/mitosis#232
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happens
On a fresh DigitalOcean account (no pre-existing
mitosistag),tofu/terraform applyindeploy/dofails the first time with:digitalocean_firewall.mitosisattaches totags = ["mitosis"]/source_tags = ["mitosis"], but themitosistag only comes into existence implicitly whendigitalocean_droplet.leader(tagged["mitosis"]) is created. There is no dependency between the firewall and the droplet, so they create in parallel and the firewall loses the race — the droplet takes ~30s to create while the firewall POSTs immediately.Reproduction
mitosistag present.cd deploy/do && tofu init && tofu apply -var "ssh_public_key=..."applysucceeds because the droplet (hence the tag) now exists.Observed today on a single-droplet (
ha=false)s-4vcpu-8gb/nyc3deploy fromorigin/main(b0ea45d). Took two applies to converge.Suggested fix
Declare the tag explicitly and depend on it, so it exists before either resource that references it:
Then reference
digitalocean_tag.mitosis.namein the droplet'stagsand the firewall'stags/source_tags(or adddepends_on = [digitalocean_droplet.leader]to the firewall as a minimal fix). An explicitdigitalocean_tagresource is the cleaner, idempotent option and also makesdestroyclean up the tag.Impact
Cosmetic-but-confusing for first-time sovereign deploys: the apply looks like it failed, and the droplet is briefly live with no cloud firewall until the second apply attaches it. Worth fixing so the documented one-command deploy converges in a single
apply.