diff --git a/internal/command/views/hook_json.go b/internal/command/views/hook_json.go index 9f274ce348..f76119fde7 100644 --- a/internal/command/views/hook_json.go +++ b/internal/command/views/hook_json.go @@ -263,10 +263,11 @@ func (h *jsonHook) PostListQuery(id terraform.HookResourceIdentity, results plan json.MessageListResourceFound, result, ) } + h.view.log.Info( fmt.Sprintf("%s: List complete", addr.String()), "type", json.MessageListComplete, - "total", data.LengthInt(), + json.MessageListComplete, json.NewQueryComplete(addr, data.LengthInt()), ) return terraform.HookActionContinue, nil } diff --git a/internal/command/views/json/query.go b/internal/command/views/json/query.go index 1391fc4ebb..6c74da4ec5 100644 --- a/internal/command/views/json/query.go +++ b/internal/command/views/json/query.go @@ -28,6 +28,12 @@ type QueryResult struct { ImportConfig string `json:"import_config,omitempty"` } +type QueryComplete struct { + Address string `json:"address"` + ResourceType string `json:"resource_type"` + Total int `json:"total"` +} + func NewQueryStart(addr addrs.AbsResourceInstance, input_config cty.Value) QueryStart { return QueryStart{ Address: addr.String(), @@ -54,6 +60,14 @@ func NewQueryResult(listAddr addrs.AbsResourceInstance, value cty.Value, generat return result } +func NewQueryComplete(addr addrs.AbsResourceInstance, total int) QueryComplete { + return QueryComplete{ + Address: addr.String(), + ResourceType: addr.Resource.Resource.Type, + Total: total, + } +} + func marshalValues(value cty.Value) map[string]json.RawMessage { if value == cty.NilVal || value.IsNull() { return nil