New returns a new instance of Parser, as well as any diagnostics encountered while parsing the module.
(workdir string, opts ...Option)
| 58 | // New returns a new instance of Parser, as well as any diagnostics |
| 59 | // encountered while parsing the module. |
| 60 | func New(workdir string, opts ...Option) (*Parser, tfconfig.Diagnostics) { |
| 61 | p := Parser{ |
| 62 | logger: slog.Make(), |
| 63 | underlying: hclparse.NewParser(), |
| 64 | workdir: workdir, |
| 65 | module: nil, |
| 66 | } |
| 67 | for _, o := range opts { |
| 68 | o(&p) |
| 69 | } |
| 70 | |
| 71 | var diags tfconfig.Diagnostics |
| 72 | if p.module == nil { |
| 73 | m, ds := tfconfig.LoadModule(workdir) |
| 74 | diags = ds |
| 75 | p.module = m |
| 76 | } |
| 77 | |
| 78 | return &p, diags |
| 79 | } |
| 80 | |
| 81 | // WorkspaceTags looks for all coder_workspace_tags datasource in the module |
| 82 | // and returns the raw values for the tags. It also returns the set of |
no outgoing calls