broad-fall-19241
04/08/2022, 7:24 PMup
got interrupted (can’t recall if it was a network error or if I cancelled w/ Ctrl + C
). This, of course, left some pending_operations
in the state that prevent the use of up
, down
, etc.
Solution Attempt
I tried to solve this the usual way, viz., by exporting the state; clearing the `pending_operations`; and re-importing it. I’m not certain if I’m doing this right, as I wasn’t able to find much documentation on this, but this is how that’s happening:
# EXPORT STATE
# ############
print('Exporting deployment...')
stack_data = stack.workspace.export_stack(stack_name)
with open('stack.json', 'w+') as output:
output.write(str(stack_data))
print('Deployment exported.')
I then modify the stack.json
to remove pending_operations
, and attempt to re-import:
# IMPORT STATE
# ############
print('Importing deployment...')
with open('stack.json', 'r') as stack_data:
deployment = auto._workspace.Deployment(deployment=stack_data.read())
stack.workspace.import_stack(stack_name, deployment)
print('Deployment imported.')
Expected Behavior
I’d expect to see output analogous to that produced by the CLI in this circumstance, namely:
# From: <https://www.pulumi.com/docs/troubleshooting/>
$ pulumi stack export | pulumi stack import
warning: removing pending operation 'creating' on '...' from snapshot
Import successful.
Issue
Instead, I get the following, fairly confusing error:
File "/Users/{SCRUBBED}/env/lib/python3.10/site-packages/pulumi/automation/_cmd.py", line 78, in _run_pulumi_cmd
raise create_command_error(result)
pulumi.automation.errors.CommandError:
code: 255
stdout:
stderr: error: the stack 'dev-3' is too old to be used by this version of the Pulumi CLI
I upgraded the CLI, the pulumi
package, and attempted re-importing an unmodified state file (i.e., export and immediately import, without making changes to pending_operations
), to no avail.
I’m not sure where to look for information on the error code or where this comes from, and I found no hints after examining the source.
Any input would be much appreciated — I’d rather not tear down the stack out-of-band just to recreate it (and maybe hit the same issue anyway).
Thanks in advance!great-queen-39697
04/08/2022, 8:50 PMTF_LOG=TRACE pulumi up -v=11 --logflow --logtostderr 2>&1 | tee -a pulumi_log.txt
broad-fall-19241
04/10/2022, 2:03 AMgreat-queen-39697
04/12/2022, 3:15 PM