special case allowing duplicate URNs for stack references
This commit is contained in:
parent
15418b6789
commit
2e0a8c0dc3
|
@ -57,7 +57,7 @@ func makeResourceTreeMap(source []*resource.State) (*Resource, map[resource.URN]
|
|||
for _, state := range source {
|
||||
stack = state.URN.Stack()
|
||||
proj = state.URN.Project()
|
||||
if !state.Delete {
|
||||
if !state.Delete && state.URN.Type() != "pulumi:pulumi:StackReference" {
|
||||
// Only include resources which are not marked as pending-deletion.
|
||||
contract.Assertf(resources[state.URN] == nil, "Unexpected duplicate resource %s", state.URN)
|
||||
resources[state.URN] = &Resource{
|
||||
|
|
|
@ -280,7 +280,7 @@ func buildResourceMap(prev *Snapshot, preview bool) ([]*resource.State, map[reso
|
|||
}
|
||||
|
||||
urn := oldres.URN
|
||||
if olds[urn] != nil {
|
||||
if olds[urn] != nil && urn.Type() != "pulumi:pulumi:StackReference" {
|
||||
return nil, nil, errors.Errorf("unexpected duplicate resource '%s'", urn)
|
||||
}
|
||||
olds[urn] = oldres
|
||||
|
|
|
@ -186,7 +186,7 @@ func (snap *Snapshot) VerifyIntegrity() error {
|
|||
}
|
||||
}
|
||||
|
||||
if _, has := urns[urn]; has && !state.Delete {
|
||||
if _, has := urns[urn]; has && !state.Delete && urn.Type() != "pulumi:pulumi:StackReference" {
|
||||
// The only time we should have duplicate URNs is when all but one of them are marked for deletion.
|
||||
return errors.Errorf("duplicate resource %s (not marked for deletion)", urn)
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ func (se *stepExecutor) executeStep(workerID int, step Step) error {
|
|||
if err == nil {
|
||||
// If we have a state object, and this is a create or update, remember it, as we may need to update it later.
|
||||
if step.Logical() && step.New() != nil {
|
||||
if prior, has := se.pendingNews.Load(step.URN()); has {
|
||||
if prior, has := se.pendingNews.Load(step.URN()); has && step.URN().Type() != "pulumi:pulumi:StackReference" {
|
||||
return errors.Errorf(
|
||||
"resource '%s' registered twice (%s and %s)", step.URN(), prior.(Step).Op(), step.Op())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue