@@ -15,7 +15,39 @@ This repository also serves as de facto documentation for the formats produced
1515by these commands. For more details, see the
1616[ GoDoc] ( https://godoc.org/github.com/hashicorp/terraform-json ) .
1717
18- ## Why a Separate Repository?
18+ ## Should I use this library?
19+
20+ This library was built for a few specific applications, and is not intended for
21+ general purpose use.
22+
23+ The Terraform core team ** recommends against** using ` terraform-json ` if your
24+ application has any of the following requirements:
25+
26+ * ** Forward-compatibility** : each version of this library represents a specific
27+ snapshot of the [ Terraform JSON output format] ( https://developer.hashicorp.com/terraform/internals/json-format ) ,
28+ and it often slightly lags behind Terraform itself. The library supports
29+ [ the 1.x compatibility promises] ( https://developer.hashicorp.com/terraform/language/v1-compatibility-promises )
30+ but you will need to upgrade the version promptly to use new additions. If you
31+ require full compatibility with future Terraform versions, we recommend
32+ implementing your own custom decoders for the parts of the JSON format you need.
33+ * ** Writing JSON output** : the structures in this library are not guaranteed to emit
34+ JSON data which is semantically equivalent to Terraform itself. If your application
35+ must robustly write JSON data to be consumed by systems which expect Terraform's
36+ format to be supported, you should implement your own custom encoders.
37+ * ** Filtering or round-tripping** : the Terraform JSON formats are designed to be
38+ forwards compatible, and permit new attributes to be added which may safely be
39+ ignored by earlier versions of consumers. This library ** drops unknown attributes** ,
40+ which means it is unsuitable for any application which intends to filter data
41+ or read-modify-write data which will be consumed downstream. Any application doing
42+ this will silently drop new data from new versions. For this application, you should
43+ implement a custom decoder and encoder which preserves any unknown attributes
44+ through a round-trip.
45+
46+ When is ` terraform-json ` suitable? We recommend using it for applications which
47+ decode the core stable data types and use it directly, and don't attempt to emit
48+ JSON to be consumed by applications which expect the Terraform format.
49+
50+ ## Why a separate repository?
1951
2052To reduce dependencies on any of Terraform core's internals, we've made a design
2153decision to make any helpers or libraries that work with the external JSON data
0 commit comments