pulumi / pulumi-pulumiservice

https://pulumi.com
Apache License 2.0
13 stars 7 forks source link

TTLschedule Resource can't be deleted when TTL schedule runs #451

Open MitchellGerdisch opened 19 hours ago

MitchellGerdisch commented 19 hours ago

What happened?

If you deploy a stack that manages it's own TTL schedule, when deployments runs the schedule, the TTL schedule is removed from the service, and pulumi's attempt to delete the TTL schedule as part of the destroy that occurs fails with an error like: error: failed to delete schedule with scheduleId 354e68ed-1f04-4565-bff9-1f4da1703e26 : 404 API error: Not Found: ScheduledAction '354e68ed-1f04-4565-bff9-1f4da1703e26' not found

This may be due to a change in Pulumi Cloud itself since this did not happen as recently as 10 days ago.

Example

Set up a stack with a deployment configured. Then use code like the following to manage it's TTL schedule such that the schedule runs and see it fail.

import pulumi_pulumiservice as pulumiservice

ttlsched = pulumiservice.TtlSchedule("ttlsched", pulumiservice.TtlScheduleArgs(
    organization=pulumi.get_organization(),
    project=pulumi.get_project(),
    stack=pulumi.get_stack(),
    timestamp="2025-01-01T00:00:00Z"),
    opts=pulumi.ResourceOptions(retain_on_delete=True)
)

Output of pulumi about

CLI
Version 3.139.0 Go Version go1.23.3 Go Compiler gc

Plugins KIND NAME VERSION resource pulumiservice 0.27.1 language python unknown

Host
OS darwin Version 15.1 Arch x86_64

Backend
Name pulumi.com

Dependencies: NAME VERSION netaddr 1.3.0 pip 24.0 pulumi_aws 6.61.0 setuptools 65.5.0

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

MitchellGerdisch commented 19 hours ago

Maybe related to https://github.com/pulumi/pulumi-pulumiservice/issues/449

MitchellGerdisch commented 19 hours ago

This can be worked around by using the retainOnDelete resource option. But, it does cause issues if the stack is destroyed and updated before the TTL schedule runs since it'll create additional TTL schedules.