github.com/jaredpalmer/terraform@v1.1.0-alpha20210908.0.20210911170307-88705c943a03/internal/command/jsonplan/resource.go (about)

     1  package jsonplan
     2  
     3  import (
     4  	"encoding/json"
     5  
     6  	"github.com/hashicorp/terraform/internal/addrs"
     7  )
     8  
     9  // Resource is the representation of a resource in the json plan
    10  type resource struct {
    11  	// Address is the absolute resource address
    12  	Address string `json:"address,omitempty"`
    13  
    14  	// Mode can be "managed" or "data"
    15  	Mode string `json:"mode,omitempty"`
    16  
    17  	Type string `json:"type,omitempty"`
    18  	Name string `json:"name,omitempty"`
    19  
    20  	// Index is omitted for a resource not using `count` or `for_each`
    21  	Index addrs.InstanceKey `json:"index,omitempty"`
    22  
    23  	// ProviderName allows the property "type" to be interpreted unambiguously
    24  	// in the unusual situation where a provider offers a resource type whose
    25  	// name does not start with its own name, such as the "googlebeta" provider
    26  	// offering "google_compute_instance".
    27  	ProviderName string `json:"provider_name,omitempty"`
    28  
    29  	// SchemaVersion indicates which version of the resource type schema the
    30  	// "values" property conforms to.
    31  	SchemaVersion uint64 `json:"schema_version"`
    32  
    33  	// AttributeValues is the JSON representation of the attribute values of the
    34  	// resource, whose structure depends on the resource type schema. Any
    35  	// unknown values are omitted or set to null, making them indistinguishable
    36  	// from absent values.
    37  	AttributeValues attributeValues `json:"values,omitempty"`
    38  
    39  	// SensitiveValues is similar to AttributeValues, but with all sensitive
    40  	// values replaced with true, and all non-sensitive leaf values omitted.
    41  	SensitiveValues json.RawMessage `json:"sensitive_values,omitempty"`
    42  }
    43  
    44  // resourceChange is a description of an individual change action that Terraform
    45  // plans to use to move from the prior state to a new state matching the
    46  // configuration.
    47  type resourceChange struct {
    48  	// Address is the absolute resource address
    49  	Address string `json:"address,omitempty"`
    50  
    51  	// ModuleAddress is the module portion of the above address. Omitted if the
    52  	// instance is in the root module.
    53  	ModuleAddress string `json:"module_address,omitempty"`
    54  
    55  	// "managed" or "data"
    56  	Mode string `json:"mode,omitempty"`
    57  
    58  	Type         string            `json:"type,omitempty"`
    59  	Name         string            `json:"name,omitempty"`
    60  	Index        addrs.InstanceKey `json:"index,omitempty"`
    61  	ProviderName string            `json:"provider_name,omitempty"`
    62  
    63  	// "deposed", if set, indicates that this action applies to a "deposed"
    64  	// object of the given instance rather than to its "current" object. Omitted
    65  	// for changes to the current object.
    66  	Deposed string `json:"deposed,omitempty"`
    67  
    68  	// Change describes the change that will be made to this object
    69  	Change change `json:"change,omitempty"`
    70  
    71  	// ActionReason is a keyword representing some optional extra context
    72  	// for why the actions in Change.Actions were chosen.
    73  	//
    74  	// This extra detail is only for display purposes, to help a UI layer
    75  	// present some additional explanation to a human user. The possible
    76  	// values here might grow and change over time, so any consumer of this
    77  	// information should be resilient to encountering unrecognized values
    78  	// and treat them as an unspecified reason.
    79  	ActionReason string `json:"action_reason,omitempty"`
    80  }