mirror of https://github.com/pulumi/pulumi.git
1a1ba03925
Fixes pulumi/pulumi#1626. This commit obviates the need to invalidate and re-validate snapshots as they are mutated, which in turn allows for correctness when there are multiple snapshot mutations active at a time. The crux of this commit is that the SnapshotManager will, at the start of a mutating operation, write the resource into the snapshot before the operation has begun, but with a non-empty "status". At the end of the operation, the SnapshotManager will (depending on the outcome of the step) remove the "status" field. The general idea here is that a resource will have a non-empty "status" field if there is a resource operation currently in-flight. The precise semantics here are different for each kind of step: * `CreateStep` - SnapshotManager inserts a new node into the snapshot containing the inputs of the resource being created. This node has status "creating". If the step succeeds, the "status" field is cleared. If the step fails, the entire resource is removed from the snapshot. * `UpdateStep` - SnapshotManager inserts a new node into the snapshot containing the inputs of the resource being updated. This node has status "updating". If the step succeeds, the "status" field is cleared on the new resource and the old resource is removed from the snapshot. If the tep fails, the entire new resource is removed from the snapshot. * `ReadStep` - SnapshotManager inserts a new node into the snapshot containing the search inputs to `read`. This node has status "reading". If the step succeeds, the existing resource being read over is removed (if one exists) and the new resource's "status" field is cleared. If the step fails, the entire new resource is removed from the snapshot. * `DeleteStep` - SnapshotManager sets the "status" field of the resource being deleted to "deleting". If the step suceeds, the resource is removed from the snapshot. If the step fails, the resource's "status" field is cleared. As part of this commit, the engine will reject any snapshot that has a resource within it with the "status" field set. Running "pulumi stack import" on a stack with invalid resources in it will remove those resources from the snapshot. |
||
---|---|---|
.. | ||
integration | ||
main_test.go | ||
new_test.go | ||
stack_test.go |