mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
command/jsonchecks: Mark check result objects as experimental
This is a clumsy way to do this, but a pragmatic way to inform potential consumers that this part of the format is not yet finalized without having to read the docs to see our warning about that. We need to get some practical experience with a few different consumers making use of this format before we can be confident that it's designed appropriately. We're not _expecting_ to break it, but we'd like to leave the opportunity open in case we quickly learn that there's something non-ideal about this design.
This commit is contained in:
parent
a8c255c779
commit
71dec301a2
@ -70,6 +70,8 @@ func MarshalCheckStates(results *states.CheckResults) []byte {
|
||||
// object in the configuration even if Terraform Core encountered an error
|
||||
// before being able to determine the dynamic instances of the checkable object.
|
||||
type checkResultStatic struct {
|
||||
ExperimentalNote experimentalNote `json:"//"`
|
||||
|
||||
// Address is the address of the checkable object this result relates to.
|
||||
Address staticObjectAddr `json:"address"`
|
||||
|
||||
@ -114,3 +116,9 @@ type checkProblem struct {
|
||||
// intentionally an object to allow us to add other data over time, such
|
||||
// as the source location where the failing condition was defined.
|
||||
}
|
||||
|
||||
type experimentalNote struct{}
|
||||
|
||||
func (n experimentalNote) MarshalJSON() ([]byte, error) {
|
||||
return []byte(`"EXPERIMENTAL: see docs for details"`), nil
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ func TestMarshalCheckStates(t *testing.T) {
|
||||
},
|
||||
[]any{
|
||||
map[string]any{
|
||||
"//": "EXPERIMENTAL: see docs for details",
|
||||
"address": map[string]any{
|
||||
"kind": "output_value",
|
||||
"module": "module.child",
|
||||
@ -117,6 +118,7 @@ func TestMarshalCheckStates(t *testing.T) {
|
||||
"status": "fail",
|
||||
},
|
||||
map[string]any{
|
||||
"//": "EXPERIMENTAL: see docs for details",
|
||||
"address": map[string]any{
|
||||
"kind": "resource",
|
||||
"mode": "managed",
|
||||
@ -142,6 +144,7 @@ func TestMarshalCheckStates(t *testing.T) {
|
||||
"status": "fail",
|
||||
},
|
||||
map[string]any{
|
||||
"//": "EXPERIMENTAL: see docs for details",
|
||||
"address": map[string]any{
|
||||
"kind": "output_value",
|
||||
"name": "a",
|
||||
@ -158,6 +161,7 @@ func TestMarshalCheckStates(t *testing.T) {
|
||||
"status": "fail",
|
||||
},
|
||||
map[string]any{
|
||||
"//": "EXPERIMENTAL: see docs for details",
|
||||
"address": map[string]any{
|
||||
"kind": "resource",
|
||||
"mode": "managed",
|
||||
|
Loading…
Reference in New Issue
Block a user