@@ -43,14 +43,15 @@ type Parser interface {
4343// Note that this only returns the lexical values of the data source, and does not
4444// evaluate variables and such. To do this, see evalProvisionerTags below.
4545// If the provided Parser is nil, a new instance of hclparse.Parser will be used instead.
46- func WorkspaceTags (parser Parser ,module * tfconfig.Module ) (map [string ]string ,error ) {
46+ func WorkspaceTags (ctx context. Context , logger slog. Logger , parser Parser ,module * tfconfig.Module ) (map [string ]string ,error ) {
4747if parser == nil {
4848parser = hclparse .NewParser ()
4949}
5050tags := map [string ]string {}
51-
51+ var skipped [] string
5252for _ ,dataResource := range module .DataResources {
5353if dataResource .Type != "coder_workspace_tags" {
54+ skipped = append (skipped ,strings .Join ([]string {"data" ,dataResource .Type ,dataResource .Name },"." ))
5455continue
5556}
5657
@@ -118,6 +119,7 @@ func WorkspaceTags(parser Parser, module *tfconfig.Module) (map[string]string, e
118119}
119120}
120121}
122+ logger .Debug (ctx ,"found workspace tags" ,slog .F ("tags" ,maps .Keys (tags )),slog .F ("skipped" ,skipped ))
121123return tags ,nil
122124}
123125
@@ -145,18 +147,18 @@ func WorkspaceTagDefaultsFromFile(ctx context.Context, logger slog.Logger, file
145147
146148// This only gets us the expressions. We need to evaluate them.
147149// Example: var.region -> "us"
148- tags ,err = WorkspaceTags (parser ,module )
150+ tags ,err = WorkspaceTags (ctx , logger , parser ,module )
149151if err != nil {
150152return nil ,xerrors .Errorf ("extract workspace tags: %w" ,err )
151153}
152154
153155// To evaluate the expressions, we need to load the default values for
154156// variables and parameters.
155- varsDefaults ,err := loadVarsDefaults (maps .Values (module .Variables ))
157+ varsDefaults ,err := loadVarsDefaults (ctx , logger , maps .Values (module .Variables ))
156158if err != nil {
157159return nil ,xerrors .Errorf ("load variable defaults: %w" ,err )
158160}
159- paramsDefaults ,err := loadParamsDefaults (parser ,maps .Values (module .DataResources ))
161+ paramsDefaults ,err := loadParamsDefaults (ctx , logger , parser ,maps .Values (module .DataResources ))
160162if err != nil {
161163return nil ,xerrors .Errorf ("load parameter defaults: %w" ,err )
162164}
@@ -176,8 +178,6 @@ func WorkspaceTagDefaultsFromFile(ctx context.Context, logger slog.Logger, file
176178}
177179return nil ,xerrors .Errorf ("provisioner tag %q evaluated to an empty value, please set a default value" ,k )
178180}
179- logger .Info (ctx ,"found workspace tags" ,slog .F ("tags" ,evalTags ))
180-
181181return evalTags ,nil
182182}
183183
@@ -224,7 +224,7 @@ func loadModuleFromFile(file []byte, mimetype string) (module *tfconfig.Module,
224224}
225225
226226// loadVarsDefaults returns the default values for all variables passed to it.
227- func loadVarsDefaults (variables []* tfconfig.Variable ) (map [string ]string ,error ) {
227+ func loadVarsDefaults (ctx context. Context , logger slog. Logger , variables []* tfconfig.Variable ) (map [string ]string ,error ) {
228228// iterate through vars to get the default values for all
229229// variables.
230230m := make (map [string ]string )
@@ -238,18 +238,21 @@ func loadVarsDefaults(variables []*tfconfig.Variable) (map[string]string, error)
238238}
239239m [v .Name ]= strings .Trim (sv ,`"` )
240240}
241+ logger .Debug (ctx ,"found default values for variables" ,slog .F ("defaults" ,m ))
241242return m ,nil
242243}
243244
244245// loadParamsDefaults returns the default values of all coder_parameter data sources data sources provided.
245- func loadParamsDefaults (parser Parser ,dataSources []* tfconfig.Resource ) (map [string ]string ,error ) {
246+ func loadParamsDefaults (ctx context. Context , logger slog. Logger , parser Parser ,dataSources []* tfconfig.Resource ) (map [string ]string ,error ) {
246247defaultsM := make (map [string ]string )
248+ var skipped []string
247249for _ ,dataResource := range dataSources {
248250if dataResource == nil {
249251continue
250252}
251253
252254if dataResource .Type != "coder_parameter" {
255+ skipped = append (skipped ,strings .Join ([]string {"data" ,dataResource .Type ,dataResource .Name },"." ))
253256continue
254257}
255258
@@ -296,6 +299,7 @@ func loadParamsDefaults(parser Parser, dataSources []*tfconfig.Resource) (map[st
296299}
297300}
298301}
302+ logger .Debug (ctx ,"found default values for parameters" ,slog .F ("defaults" ,defaultsM ),slog .F ("skipped" ,skipped ))
299303return defaultsM ,nil
300304}
301305