@@ -71,7 +71,7 @@ func (s *server) loadWorkspaceTags(ctx context.Context, module *tfconfig.Module)
71
71
72
72
for _ , dataResource := range module .DataResources {
73
73
if dataResource .Type != "coder_workspace_tags" {
74
- s .logger .Debug (ctx , "skip resource as it is not a coder_workspace_tags" , "resource_name" , dataResource .Name )
74
+ s .logger .Debug (ctx , "skip resource as it is not a coder_workspace_tags" , "resource_name" , dataResource .Name , "resource_type" , dataResource . Type )
75
75
continue
76
76
}
77
77
@@ -114,6 +114,8 @@ func (s *server) loadWorkspaceTags(ctx context.Context, module *tfconfig.Module)
114
114
if err != nil {
115
115
return nil , xerrors .Errorf ("can't preview the resource file: %v" , err )
116
116
}
117
+ key = strings .Trim (key , `"` )
118
+
117
119
value , err := previewFileContent (tagItem .ValueExpr .Range ())
118
120
if err != nil {
119
121
return nil , xerrors .Errorf ("can't preview the resource file: %v" , err )
@@ -124,14 +126,15 @@ func (s *server) loadWorkspaceTags(ctx context.Context, module *tfconfig.Module)
124
126
}
125
127
}
126
128
}
127
- return workspaceTags , nil // TODO
129
+ return workspaceTags , nil
128
130
}
129
131
130
132
func previewFileContent (fileRange hcl.Range ) (string , error ) {
131
133
body , err := os .ReadFile (fileRange .Filename )
132
134
if err != nil {
133
135
return "" , err
134
136
}
137
+ return string (fileRange .SliceBytes (body )), nil
135
138
136
139
}
137
140
0 commit comments