Merge pull request #29502 from hashicorp/alisdair/json-format-version
json-output: Release format version 1.0
This commit is contained in:
commit
a819d7db3a
|
@ -22,7 +22,7 @@ import (
|
||||||
// FormatVersion represents the version of the json format and will be
|
// FormatVersion represents the version of the json format and will be
|
||||||
// incremented for any change to this format that requires changes to a
|
// incremented for any change to this format that requires changes to a
|
||||||
// consuming parser.
|
// 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
|
// Plan is the top-level representation of the json format of a plan. It includes
|
||||||
// the complete config and current state.
|
// the complete config and current state.
|
||||||
|
|
|
@ -9,7 +9,7 @@ import (
|
||||||
// FormatVersion represents the version of the json format and will be
|
// FormatVersion represents the version of the json format and will be
|
||||||
// incremented for any change to this format that requires changes to a
|
// incremented for any change to this format that requires changes to a
|
||||||
// consuming parser.
|
// consuming parser.
|
||||||
const FormatVersion = "0.2"
|
const FormatVersion = "1.0"
|
||||||
|
|
||||||
// providers is the top-level object returned when exporting provider schemas
|
// providers is the top-level object returned when exporting provider schemas
|
||||||
type providers struct {
|
type providers struct {
|
||||||
|
|
|
@ -18,7 +18,7 @@ import (
|
||||||
// FormatVersion represents the version of the json format and will be
|
// FormatVersion represents the version of the json format and will be
|
||||||
// incremented for any change to this format that requires changes to a
|
// incremented for any change to this format that requires changes to a
|
||||||
// consuming parser.
|
// consuming parser.
|
||||||
const FormatVersion = "0.2"
|
const FormatVersion = "1.0"
|
||||||
|
|
||||||
// state is the top-level representation of the json format of a terraform
|
// state is the top-level representation of the json format of a terraform
|
||||||
// state.
|
// state.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"provider_schemas": {
|
"provider_schemas": {
|
||||||
"registry.terraform.io/hashicorp/test": {
|
"registry.terraform.io/hashicorp/test": {
|
||||||
"provider": {
|
"provider": {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2"
|
"format_version": "1.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"provider_schemas": {
|
"provider_schemas": {
|
||||||
"registry.terraform.io/hashicorp/test": {
|
"registry.terraform.io/hashicorp/test": {
|
||||||
"provider": {
|
"provider": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -66,7 +66,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.12.0",
|
"terraform_version": "0.12.0",
|
||||||
"values": {
|
"values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2"
|
"format_version": "1.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.12.0",
|
"terraform_version": "0.12.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.14.0",
|
"terraform_version": "0.14.0",
|
||||||
"values": {
|
"values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -88,7 +88,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"planned_values": {
|
"planned_values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
"resources": [
|
"resources": [
|
||||||
|
@ -105,7 +105,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
"resources": [
|
"resources": [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.13.1-dev",
|
"terraform_version": "0.13.1-dev",
|
||||||
"planned_values": {
|
"planned_values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"planned_values": {
|
"planned_values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.13.0",
|
"terraform_version": "0.13.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"terraform_version": "0.13.0",
|
"terraform_version": "0.13.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"planned_values": {
|
"planned_values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
"child_modules": [
|
"child_modules": [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "bar"
|
"value": "bar"
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"planned_values": {
|
"planned_values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
"resources": [
|
"resources": [
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"root_module": {
|
"root_module": {
|
||||||
"resources": [
|
"resources": [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"variables": {
|
"variables": {
|
||||||
"test_var": {
|
"test_var": {
|
||||||
"value": "boop"
|
"value": "boop"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"prior_state": {
|
"prior_state": {
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
"values": {
|
"values": {
|
||||||
"outputs": {
|
"outputs": {
|
||||||
"test": {
|
"test": {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 4,
|
"error_count": 4,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 2,
|
"error_count": 2,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": true,
|
"valid": true,
|
||||||
"error_count": 0,
|
"error_count": 0,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 1,
|
"error_count": 1,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": false,
|
"valid": false,
|
||||||
"error_count": 2,
|
"error_count": 2,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
"valid": true,
|
"valid": true,
|
||||||
"error_count": 0,
|
"error_count": 0,
|
||||||
"warning_count": 0,
|
"warning_count": 0,
|
||||||
|
|
|
@ -81,7 +81,7 @@ func (v *ValidateJSON) Results(diags tfdiags.Diagnostics) int {
|
||||||
// FormatVersion represents the version of the json format and will be
|
// FormatVersion represents the version of the json format and will be
|
||||||
// incremented for any change to this format that requires changes to a
|
// incremented for any change to this format that requires changes to a
|
||||||
// consuming parser.
|
// consuming parser.
|
||||||
const FormatVersion = "0.1"
|
const FormatVersion = "1.0"
|
||||||
|
|
||||||
type Output struct {
|
type Output struct {
|
||||||
FormatVersion string `json:"format_version"`
|
FormatVersion string `json:"format_version"`
|
||||||
|
|
|
@ -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.
|
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
|
## Format Summary
|
||||||
|
|
||||||
|
@ -41,7 +52,7 @@ The JSON output format consists of the following objects and sub-objects:
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"format_version": "0.1",
|
"format_version": "1.0",
|
||||||
|
|
||||||
// "provider_schemas" describes the provider schemas for all
|
// "provider_schemas" describes the provider schemas for all
|
||||||
// providers throughout the configuration tree.
|
// providers throughout the configuration tree.
|
||||||
|
|
|
@ -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
|
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.
|
JSON, which it should then treat as a generic error case.
|
||||||
|
|
||||||
**Note:** The output includes a `format_version` key, which currently has major
|
The output includes a `format_version` key, which as of Terraform 1.1.0 has
|
||||||
version zero to indicate that the format is experimental and subject to change.
|
value `"1.0"`. The semantics of this version are:
|
||||||
A future version will assign a non-zero major version and make stronger
|
|
||||||
promises about compatibility. We do not anticipate any significant breaking
|
- We will increment the minor version, e.g. `"1.1"`, for backward-compatible
|
||||||
changes to the format before its first major version, however.
|
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
|
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:
|
stream. The top-level JSON object will have the following properties:
|
||||||
|
|
|
@ -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.
|
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
|
## Format Summary
|
||||||
|
|
||||||
|
@ -60,7 +71,7 @@ For ease of consumption by callers, the plan representation includes a partial r
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
{
|
{
|
||||||
"format_version": "0.2",
|
"format_version": "1.0",
|
||||||
|
|
||||||
// "prior_state" is a representation of the state that the configuration is
|
// "prior_state" is a representation of the state that the configuration is
|
||||||
// being applied to, using the state representation described above.
|
// being applied to, using the state representation described above.
|
||||||
|
|
Loading…
Reference in New Issue