@@ -67,3 +67,35 @@ func TestVersionOutput_015(t *testing.T) {
6767 t .Fatalf ("output mismatch: %s" , diff )
6868 }
6969}
70+
71+ // In TF v1.17 we added the format_version field,
72+ // to match how other static JSON outputs are versioned.
73+ func TestVersionOutput_117 (t * testing.T ) {
74+ output := `{
75+ "format_version": "1.0",
76+ "terraform_version": "4.5.6-foo",
77+ "platform": "aros_riscv64",
78+ "provider_selections": {
79+ "registry.terraform.io/hashicorp/test1": "7.8.9-beta.2",
80+ "registry.terraform.io/hashicorp/test2": "1.2.3"
81+ },
82+ "terraform_outdated": false
83+ }`
84+ var parsed VersionOutput
85+ if err := json .Unmarshal ([]byte (output ), & parsed ); err != nil {
86+ t .Fatal (err )
87+ }
88+
89+ expected := & VersionOutput {
90+ FormatVersion : "1.0" ,
91+ Version : "4.5.6-foo" ,
92+ Platform : "aros_riscv64" ,
93+ ProviderSelections : map [string ]string {
94+ "registry.terraform.io/hashicorp/test1" : "7.8.9-beta.2" ,
95+ "registry.terraform.io/hashicorp/test2" : "1.2.3" ,
96+ },
97+ }
98+ if diff := cmp .Diff (expected , & parsed ); diff != "" {
99+ t .Fatalf ("output mismatch: %s" , diff )
100+ }
101+ }
0 commit comments