@@ -45,24 +45,33 @@ type Diagnostic struct {
4545 // Severity indicates the level of the Diagnostic. Currently can be set to
4646 // either Error or Warning
4747 Severity Severity
48+
4849 // Summary is a short description of the problem, rendered above location
4950 // information
5051 Summary string
52+
5153 // Detail is an optional second message rendered below location information
5254 // typically used to communicate a potential fix to the user.
5355 Detail string
56+
5457 // AttributePath is a representation of the path starting from the root of
5558 // block (resource, datasource, provider) under evaluation by the SDK, to
56- // the attribute that the Diagnostic should be associated to.
59+ // the attribute that the Diagnostic should be associated to. Terraform will
60+ // use this information to render information on where the problem took
61+ // place in the user's configuration.
5762 //
58- // It is represented with cty.Path, the SDK currently only supports path
59- // steps of either cty.GetAttrStep (an actual attribute) or cty.IndexStep
60- // (a step with Key of cty.StringVal for map indexes, and cty.NumberVal
61- // list indexes, pathing into sets is not currently supported). Please see
62- // go-cty documentation for more information.
63+ // It is represented with cty.Path, which is a list of steps of either
64+ // cty.GetAttrStep (an actual attribute) or cty.IndexStep (a step with Key
65+ // of cty.StringVal for map indexes, and cty.NumberVal for list indexes).
6366 //
64- // Terraform will use this information to render information on where the
65- // problem took place in the user's configuration.
67+ // PLEASE NOTE: While cty can support indexing into sets, the SDK and
68+ // protocol currently do not. For any Diagnostic related to a schema.TypeSet
69+ // or a child of that type, please terminate the path at the schema.TypeSet
70+ // and opt for more verbose Summary and Detail to help guide the user.
71+ //
72+ // Validity of the AttributePath is currently the responsibility of the
73+ // developer, Terraform should render the root block (provider, resource,
74+ // datasource) in cases where the attribute path is invalid.
6675 AttributePath cty.Path
6776}
6877
@@ -93,10 +102,6 @@ func FromErr(err error) Diagnostic {
93102}
94103
95104// Severity is an enum type marking the severity level of a Diagnostic
96- //
97- // Valid levels are
98- // - Error
99- // - Warning
100105type Severity int
101106
102107const (
0 commit comments