Skip to content

Commit fbd5a79

Browse files
authored
stacks: allow removed blocks to target components in nested stacks (#36787)
* stacks: allow removed blocks to target components in nested stacks * make copywrite fix * fix comments
1 parent 79cdadd commit fbd5a79

File tree

25 files changed

+1087
-325
lines changed

25 files changed

+1087
-325
lines changed

internal/rpcapi/stacks.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,13 @@ func stackConfigMetaforProto(cfgNode *stackconfig.ConfigNode, stackAddr stackadd
239239
}
240240

241241
// Currently Components are the only thing that can be removed
242-
for name, rc := range cfgNode.Stack.Removed {
242+
for name, rc := range cfgNode.Stack.Removed.All() {
243243
var blocks []*stacks.FindStackConfigurationComponents_Removed_Block
244244
for _, rc := range rc {
245+
relativeAddress := rc.From.ConfigComponent()
245246
cProto := &stacks.FindStackConfigurationComponents_Removed_Block{
246247
SourceAddr: rc.FinalSourceAddr.String(),
247-
ComponentAddr: stackaddrs.Config(stackAddr, stackaddrs.Component{Name: rc.FromComponent.Name}).String(),
248+
ComponentAddr: stackaddrs.Config(append(stackAddr, relativeAddress.Stack...), relativeAddress.Item).String(),
248249
Destroy: rc.Destroy,
249250
}
250251
switch {
@@ -255,7 +256,8 @@ func stackConfigMetaforProto(cfgNode *stackconfig.ConfigNode, stackAddr stackadd
255256
}
256257
blocks = append(blocks, cProto)
257258
}
258-
ret.Removed[name] = &stacks.FindStackConfigurationComponents_Removed{
259+
relativeAddress := rc[0].From.ConfigComponent()
260+
ret.Removed[name.String()] = &stacks.FindStackConfigurationComponents_Removed{
259261
// in order to ensure as much backwards and forwards compatibility
260262
// as possible, we're going to set the deprecated single fields
261263
// with the first run block
@@ -269,7 +271,7 @@ func stackConfigMetaforProto(cfgNode *stackconfig.ConfigNode, stackAddr stackadd
269271
return stacks.FindStackConfigurationComponents_SINGLE
270272
}
271273
}(),
272-
ComponentAddr: stackaddrs.Config(stackAddr, stackaddrs.Component{Name: rc[0].FromComponent.Name}).String(),
274+
ComponentAddr: stackaddrs.Config(append(stackAddr, relativeAddress.Stack...), relativeAddress.Item).String(),
273275
Destroy: rc[0].Destroy,
274276

275277
// We return all the values here:

0 commit comments

Comments
 (0)