feat(hello): implement PlanForce placeholder to rewrite marker
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user