version: Allow parsing of a format_version field, added in v1.17 (#208)
diff --git a/version.go b/version.go
index 392d082..31de077 100644
--- a/version.go
+++ b/version.go
@@ -6,6 +6,8 @@
 // VersionOutput represents output from the version -json command
 // added in v0.13
 type VersionOutput struct {
+	FormatVersion string `json:"format_version"` // Added in v1.17
+
 	Version            string            `json:"terraform_version"`
 	Revision           string            `json:"terraform_revision"`
 	Platform           string            `json:"platform,omitempty"`
diff --git a/version_test.go b/version_test.go
index aa9cf02..66fb6fe 100644
--- a/version_test.go
+++ b/version_test.go
@@ -67,3 +67,35 @@
 		t.Fatalf("output mismatch: %s", diff)
 	}
 }
+
+// In TF v1.17 we added the format_version field,
+// to match how other static JSON outputs are versioned.
+func TestVersionOutput_117(t *testing.T) {
+	output := `{
+  "format_version": "1.0",
+  "terraform_version": "4.5.6-foo",
+  "platform": "aros_riscv64",
+  "provider_selections": {
+    "registry.terraform.io/hashicorp/test1": "7.8.9-beta.2",
+    "registry.terraform.io/hashicorp/test2": "1.2.3"
+  },
+  "terraform_outdated": false
+}`
+	var parsed VersionOutput
+	if err := json.Unmarshal([]byte(output), &parsed); err != nil {
+		t.Fatal(err)
+	}
+
+	expected := &VersionOutput{
+		FormatVersion: "1.0",
+		Version:       "4.5.6-foo",
+		Platform:      "aros_riscv64",
+		ProviderSelections: map[string]string{
+			"registry.terraform.io/hashicorp/test1": "7.8.9-beta.2",
+			"registry.terraform.io/hashicorp/test2": "1.2.3",
+		},
+	}
+	if diff := cmp.Diff(expected, &parsed); diff != "" {
+		t.Fatalf("output mismatch: %s", diff)
+	}
+}