* Delete Before Create This commit implements the full semantics of delete before create. If a resource is replaced and requires deletion before creation, the engine will use the dependency graph saved in the snapshot to delete all resources that depend on the resource being replaced prior to the deletion of the resource to be replaced. * Rebase against master * CR: Simplify the control flow in makeRegisterResourceSteps * Run Check on new inputs when re-creating a resource * Fix an issue where the planner emitted benign but incorrect deletes of DBR-deleted resources * CR: produce the list of dependent resources in dependency order and iterate over the list in reverse * CR: deps->dependents, fix an issue with DependingOn where duplicate nodes could be added to the dependent set * CR: Fix an issue where we were considering old defaults and new inputs inappropriately when re-creating a deleted resource * CR: save 'iter.deletes[urn]' as a local, iterate starting at cursorIndex + 1 for dependency graph
20 lines
810 B
TypeScript
20 lines
810 B
TypeScript
// Copyright 2016-2018, Pulumi Corporation. All rights reserved.
|
|
|
|
import { Resource } from "./resource";
|
|
|
|
// The changing of a.state causes base to be DBR replaced. This in turn
|
|
// causes the deletion of b and c eagerly. However, in this case, resource
|
|
// c does not exist in this file anymore and won't be recreated.
|
|
// The planner should execute these steps (in this exact order):
|
|
// 1. DeleteReplacement Dependent-2
|
|
// 2. DeleteReplacement Dependent
|
|
// 3. DeleteReplacement Base
|
|
// 4. Replace Base
|
|
// 5. CreateReplacement Base
|
|
const a = new Resource("base", { uniqueKey: 1, state: 100 });
|
|
|
|
// 6. Replace Dependent
|
|
// 7. CreateReplacement Dependent
|
|
const b = new Resource("dependent", { state: a.state });
|
|
|
|
// Done. The CLI should correctly recognize resource-2 as deleted and not replaced.
|