Pulumi: Allow `pulumi state delete` to proceed even in case of snapshot integrity failure

Created on 8 Jul 2020  路  5Comments  路  Source: pulumi/pulumi

Problem

A user's state file can occasionally get into a bad _state_ (e.g. https://github.com/pulumi/pulumi/issues/3583) and must be fixed either with pulumi state delete ... or through manual changes. Unfortunately, some bad states prevent pulumi state delete ... from functioning (such as the error below and linked issue) and the user must resort to manual editing the state file which is error-prone.

Example snapshot integrity failure error

% pulumi state delete 'urn:pulumi:dev::p-parent-delete-test-::aws:s3/bucket:Bucket$aws:s3/bucket:Bucket::child'
error: .pulumi/stacks/dev.json: snapshot integrity failure; refusing to use it: child resource urn:pulumi:dev::p-parent-delete-test-::aws:s3/bucket:Bucket$aws:s3/bucket:Bucket::child refers to missing parent urn:pulumi:dev::p-parent-delete-test-::aws:s3/bucket:Bucket::parent

Suggestions for a fix

Allow pulumi state delete ... to still proceed when a user's state is in a "snapshot integrity failure" _state_ as this is safer than the user manually editing the state file.

Update: As @joeduffy pointed out this is available via --disable-integrity-checking, but we should make this an interactive prompt rather than a flag so that the user knows this is an option.

Understandably, this might not be feasible in all cases (invalid JSON), but some cases like this should still be allowed.

Most helpful comment

Does --disable-integrity-checking work around this?

All 5 comments

Does --disable-integrity-checking work around this?

Does --disable-integrity-checking work around this?

Only if you know that option exists! 馃う

Thanks! That indeed allows the pulumi state delete command to proceed and fix the state. Closing this.

_Actually_, I'm going to reopen this. That option is indeed available via pulumi state delete --help but I feel the user experience could be better here.

We prompt the user聽interactively before proceeding with the pulumi state delete. We should also make the disable-integrity-checking functionality interactive so that it's more discoverable for the end user.

Agree, might also be nice for integrity errors to mention the flag.

Agree, might also be nice for integrity errors to mention the flag.

Yep, that would work too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

komalali picture komalali  路  4Comments

mazamats picture mazamats  路  3Comments

clstokes picture clstokes  路  3Comments

joeduffy picture joeduffy  路  5Comments

clstokes picture clstokes  路  3Comments