proud-painting-63563
09/29/2025, 2:16 PMwhite-vase-18996
09/29/2025, 2:24 PMmodern-spring-15520
09/29/2025, 2:30 PMup on green, run the test that things have switched and, the destroy on bluemodern-spring-15520
09/29/2025, 2:31 PMproud-painting-63563
09/29/2025, 2:42 PMmodern-spring-15520
09/29/2025, 2:54 PMcreate_before_destroy is the defautl with pulumi and you can do local-exec like you mentioned. So as @white-vase-18996 said, if it works in TF, should work here.
But yeah, maybe it gets complicated and a blue green is easer.modern-spring-15520
09/29/2025, 2:56 PMwait_ready = local.Command(
"wait-ready",
create=pulumi.Output.format(
"bash -lc 'until curl -fsS http://{ip}/ready; do sleep 2; done'",
ip=droplet.ipv4_address
),
# Triggers ensure the command re-runs when the new VM changes.
triggers=[droplet.ipv4_address, content_fingerprint.hex],
opts=pulumi.ResourceOptions(depends_on=[droplet])
)proud-painting-63563
09/29/2025, 2:57 PMlively-crayon-44649
09/29/2025, 3:03 PMwhite-vase-18996
09/29/2025, 3:29 PMwhite-vase-18996
09/29/2025, 3:29 PMproud-painting-63563
09/29/2025, 3:30 PMlively-crayon-44649
09/29/2025, 3:34 PMnow supportsYes, indeed. Ugh what a typo.
proud-painting-63563
09/29/2025, 4:10 PMdef _pulumi_program() -> None:
config = pulumi.config.Config()
should_fail = config.require("should_fail") == "true"
software_choice = config.require("software_choice")
if software_choice == "nginx":
user_data = "#!/bin/bash\napt update -y\napt install nginx -y\n"
elif software_choice == "apache":
user_data = "#!/bin/bash\napt update -y\napt install apache2 -y\n"
else:
raise ValueError
# If I change the software choice, I'll get another droplet
def _before_droplet_create(args):
breakpoint()
print("(before_droplet_create) what would I even put here?")
def _after_droplet_create(args):
breakpoint()
print("(after_doomed_at_this_point) I think we're doomed at this point")
if should_fail:
raise Exception("failure triggered")
droplet = Droplet(
resource_name="web-server-droplet",
region=Region.NYC1,
image="ubuntu-24-04-x64",
size=DropletSlug.DROPLET_S1_VCPU2_GB,
user_data=user_data,
opts=ResourceOptions(hooks=ResourceHookBinding(
before_create=[_before_droplet_create],
after_create=[_after_droplet_create],
)))
floating_ip = ReservedIp(resource_name="reserved_ip", droplet_id=droplet.id, region=droplet.region)
pulumi.export("droplet_ip_address", droplet.ipv4_address)
pulumi.export("floating_ip_address", floating_ip.ip_address)white-vase-18996
09/29/2025, 4:41 PMproud-painting-63563
09/29/2025, 4:44 PMechoing-dinner-19531
09/29/2025, 7:05 PMproud-painting-63563
09/30/2025, 12:07 PMechoing-dinner-19531
09/30/2025, 1:16 PMechoing-dinner-19531
09/30/2025, 1:17 PMwhite-vase-18996
10/01/2025, 4:23 PMproud-painting-63563
10/03/2025, 4:49 PM