Hi everyone! I'm relatively new to Pulumi and ran...
# general
p
Hi everyone! I'm relatively new to Pulumi and ran into an issue with left over pending_operations. I have fixed them in the past but when reading up more on how to do it "correctly" I ran across what I think is conflicting instructions. "pulumi up" tells me that I need to look for any completed operations on AWS and then clear them from pending_operations, see attached image with my yellow highlight. It doesn't say what to do with uncompleted operations though...? The online documentation however says that I should clear the pending_operations and then for each item in it look for it on AWS and remove it:
Copy code
You should then export and import your stack. This will clear your state's stack of all pending operations.
[...]
For every [pending_operation] you should verify with your cloud provider whether or not this operation was successful. If the operation was successful, and a resource was created, you should delete that resource using your cloud provider's console, CLI, or SDK.
https://www.pulumi.com/docs/troubleshooting/#interrupted-update-recovery To me this sounds like one source saying I should remove any created resources listed in pending_operations while the other source says that I should leave them be. Or am I misreading it?
b
you should only leave them there if the resource is in the middle of creating and hasn't completed yet. Ultimately, the way to fix pending_operations is to remove them from your state
p
But that isn't what the online documentation says? "If the operation was successful, and a resource was created, you should delete that resource using your cloud provider's console, CLI, or SDK."
Also, the output from "pulumi up" specifically says to check if "operations listed completed successfully", not just "completed". It however also doesn't say what to do if they haven't completed successfully. In my case I can't find the resources at all on AWS so I guess it failed creating them. So what then?
Oh, I probably misinterpreted your reply @billowy-army-68599. By "only leave them there" were you refering to the AWS resource and not pending_operations? So I should always remove them from AWS (after possibly waiting for them to complete first), then clear pending_operations and import that. The online docs then says you should run a pulumi refresh, but the output from "up" does not. Is it always needed?
b
if you end up with pending operations, you need to do the following: • check the resource exists in AWS • check your pulumi state to see if the resource exists there if the two match, remove the pending operation if the two do not match, make them match (either by removing the AWS resource to match the state, or very rarely modifying the state to match the AWS resource) and then remove the pending operation
if the docs aren't clear on that, please let me know where the confusion is so I can fix it
the last point there is the least obvious, and can sometimes mean running a refresh, modifying the state manually, but I find it's easiest to just remove the pending operation and run a pulumi refresh
p
Thanks! I think the most confusing part is what I mentioned in the start, the instructions in the docs and "pulumi up" doesn't seem to match, at least not for a novice. To clear things up, I have assumed that a "create" operation in pending_operations is not included in the State yet, correct? So that would mean that the normal route would be to remove those resources from AWS (if they have been created at all) and then remove them from pending_operations. That is how I read the online documentations, but the "remove from cloud provider" part is not at all mentioned in the instructions outputed from "pulumi up".
b
it sounds like we can definitely make some improvements here, I'll file an issue for this, appreciate the feedback!
❤️ 1
e
p
Thanks @echoing-dinner-19531 for the link. I had already read through all the posts before asking here and one of the reasons is that many of the comments on "this is how I do it" simply involves cleaning out the pending_operations and not checking for orphaned resources on AWS.