Merge pull request #29502 from hashicorp/alisdair/json-format-version

json-output: Release format version 1.0
This commit is contained in:
Laura Pacilio 2021-09-09 11:06:58 -04:00 committed by GitHub
commit a819d7db3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 86 additions and 57 deletions

View File

@ -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.

View File

@ -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 {

View File

@ -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.

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"provider_schemas": {
"registry.terraform.io/hashicorp/test": {
"provider": {

View File

@ -1,3 +1,3 @@
{
"format_version": "0.2"
}
"format_version": "1.0"
}

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"provider_schemas": {
"registry.terraform.io/hashicorp/test": {
"provider": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -66,7 +66,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.12.0",
"values": {
"root_module": {

View File

@ -1,3 +1,3 @@
{
"format_version": "0.2"
}
"format_version": "1.0"
}

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.12.0",
"values": {
"outputs": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.14.0",
"values": {
"root_module": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -88,7 +88,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -68,7 +68,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"resources": [
@ -105,7 +105,7 @@
}
],
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"root_module": {
"resources": [

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.1-dev",
"planned_values": {
"root_module": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"outputs": {
"test": {
@ -74,7 +74,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.0",
"variables": {
"test_var": {
@ -127,7 +127,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"terraform_version": "0.13.0",
"values": {
"outputs": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"child_modules": [

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "bar"
@ -57,7 +57,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"planned_values": {
"root_module": {
"resources": [
@ -48,7 +48,7 @@
}
],
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"root_module": {
"resources": [

View File

@ -1,5 +1,5 @@
{
"format_version": "0.2",
"format_version": "1.0",
"variables": {
"test_var": {
"value": "boop"
@ -69,7 +69,7 @@
}
},
"prior_state": {
"format_version": "0.2",
"format_version": "1.0",
"values": {
"outputs": {
"test": {

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 4,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 2,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": true,
"error_count": 0,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 1,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": false,
"error_count": 2,
"warning_count": 0,

View File

@ -1,5 +1,5 @@
{
"format_version": "0.1",
"format_version": "1.0",
"valid": true,
"error_count": 0,
"warning_count": 0,

View File

@ -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"`

View File

@ -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
@ -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.

View File

@ -57,11 +57,18 @@ to the JSON output setting. For that reason, external software consuming
Terraform's output should be prepared to find data on stdout that _isn't_ valid
JSON, which it should then treat as a generic error case.
**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).
In the normal case, Terraform will print a JSON object to the standard output
stream. The top-level JSON object will have the following properties:

View File

@ -16,7 +16,18 @@ Since the format of plan files isn't suited for use with external tools (and lik
Use `terraform show -json <FILE>` to generate a JSON representation of a plan or state file. See [the `terraform show` documentation](/docs/cli/commands/show.html) for more details.
-> **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
@ -60,7 +71,7 @@ For ease of consumption by callers, the plan representation includes a partial r
```javascript
{
"format_version": "0.2",
"format_version": "1.0",
// "prior_state" is a representation of the state that the configuration is
// being applied to, using the state representation described above.