Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extract/parameter.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func optionalStringEnum[T ~string](block *terraform.Block, key string, def T, va
tyAttr := block.GetAttribute(key)
return "", &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Invalid %q attribute", key),
Summary: fmt.Sprintf("Invalid %q attribute for block %s", key, block.Label()),
Detail: err.Error(),
Subject: &(tyAttr.HCLAttribute().Range),
//Context: &(block.HCLBlock().DefRange),
Expand All @@ -275,7 +275,7 @@ func requiredString(block *terraform.Block, key string) (string, *hcl.Diagnostic

diag := &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Invalid %q attribute", key),
Summary: fmt.Sprintf("Invalid %q attribute for block %s", key, block.Label()),
Detail: fmt.Sprintf("Expected a string, got %q", typeName),
Subject: &(tyAttr.HCLAttribute().Range),
//Context: &(block.HCLBlock().DefRange),
Expand Down Expand Up @@ -393,7 +393,7 @@ func required(block *terraform.Block, keys ...string) hcl.Diagnostics {
r := block.HCLBlock().Body.MissingItemRange()
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: fmt.Sprintf("Missing required attribute %q", key),
Summary: fmt.Sprintf("Missing required attribute %q for block %q", key, block.Label()),
Detail: fmt.Sprintf("The %s attribute is required", key),
Subject: &r,
Extra: nil,
Expand Down
11 changes: 1 addition & 10 deletions workspacetags.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,9 @@ func workspaceTags(modules terraform.Modules, files map[string]*hcl.File) (types
for _, mod := range modules {
blocks := mod.GetDatasByType("coder_workspace_tags")
for _, block := range blocks {
evCtx := block.Context().Inner()

tagsAttr := block.GetAttribute("tags")
if tagsAttr.IsNil() {
r := block.HCLBlock().Body.MissingItemRange()
diags = diags.Append(&hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Missing required argument",
Detail: `"tags" attribute is required by coder_workspace_tags blocks`,
Subject: &r,
EvalContext: evCtx,
})
// Nil tags block is valid, just skip it.
continue
}

Expand Down
Loading