Skip to content

Commit 9279aa1

Browse files
committed
fix: don't read outputs for site without components
1 parent d3705ac commit 9279aa1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
kind: Fixed
2+
body: Don't read outputs for site without components
3+
time: 2025-01-21T12:23:20.045132931+01:00

internal/runner/utils.go

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package runner
22

33
import (
44
"context"
5+
"fmt"
56
"github.com/mach-composer/mach-composer-cli/internal/graph"
67
"github.com/mach-composer/mach-composer-cli/internal/utils"
78
"github.com/rs/zerolog/log"
@@ -32,6 +33,18 @@ func terraformCanPlan(ctx context.Context, n graph.Node) (bool, error) {
3233
}
3334

3435
for _, parent := range parents {
36+
if parent.Type() == graph.SiteType {
37+
sp, ok := parent.(*graph.Site)
38+
if !ok {
39+
return false, fmt.Errorf("failed to cast parent to site")
40+
}
41+
42+
if len(sp.NestedNodes) == 0 {
43+
log.Debug().Msgf("site node does not contain components, so no output is available")
44+
continue
45+
}
46+
}
47+
3548
v, err := utils.GetTerraformOutputs(ctx, parent.Path())
3649
if err != nil {
3750
return false, nil

0 commit comments

Comments
 (0)