From e58d74c0ca33a6c4b82d4d5010ab3ed789da066a Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 2 Aug 2022 16:23:16 -0400 Subject: [PATCH 1/4] update json plan docs with drift output Add "resource_drift" and "relevant_attributes" to the json plan documentation. --- website/docs/internals/json-format.mdx | 30 +++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/website/docs/internals/json-format.mdx b/website/docs/internals/json-format.mdx index ec4c109c53..ec7941e255 100644 --- a/website/docs/internals/json-format.mdx +++ b/website/docs/internals/json-format.mdx @@ -44,7 +44,7 @@ The JSON output format consists of the following objects and sub-objects: - [Configuration Representation](#configuration-representation) — A sub-object of plan output that describes a parsed Terraform configuration. - [Expression Representation](#expression-representation) — A sub-object of a configuration representation that describes an unevaluated expression. - [Block Expressions Representation](#block-expressions-representation) — A sub-object of a configuration representation that describes the expressions nested inside a block. -- [Change Representation](#change-representation) — A sub-object of plan output that describes planned changes to an object. +- [Change Representation](#change-representation) — A sub-object of plan output that describes changes to an object. ## State Representation @@ -98,9 +98,9 @@ For ease of consumption by callers, the plan representation includes a partial r }, }, - // "changes" is a description of the individual change actions that Terraform - // plans to use to move from the prior state to a new state matching the - // configuration. + // "resource_changes" is a description of the individual change actions that + // Terraform plans to use to move from the prior state to a new state + // matching the configuration. "resource_changes": [ // Each element of this array describes the action to take // for one instance object. All resources in the @@ -187,6 +187,26 @@ For ease of consumption by callers, the plan representation includes a partial r } ], + // "resource_drift" is a description of the individual changes detected when + // Terraform compared the most recent state to the prior saved state. + "resource_drift": [ + { + // "resource_drift" utilizes the same object structure as + // "resource_changes". + } + ], + + // "relevant_attributes" lists the sources of all values contributing to + // changes in the plan. "relevant_attributes" can be used to filter + // "resource_drift" to determine which external changes may have affected the + // plan result. + "relevant_attributes": [ + { + "resource": "aws_instance.foo", + "attribute": "attr", + } + ] + // "output_changes" describes the planned changes to the output values of the // root module. "output_changes": { @@ -526,7 +546,7 @@ For now we expect callers to just hard-code assumptions about the schemas of par ## Change Representation -A `` describes the change that will be made to the indicated object. +A `` describes the change to the indicated object. ```javascript { From 1e79f17ed21f1107bb5759926061b4b4aed44a45 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 2 Aug 2022 17:35:09 -0400 Subject: [PATCH 2/4] Update website/docs/internals/json-format.mdx Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com> --- website/docs/internals/json-format.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/internals/json-format.mdx b/website/docs/internals/json-format.mdx index ec7941e255..575e73e56d 100644 --- a/website/docs/internals/json-format.mdx +++ b/website/docs/internals/json-format.mdx @@ -187,8 +187,8 @@ For ease of consumption by callers, the plan representation includes a partial r } ], - // "resource_drift" is a description of the individual changes detected when - // Terraform compared the most recent state to the prior saved state. + // "resource_drift" is a description of the changes Terraform detected + // when it compared the most recent state to the prior saved state. "resource_drift": [ { // "resource_drift" utilizes the same object structure as From 08fed6e2960be5fb3cf60d1beb838672b92d572d Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 2 Aug 2022 17:35:19 -0400 Subject: [PATCH 3/4] Update website/docs/internals/json-format.mdx Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com> --- website/docs/internals/json-format.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/internals/json-format.mdx b/website/docs/internals/json-format.mdx index 575e73e56d..3c11eb6773 100644 --- a/website/docs/internals/json-format.mdx +++ b/website/docs/internals/json-format.mdx @@ -191,7 +191,7 @@ For ease of consumption by callers, the plan representation includes a partial r // when it compared the most recent state to the prior saved state. "resource_drift": [ { - // "resource_drift" utilizes the same object structure as + // "resource_drift" uses the same object structure as // "resource_changes". } ], From a0b66c87cc6cd03b7fb590daf1146af1296624e1 Mon Sep 17 00:00:00 2001 From: James Bardin Date: Tue, 2 Aug 2022 17:35:30 -0400 Subject: [PATCH 4/4] Update website/docs/internals/json-format.mdx Co-authored-by: Laura Pacilio <83350965+laurapacilio@users.noreply.github.com> --- website/docs/internals/json-format.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/website/docs/internals/json-format.mdx b/website/docs/internals/json-format.mdx index 3c11eb6773..a0194a08f9 100644 --- a/website/docs/internals/json-format.mdx +++ b/website/docs/internals/json-format.mdx @@ -197,8 +197,8 @@ For ease of consumption by callers, the plan representation includes a partial r ], // "relevant_attributes" lists the sources of all values contributing to - // changes in the plan. "relevant_attributes" can be used to filter - // "resource_drift" to determine which external changes may have affected the + // changes in the plan. You can use "relevant_attributes" to filter + // "resource_drift" and determine which external changes may have affected the // plan result. "relevant_attributes": [ {