validate: add `Diagnostic.Address` (#204)
This change maps `Diagnostic.Address` from `terraform validate -json` to a Go struct field.
diff --git a/validate.go b/validate.go
index dbae3ee..4bd4162 100644
--- a/validate.go
+++ b/validate.go
@@ -44,6 +44,7 @@
type Diagnostic struct {
Severity DiagnosticSeverity `json:"severity,omitempty"`
+ Address string `json:"address,omitempty"`
Summary string `json:"summary,omitempty"`
Detail string `json:"detail,omitempty"`
Range *Range `json:"range,omitempty"`
diff --git a/validate_test.go b/validate_test.go
index a3e42b6..4c941e6 100644
--- a/validate_test.go
+++ b/validate_test.go
@@ -70,7 +70,12 @@
"byte": 200
}
}
- }
+ },
+ {
+ "severity": "warning",
+ "summary": "no ice cream",
+ "address": "module.icebox.ice_cream.vanilla"
+ }
]
}`
var parsed ValidateOutput
@@ -104,6 +109,11 @@
},
},
},
+ {
+ Severity: "warning",
+ Address: "module.icebox.ice_cream.vanilla",
+ Summary: "no ice cream",
+ },
},
}
if diff := cmp.Diff(expected, &parsed); diff != "" {