Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json-output: Release format version 1.0 #29502

Merged
merged 1 commit into from
Sep 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/command/jsonplan/plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
// FormatVersion represents the version of the json format and will be
// incremented for any change to this format that requires changes to a
// consuming parser.
const FormatVersion = "0.2"
const FormatVersion = "1.0"

// Plan is the top-level representation of the json format of a plan. It includes
// the complete config and current state.
Expand Down
2 changes: 1 addition & 1 deletion internal/command/jsonprovider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// FormatVersion represents the version of the json format and will be
// incremented for any change to this format that requires changes to a
// consuming parser.
const FormatVersion = "0.2"
const FormatVersion = "1.0"

// providers is the top-level object returned when exporting provider schemas
type providers struct {
Expand Down
2 changes: 1 addition & 1 deletion internal/command/jsonstate/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
// FormatVersion represents the version of the json format and will be
// incremented for any change to this format that requires changes to a
// consuming parser.
const FormatVersion = "0.2"
const FormatVersion = "1.0"

// state is the top-level representation of the json format of a terraform
// state.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"provider_schemas": {
"registry.terraform.io/hashicorp/test": {
"provider": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"format_version": "0.2"
}
"format_version": "1.0"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"provider_schemas": {
"registry.terraform.io/hashicorp/test": {
"provider": {
Expand Down
4 changes: 2 additions & 2 deletions internal/command/testdata/show-json-sensitive/output.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -66,7 +66,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.12.0",
"values": {
"root_module": {
Expand Down
4 changes: 2 additions & 2 deletions internal/command/testdata/show-json-state/empty/output.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"format_version": "0.2"
}
"format_version": "1.0"
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.12.0",
"values": {
"outputs": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.14.0",
"values": {
"root_module": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -88,7 +88,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -68,7 +68,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
4 changes: 2 additions & 2 deletions internal/command/testdata/show-json/drift/output.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"resources": [
Expand Down Expand Up @@ -105,7 +105,7 @@
}
],
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"root_module": {
"resources": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.1-dev",
"planned_values": {
"root_module": {
Expand Down
4 changes: 2 additions & 2 deletions internal/command/testdata/show-json/modules/output.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"outputs": {
"test": {
Expand Down Expand Up @@ -74,7 +74,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.0",
"variables": {
"test_var": {
Expand Down Expand Up @@ -127,7 +127,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.0",
"values": {
"outputs": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"child_modules": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
Expand Down Expand Up @@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"resources": [
Expand Down Expand Up @@ -48,7 +48,7 @@
}
],
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"root_module": {
"resources": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "boop"
Expand Down Expand Up @@ -69,7 +69,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 4,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 2,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": true,
"error_count": 0,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
2 changes: 1 addition & 1 deletion internal/command/testdata/validate-invalid/output.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 2,
"warning_count": 0,
Expand Down
2 changes: 1 addition & 1 deletion internal/command/testdata/validate-valid/output.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": true,
"error_count": 0,
"warning_count": 0,
Expand Down
2 changes: 1 addition & 1 deletion internal/command/views/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (v *ValidateJSON) Results(diags tfdiags.Diagnostics) int {
// FormatVersion represents the version of the json format and will be
// incremented for any change to this format that requires changes to a
// consuming parser.
const FormatVersion = "0.1"
const FormatVersion = "1.0"

type Output struct {
FormatVersion string `json:"format_version"`
Expand Down
15 changes: 13 additions & 2 deletions website/docs/cli/commands/providers/schema.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,18 @@ The list of available flags are:

Please note that, at this time, the `-json` flag is a _required_ option. In future releases, this command will be extended to allow for additional options.

-> **Note:** The output includes a `format_version` key, which currently has major version zero to indicate that the format is experimental and subject to change. A future version will assign a non-zero major version and make stronger promises about compatibility. We do not anticipate any significant breaking changes to the format before its first major version, however.
The output includes a `format_version` key, which as of Terraform 1.1.0 has
value `"1.0"`. The semantics of this version are:

- We will increment the minor version, e.g. `"1.1"`, for backward-compatible
changes or additions. Ignore any object properties with unrecognized names to
remain forward-compatible with future minor versions.
- We will increment the major version, e.g. `"2.0"`, for changes that are not
backward-compatible. Reject any input which reports an unsupported major
version.

We will introduce new major versions only within the bounds of
[the Terraform 1.0 Compatibility Promises](https://www.terraform.io/docs/language/v1-compatibility-promises.html).

## Format Summary

Expand All @@ -41,7 +52,7 @@ The JSON output format consists of the following objects and sub-objects:

```javascript
{
"format_version": "0.1",
"format_version": "1.0",

// "provider_schemas" describes the provider schemas for all
// providers throughout the configuration tree.
Expand Down
Loading