feat(hello): implement PlanForce placeholder to rewrite marker

This commit is contained in:
MDietermann
2026-04-14 21:57:51 +02:00
parent 372a6598fe
commit bd5c34f293
2 changed files with 42 additions and 2 deletions

View File

@@ -4,7 +4,6 @@ package hello
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
@@ -99,5 +98,18 @@ func (m Module) Verify(ctx context.Context) error {
}
func (m Module) PlanForce(ctx context.Context) (module.Plan, error) {
return module.Plan{}, errors.New("PlanForce not implemented")
path, err := m.resolve()
if err != nil {
return module.Plan{}, err
}
return module.Plan{Actions: []module.Action{{
Description: "hello force reapply (rewrite marker " + path + ")",
Kind: module.ActionFileWrite,
Exec: func(ctx context.Context) error {
if err := os.MkdirAll(filepath.Dir(path), 0o755); err != nil {
return err
}
return os.WriteFile(path, []byte(markerContent), 0o644)
},
}}}, nil
}