From d2f439027eb640bf0439e39668e7810970ba527c Mon Sep 17 00:00:00 2001 From: magodo Date: Tue, 27 Feb 2024 13:40:03 +0800 Subject: [PATCH] Fix cross RP parent-child dependency (#505) --- internal/meta/config_info.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/meta/config_info.go b/internal/meta/config_info.go index 1d92a99..f6f4d5f 100644 --- a/internal/meta/config_info.go +++ b/internal/meta/config_info.go @@ -113,6 +113,7 @@ func (cfgs ConfigInfos) AddDependency() error { func (cfgs ConfigInfos) addParentChildDependency() { for i, cfg := range cfgs { parentId := cfg.AzureResourceID.Parent() + // This resource is either a root scope or a root scoped resource if parentId == nil { // Root scope: ignore as it has no parent @@ -121,6 +122,9 @@ func (cfgs ConfigInfos) addParentChildDependency() { } // Root scoped resource: use its parent scope as its parent parentId = cfg.AzureResourceID.ParentScope() + } else if parentId.Parent() == nil { + // The cfg reosurce is the RP 1st level resource, we regard its parent scope as its parent + parentId = cfg.AzureResourceID.ParentScope() } // Adding the direct parent resource as its dependency