github.com/kanishk98/terraform@v1.3.0-dev.0.20220917174235-661ca8088a6a/website/docs/internals/json-format.mdx (about) 1 --- 2 page_title: 'Internals: JSON Output Format' 3 description: >- 4 Terraform provides a machine-readable JSON representation of state, 5 configuration and plan. 6 --- 7 8 # JSON Output Format 9 10 -> **Note:** This format is available in Terraform 0.12 and later. 11 12 When Terraform plans to make changes, it prints a human-readable summary to the terminal. It can also, when run with `-out=<PATH>`, write a much more detailed binary plan file, which can later be used to apply those changes. 13 14 Since the format of plan files isn't suited for use with external tools (and likely never will be), Terraform can output a machine-readable JSON representation of a plan file's changes. It can also convert state files to the same format, to simplify data loading and provide better long-term compatibility. 15 16 Use `terraform show -json <FILE>` to generate a JSON representation of a plan or state file. See [the `terraform show` documentation](/cli/commands/show) for more details. 17 18 The output includes a `format_version` key, which as of Terraform 1.1.0 has 19 value `"1.0"`. The semantics of this version are: 20 21 - We will increment the minor version, e.g. `"1.1"`, for backward-compatible 22 changes or additions. Ignore any object properties with unrecognized names to 23 remain forward-compatible with future minor versions. 24 - We will increment the major version, e.g. `"2.0"`, for changes that are not 25 backward-compatible. Reject any input which reports an unsupported major 26 version. 27 28 We will introduce new major versions only within the bounds of 29 [the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). 30 31 ## Format Summary 32 33 The following sections describe the JSON output format by example, using a pseudo-JSON notation. 34 35 Important elements are described with comments, which are prefixed with `//`. 36 37 To avoid excessive repetition, we've split the complete format into several discrete sub-objects, described under separate headers. References wrapped in angle brackets (like `<values-representation>`) are placeholders which, in the real output, would be replaced by an instance of the specified sub-object. 38 39 The JSON output format consists of the following objects and sub-objects: 40 41 - [State Representation](#state-representation) — The complete top-level object returned by `terraform show -json <STATE FILE>`. 42 - [Plan Representation](#plan-representation) — The complete top-level object returned by `terraform show -json <PLAN FILE>`. 43 - [Values Representation](#values-representation) — A sub-object of both plan and state output that describes current state or planned state. 44 - [Configuration Representation](#configuration-representation) — A sub-object of plan output that describes a parsed Terraform configuration. 45 - [Expression Representation](#expression-representation) — A sub-object of a configuration representation that describes an unevaluated expression. 46 - [Block Expressions Representation](#block-expressions-representation) — A sub-object of a configuration representation that describes the expressions nested inside a block. 47 - [Change Representation](#change-representation) — A sub-object of plan output that describes changes to an object. 48 - [Checks Representation](#checks-representation) — A property of both the plan and state representations that describes the current status of any checks (e.g. preconditions and postconditions) in the configuration. 49 50 ## State Representation 51 52 Because state does not currently have any significant metadata not covered by the common values representation ([described below](#values-representation)), the `<state-representation>` is straightforward: 53 54 ```javascript 55 { 56 // "values" is a values representation object derived from the values in the 57 // state. Because the state is always fully known, this is always complete. 58 "values": <values-representation> 59 60 "terraform_version": "version.string" 61 } 62 ``` 63 64 The extra wrapping object here will allow for any extension we may need to add in future versions of this format. 65 66 ## Plan Representation 67 68 A plan consists of a prior state, the configuration that is being applied to that state, and the set of changes Terraform plans to make to achieve that. 69 70 For ease of consumption by callers, the plan representation includes a partial representation of the values in the final state (using a [value representation](#values-representation)), allowing callers to easily analyze the planned outcome using similar code as for analyzing the prior state. 71 72 ```javascript 73 { 74 "format_version": "1.0", 75 76 // "prior_state" is a representation of the state that the configuration is 77 // being applied to, using the state representation described above. 78 "prior_state": <state-representation>, 79 80 // "configuration" is a representation of the configuration being applied to the 81 // prior state, using the configuration representation described above. 82 "configuration": <configuration-representation>, 83 84 // "planned_values" is a description of what is known so far of the outcome in 85 // the standard value representation, with any as-yet-unknown values omitted. 86 "planned_values": <values-representation>, 87 88 // "proposed_unknown" is a representation of the attributes, including any 89 // potentially-unknown attributes. Each value is replaced with "true" or 90 // "false" depending on whether it is known in the proposed plan. 91 "proposed_unknown": <values-representation>, 92 93 // "variables" is a representation of all the variables provided for the given 94 // plan. This is structured as a map similar to the output map so we can add 95 // additional fields in later. 96 "variables": { 97 "varname": { 98 "value": "varvalue" 99 }, 100 }, 101 102 // "resource_changes" is a description of the individual change actions that 103 // Terraform plans to use to move from the prior state to a new state 104 // matching the configuration. 105 "resource_changes": [ 106 // Each element of this array describes the action to take 107 // for one instance object. All resources in the 108 // configuration are included in this list. 109 { 110 // "address" is the full absolute address of the resource instance this 111 // change applies to, in the same format as addresses in a value 112 // representation. 113 "address": "module.child.aws_instance.foo[0]", 114 115 // "previous_address" is the full absolute address of this resource 116 // instance as it was known after the previous Terraform run. 117 // Included only if the address has changed, e.g. by handling 118 // a "moved" block in the configuration. 119 "previous_address": "module.instances.aws_instance.foo[0]", 120 121 // "module_address", if set, is the module portion of the above address. 122 // Omitted if the instance is in the root module. 123 "module_address": "module.child", 124 125 // "mode", "type", "name", and "index" have the same meaning as in a 126 // value representation. 127 "mode": "managed", 128 "type": "aws_instance", 129 "name": "foo", 130 "index": 0, 131 132 // "deposed", if set, indicates that this action applies to a "deposed" 133 // object of the given instance rather than to its "current" object. 134 // Omitted for changes to the current object. "address" and "deposed" 135 // together form a unique key across all change objects in a particular 136 // plan. The value is an opaque key representing the specific deposed 137 // object. 138 "deposed": "deadbeef", 139 140 // "change" describes the change that will be made to the indicated 141 // object. The <change-representation> is detailed in a section below. 142 "change": <change-representation>, 143 144 // "action_reason" is some optional extra context about why the 145 // actions given inside "change" were selected. This is the JSON 146 // equivalent of annotations shown in the normal plan output like 147 // "is tainted, so must be replaced" as opposed to just "must be 148 // replaced". 149 // 150 // These reason codes are display hints only and the set of possible 151 // hints may change over time. Users of this must be prepared to 152 // encounter unrecognized reasons and treat them as unspecified reasons. 153 // 154 // The current set of possible values is: 155 // - "replace_because_tainted": the object in question is marked as 156 // "tainted" in the prior state, so Terraform planned to replace it. 157 // - "replace_because_cannot_update": the provider indicated that one 158 // of the requested changes isn't possible without replacing the 159 // existing object with a new object. 160 // - "replace_by_request": the user explicitly called for this object 161 // to be replaced as an option when creating the plan, which therefore 162 // overrode what would have been a "no-op" or "update" action otherwise. 163 // - "delete_because_no_resource_config": Terraform found no resource 164 // configuration corresponding to this instance. 165 // - "delete_because_no_module": The resource instance belongs to a 166 // module instance that's no longer declared, perhaps due to changing 167 // the "count" or "for_each" argument on one of the containing modules. 168 // - "delete_because_wrong_repetition": The instance key portion of the 169 // resource address isn't of a suitable type for the corresponding 170 // resource's configured repetition mode (count, for_each, or neither). 171 // - "delete_because_count_index": The corresponding resource uses count, 172 // but the instance key is out of range for the currently-configured 173 // count value. 174 // - "delete_because_each_key": The corresponding resource uses for_each, 175 // but the instance key doesn't match any of the keys in the 176 // currently-configured for_each value. 177 // - "read_because_config_unknown": For a data resource, Terraform cannot 178 // read the data during the plan phase because of values in the 179 // configuration that won't be known until the apply phase. 180 // - "read_because_dependency_pending": For a data resource, Terraform 181 // cannot read the data during the plan phase because the data 182 // resource depends on at least one managed resource that also has 183 // a pending change in the same plan. 184 // 185 // If there is no special reason to note, Terraform will omit this 186 // property altogether. 187 action_reason: "replace_because_tainted" 188 } 189 ], 190 191 // "resource_drift" is a description of the changes Terraform detected 192 // when it compared the most recent state to the prior saved state. 193 "resource_drift": [ 194 { 195 // "resource_drift" uses the same object structure as 196 // "resource_changes". 197 } 198 ], 199 200 // "relevant_attributes" lists the sources of all values contributing to 201 // changes in the plan. You can use "relevant_attributes" to filter 202 // "resource_drift" and determine which external changes may have affected the 203 // plan result. 204 "relevant_attributes": [ 205 { 206 "resource": "aws_instance.foo", 207 "attribute": "attr", 208 } 209 ] 210 211 // "output_changes" describes the planned changes to the output values of the 212 // root module. 213 "output_changes": { 214 // Keys are the defined output value names. 215 "foo": { 216 217 // "change" describes the change that will be made to the indicated output 218 // value, using the same representation as for resource changes except 219 // that the only valid actions values are: 220 // ["create"] 221 // ["update"] 222 // ["delete"] 223 // In the Terraform CLI 0.12.0 release, Terraform is not yet fully able to 224 // track changes to output values, so the actions indicated may not be 225 // fully accurate, but the "after" value will always be correct. 226 "change": <change-representation>, 227 } 228 }, 229 230 // "checks" describes the partial results for any checkable objects, such as 231 // resources with postconditions, with as much information as Terraform can 232 // recognize at plan time. Some objects will have status "unknown" to 233 // indicate that their status will only be determined after applying the plan. 234 "checks" <checks-representation> 235 } 236 ``` 237 238 This overall plan structure, fully expanded, is what will be printed by the `terraform show -json <planfile>` command. 239 240 ## Values Representation 241 242 A values representation is used in both state and plan output to describe current state (which is always complete) and planned state (which omits values not known until apply). 243 244 The following example illustrates the structure of a `<values-representation>`: 245 246 ```javascript 247 { 248 // "outputs" describes the outputs from the root module. Outputs from 249 // descendent modules are not available because they are not retained in all 250 // of the underlying structures we will build this values representation from. 251 "outputs": { 252 "private_ip": { 253 "value": "192.168.3.2", 254 "type": "string", 255 "sensitive": false 256 } 257 }, 258 259 // "root_module" describes the resources and child modules in the root module. 260 "root_module": { 261 "resources": [ 262 { 263 // "address" is the absolute resource address, which callers must consider 264 // opaque but may do full string comparisons with other address strings or 265 // pass this verbatim to other Terraform commands that are documented to 266 // accept absolute resource addresses. The module-local portions of this 267 // address are extracted in other properties below. 268 "address": "aws_instance.example[1]", 269 270 // "mode" can be "managed", for resources, or "data", for data resources 271 "mode": "managed", 272 "type": "aws_instance", 273 "name": "example", 274 275 // If the count or for_each meta-arguments are set for this resource, the 276 // additional key "index" is present to give the instance index key. This 277 // is omitted for the single instance of a resource that isn't using count 278 // or for_each. 279 "index": 1, 280 281 // "provider_name" is the name of the provider that is responsible for 282 // this resource. This is only the provider name, not a provider 283 // configuration address, and so no module path nor alias will be 284 // indicated here. This is included to allow the property "type" to be 285 // interpreted unambiguously in the unusual situation where a provider 286 // offers a resource type whose name does not start with its own name, 287 // such as the "googlebeta" provider offering "google_compute_instance". 288 "provider_name": "aws", 289 290 // "schema_version" indicates which version of the resource type schema 291 // the "values" property conforms to. 292 "schema_version": 2, 293 294 // "values" is the JSON representation of the attribute values of the 295 // resource, whose structure depends on the resource type schema. Any 296 // unknown values are omitted or set to null, making them 297 // indistinguishable from absent values; callers which need to distinguish 298 // unknown from unset must use the plan-specific or configuration-specific 299 // structures described in later sections. 300 "values": { 301 "id": "i-abc123", 302 "instance_type": "t2.micro", 303 // etc, etc 304 }, 305 306 // "sensitive_values" is the JSON representation of the sensitivity of 307 // the resource's attribute values. Only attributes which are sensitive 308 // are included in this structure. 309 "sensitive_values": { 310 "id": true, 311 } 312 } 313 ] 314 315 "child_modules": [ 316 // Each entry in "child_modules" has the same structure as the root_module 317 // object, with the additional "address" property shown below. 318 { 319 // "address" is the absolute module address, which callers must treat as 320 // opaque but may do full string comparisons with other module address 321 // strings and may pass verbatim to other Terraform commands that are 322 // documented as accepting absolute module addresses. 323 "address": "module.child", 324 325 // "resources" is the same as in "root_module" above 326 "resources": [ 327 { 328 "address": "module.child.aws_instance.foo", 329 // etc, etc 330 } 331 ], 332 333 // Each module object can optionally have its own 334 // nested "child_modules", recursively describing the 335 // full module tree. 336 "child_modules": [ ... ], 337 } 338 ] 339 } 340 } 341 ``` 342 343 The translation of attribute and output values is the same intuitive mapping from HCL types to JSON types used by Terraform's [`jsonencode`](/language/functions/jsonencode) function. This mapping does lose some information: lists, sets, and tuples all lower to JSON arrays while maps and objects both lower to JSON objects. Unknown values and null values are both treated as absent or null. 344 345 Output values include a `"type"` field, which is a [serialization of the value's type](https://pkg.go.dev/github.com/zclconf/go-cty/cty#Type.MarshalJSON). For primitive types this is a string value, such as `"number"` or `"bool"`. Complex types are represented as a nested JSON array, such as `["map","string"]` or `["object",{"a":"number"}]`. This can be used to reconstruct the output value with the correct type. 346 347 Only the "current" object for each resource instance is described. "Deposed" objects are not reflected in this structure at all; in plan representations, you can refer to the change representations for further details. 348 349 The intent of this structure is to give a caller access to a similar level of detail as is available to expressions within the configuration itself. This common representation is not suitable for all use-cases because it loses information compared to the data structures it is built from. For more complex needs, use the more elaborate changes and configuration representations. 350 351 ## Configuration Representation 352 353 Configuration is the most complicated structure in Terraform, since it includes unevaluated expression nodes and other complexities. 354 355 Because the configuration models are produced at a stage prior to expression evaluation, it is not possible to produce a values representation for configuration. Instead, we describe the physical structure of the configuration, giving access to constant values where possible and allowing callers to analyze any references to other objects that are present: 356 357 ```javascript 358 { 359 // "provider_configs" describes all of the provider configurations throughout 360 // the configuration tree, flattened into a single map for convenience since 361 // provider configurations are the one concept in Terraform that can span 362 // across module boundaries. 363 "provider_config": { 364 365 // Keys in the provider_configs map are to be considered opaque by callers, 366 // and used just for lookups using the "provider_config_key" property in each 367 // resource object. 368 "opaque_provider_ref_aws": { 369 370 // "name" is the name of the provider without any alias 371 "name": "aws", 372 373 // "full_name" is the fully-qualified provider name 374 "full_name": "registry.terraform.io/hashicorp/aws", 375 376 // "alias" is the alias set for a non-default configuration, or unset for 377 // a default configuration. 378 "alias": "foo", 379 380 // "module_address" is included only for provider configurations that are 381 // declared in a descendent module, and gives the opaque address for the 382 // module that contains the provider configuration. 383 "module_address": "module.child", 384 385 // "expressions" describes the provider-specific content of the 386 // configuration block, as a block expressions representation (see section 387 // below). 388 "expressions": <block-expressions-representation> 389 } 390 }, 391 392 // "root_module" describes the root module in the configuration, and serves 393 // as the root of a tree of similar objects describing descendent modules. 394 "root_module": { 395 396 // "outputs" describes the output value configurations in the module. 397 "outputs": { 398 399 // Property names here are the output value names 400 "example": { 401 "expression": <expression-representation>, 402 "sensitive": false 403 } 404 }, 405 406 // "resources" describes the "resource" and "data" blocks in the module 407 // configuration. 408 "resources": [ 409 { 410 // "address" is the opaque absolute address for the resource itself. 411 "address": "aws_instance.example", 412 413 // "mode", "type", and "name" have the same meaning as for the resource 414 // portion of a value representation. 415 "mode": "managed", 416 "type": "aws_instance", 417 "name": "example", 418 419 // "provider_config_key" is the key into "provider_configs" (shown 420 // above) for the provider configuration that this resource is 421 // associated with. If the provider configuration was passed into 422 // this module from the parent module, the key will point to the 423 // original provider config block. 424 "provider_config_key": "opaque_provider_ref_aws", 425 426 // "provisioners" is an optional field which describes any provisioners. 427 // Connection info will not be included here. 428 "provisioners": [ 429 { 430 "type": "local-exec", 431 432 // "expressions" describes the provisioner configuration 433 "expressions": <block-expressions-representation> 434 }, 435 ], 436 437 // "expressions" describes the resource-type-specific content of the 438 // configuration block. 439 "expressions": <block-expressions-representation>, 440 441 // "schema_version" is the schema version number indicated by the 442 // provider for the type-specific arguments described in "expressions". 443 "schema_version": 2, 444 445 // "count_expression" and "for_each_expression" describe the expressions 446 // given for the corresponding meta-arguments in the resource 447 // configuration block. These are omitted if the corresponding argument 448 // isn't set. 449 "count_expression": <expression-representation>, 450 "for_each_expression": <expression-representation> 451 }, 452 ], 453 454 // "module_calls" describes the "module" blocks in the module. During 455 // evaluation, a module call with count or for_each may expand to multiple 456 // module instances, but in configuration only the block itself is 457 // represented. 458 "module_calls": { 459 460 // Key is the module call name chosen in the configuration. 461 "child": { 462 463 // "resolved_source" is the resolved source address of the module, after 464 // any normalization and expansion. This could be either a 465 // go-getter-style source address or a local path starting with "./" or 466 // "../". If the user gave a registry source address then this is the 467 // final location of the module as returned by the registry, after 468 // following any redirect indirection. 469 "resolved_source": "./child" 470 471 // "expressions" describes the expressions for the arguments within the 472 // block that correspond to input variables in the child module. 473 "expressions": <block-expressions-representation>, 474 475 // "count_expression" and "for_each_expression" describe the expressions 476 // given for the corresponding meta-arguments in the module 477 // configuration block. These are omitted if the corresponding argument 478 // isn't set. 479 "count_expression": <expression-representation>, 480 "for_each_expression": <expression-representation>, 481 482 // "module" is a representation of the configuration of the child module 483 // itself, using the same structure as the "root_module" object, 484 // recursively describing the full module tree. 485 "module": <module-configuration-representation> 486 } 487 } 488 } 489 } 490 ``` 491 492 ### Expression Representation 493 494 Each unevaluated expression in the configuration is represented with an `<expression-representation>` object with the following structure: 495 496 ```javascript 497 { 498 // "constant_value" is set only if the expression contains no references to 499 // other objects, in which case it gives the resulting constant value. This is 500 // mapped as for the individual values in a value representation. 501 "constant_value": "hello", 502 503 // Alternatively, "references" will be set to a list of references in the 504 // expression. Multi-step references will be unwrapped and duplicated for each 505 // significant traversal step, allowing callers to more easily recognize the 506 // objects they care about without attempting to parse the expressions. 507 // Callers should only use string equality checks here, since the syntax may 508 // be extended in future releases. 509 "references": [ 510 "data.template_file.foo[1].vars[\"baz\"]", 511 "data.template_file.foo[1].vars", // implied by previous 512 "data.template_file.foo[1]", // implied by previous 513 "data.template_file.foo", // implied by previous 514 "module.foo.bar", 515 "module.foo", // implied by the previous 516 "var.example[0]", 517 "var.example", // implied by the previous 518 519 // Partial references like "data" and "module" are not included, because 520 // Terraform considers "module.foo" to be an atomic reference, not an 521 // attribute access. 522 ] 523 } 524 ``` 525 526 -> **Note:** Expressions in `dynamic` blocks are not included in the configuration representation. 527 528 ### Block Expressions Representation 529 530 In some cases, it is the entire content of a block (possibly after certain special arguments have already been handled and removed) that must be represented. For that, we have an `<block-expressions-representation>` structure: 531 532 ```javascript 533 { 534 // Attribute arguments are mapped directly with the attribute name as key and 535 // an <expression-representation> as value. 536 "ami": <expression-representation>, 537 "instance_type": <expression-representation>, 538 539 // Nested block arguments are mapped as either a single nested 540 // <block-expressions-representation> or an array object of these, depending on the 541 // block nesting mode chosen in the schema. 542 // - "single" nesting is a direct <block-expressions-representation> 543 // - "list" and "set" produce arrays 544 // - "map" produces an object 545 "root_block_device": <expression-representation>, 546 "ebs_block_device": [ 547 <expression-representation> 548 ] 549 } 550 ``` 551 552 For now we expect callers to just hard-code assumptions about the schemas of particular resource types in order to process these expression representations. In a later release we will add new inspection commands to return machine-readable descriptions of the schemas themselves, allowing for more generic handling in programs such as visualization tools. 553 554 ## Change Representation 555 556 A `<change-representation>` describes the change to the indicated object. 557 558 ```javascript 559 { 560 // "actions" are the actions that will be taken on the object selected by the 561 // properties below. 562 // Valid actions values are: 563 // ["no-op"] 564 // ["create"] 565 // ["read"] 566 // ["update"] 567 // ["delete", "create"] 568 // ["create", "delete"] 569 // ["delete"] 570 // The two "replace" actions are represented in this way to allow callers to 571 // e.g. just scan the list for "delete" to recognize all three situations 572 // where the object will be deleted, allowing for any new deletion 573 // combinations that might be added in future. 574 "actions": ["update"], 575 576 // "before" and "after" are representations of the object value both before 577 // and after the action. For ["create"] and ["delete"] actions, either 578 // "before" or "after" is unset (respectively). For ["no-op"], the before and 579 // after values are identical. The "after" value will be incomplete if there 580 // are values within it that won't be known until after apply. 581 "before": <value-representation>, 582 "after": <value-representation>, 583 584 // "after_unknown" is an object value with similar structure to "after", but 585 // with all unknown leaf values replaced with "true", and all known leaf 586 // values omitted. This can be combined with "after" to reconstruct a full 587 // value after the action, including values which will only be known after 588 // apply. 589 "after_unknown": { 590 "id": true 591 }, 592 593 // "before_sensitive" and "after_sensitive" are object values with similar 594 // structure to "before" and "after", but with all sensitive leaf values 595 // replaced with true, and all non-sensitive leaf values omitted. These 596 // objects should be combined with "before" and "after" to prevent accidental 597 // display of sensitive values in user interfaces. 598 "before_sensitive": {}, 599 "after_sensitive": { 600 "triggers": { 601 "boop": true 602 } 603 }, 604 605 // "replace_paths" is an array of arrays representing a set of paths into the 606 // object value which resulted in the action being "replace". This will be 607 // omitted if the action is not replace, or if no paths caused the 608 // replacement (for example, if the resource was tainted). Each path 609 // consists of one or more steps, each of which will be a number or a 610 // string. 611 "replace_paths": [["triggers"]] 612 } 613 ``` 614 615 ## Checks Representation 616 617 ~> **Warning:** The JSON representation of "checks" is currently experimental 618 and some details may change in future Terraform versions based on feedback, 619 even in minor releases of Terraform CLI. 620 621 A `<checks-representation>` describes the current state of a checkable object in the configuration. For example, a resource with one or more preconditions or postconditions is an example of a checkable object, and its check state represents the results of those conditions. 622 623 ```javascript 624 [ 625 { 626 // "address" describes the address of the checkable object whose status 627 // this object is describing. 628 "address": { 629 // "kind" specifies what kind of checkable object this is. Different 630 // kinds of object will have different additional properties inside the 631 // address object, but all kinds include both "kind" and "to_display". 632 // Currently the two valid kinds are "resource" and "output_value", but 633 // additional kinds may be added in future Terraform versions. 634 "kind": "resource", 635 636 // "to_display" contains an opaque string representation of the address 637 // of the object that is suitable for display in a UI. For consumers that 638 // have special handling depending on the value of "kind", this property 639 // is a good fallback to use when the application doesn't recognize the 640 // "kind" value. 641 "to_display": "aws_instance.example", 642 643 // "mode" is included for kind "resource" only, and specifies the resource 644 // mode which can either be "managed" (for "resource" blocks) or "data" 645 // (for "data" blocks). 646 "mode": "managed", 647 648 // "type" is included for kind "resource" only, and specifies the resource 649 // type. 650 "type": "aws_instance", 651 652 // "name" is the local name of the object. For a resource this is the 653 // second label in the resource block header, and for an output value 654 // this is the single label in the output block header. 655 "name": "example", 656 657 // "module" is included if the object belongs to a module other than 658 // the root module, and provides an opaque string representation of the 659 // module this object belongs to. This example is of a root module 660 // resource and so "module" is not included. 661 } 662 663 // "status" is the aggregate status of all of the instances of the object 664 // being described by this object. 665 // The possible values are "pass", "fail", "error", and "unknown". 666 "status": "fail", 667 668 // "instances" describes the current status of each of the instances of 669 // the object being described. An object can have multiple instances if 670 // it is either a resource which has "count" or "for_each" set, or if 671 // it's contained within a module that has "count" or "for_each" set. 672 // 673 // If "instances" is empty or omitted, that can either mean that the object 674 // has no instances at all (e.g. count = 0) or that an error blocked 675 // evaluation of the repetition argument. You can distinguish these cases 676 // using the "status" property, which will be "pass" or "error" for a 677 // zero-instance object and "unknown" for situations where an error blocked 678 // evalation. 679 "instances": [ 680 { 681 // "address" is an object similar to the property of the same name in 682 // the containing object. Merge the instance-level address into the 683 // object-level address, overwriting any conflicting property names, 684 // to create a full description of the instance's address. 685 "address": { 686 // "to_display" overrides the property of the same name in the main 687 // object's address, to include any module instance or resource 688 // instance keys that uniquely identify this instance. 689 "to_display": "aws_instance.example[0]", 690 691 // "instance_key" is included for resources only and specifies the 692 // resource-level instance key, which can either be a number or a 693 // string. Omitted for single-instance resources. 694 "instance_key": 0, 695 696 // "module" is included if the object belongs to a module other than 697 // the root module, and provides an opaque string representation of the 698 // module instance this object belongs to. 699 }, 700 701 // "status" describes the result of running the configured checks 702 // against this particular instance of the object, with the same 703 // possible values as the "status" in the parent object. 704 // 705 // "fail" means that the condition evaluated successfully but returned 706 // false, while "error" means that the condition expression itself 707 // was invalid. 708 "status": "fail", 709 710 // "problems" might be included for statuses "fail" or "error", in 711 // which case it describes the individual conditions that failed for 712 // this instance, if any. 713 // When a condition expression is invalid, Terraform returns that as 714 // a normal error message rather than as a problem in this list. 715 "problems": [ 716 { 717 // "message" is the string that resulted from evaluating the 718 // error_message argument of the failing condition. 719 "message": "Server does not have a public IPv6 address." 720 } 721 ] 722 }, 723 ] 724 } 725 ] 726 ``` 727 728 The "checks" model includes both static checkable objects and instances of 729 those objects to ensure that the set of checkable objects will be consistent 730 even if an error prevents full evaluation of the configuration. Any object 731 in the configuration which has associated checks, such as a resource with 732 preconditions or postconditions, will always be included as a checkable object 733 even if a runtime error prevents Terraform from evaluating its "count" or 734 "for_each" argument and therefore determining which instances of that object 735 exist dynamically. 736 737 When summarizing checks in a UI, we recommend preferring to list only the 738 individual instances and typically ignoring the top-level objects altogether. 739 However, in any case where an object has _zero_ instances, the UI should show 740 the top-level object instead to serve as a placeholder so that the user can 741 see that Terraform recognized the existence of the checks, even if it wasn't 742 able to evaluate them on the most recent run.