summaryrefslogtreecommitdiff
path: root/internal/resource/dir/dir.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/resource/dir/dir.go')
-rw-r--r--internal/resource/dir/dir.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/internal/resource/dir/dir.go b/internal/resource/dir/dir.go
index 8be4395..047a591 100644
--- a/internal/resource/dir/dir.go
+++ b/internal/resource/dir/dir.go
@@ -12,6 +12,7 @@ import (
)
type Dir struct {
+ resource resource.Resource
path string
source string
user string
@@ -192,13 +193,14 @@ func Have(path string, opts ...opt.Option) resource.Resource {
log.Fatalf("failed to apply directory resource %s: %v", path, err)
}
- res := resource.Register("Directory", d.path)
+ d.resource = resource.Register("Directory", d.path,
+ resource.ApplierFunc(func() error { return d.apply() }))
if err := d.apply(); err != nil {
log.Fatalf("failed to apply directory resource %s: %v", path, err)
}
- return res
+ return d.resource
}
func Absent(path string, opts ...opt.Option) resource.Resource {