github.com/graywolf-at-work-2/terraform-vendor@v1.4.5/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  	// PreviousAddress is the absolute address that this resource instance had
    52  	// at the conclusion of a previous run.
    53  	//
    54  	// This will typically be omitted, but will be present if the previous
    55  	// resource instance was subject to a "moved" block that we handled in the
    56  	// process of creating this plan.
    57  	//
    58  	// Note that this behavior diverges from the internal plan data structure,
    59  	// where the previous address is set equal to the current address in the
    60  	// common case, rather than being omitted.
    61  	PreviousAddress string `json:"previous_address,omitempty"`
    62  
    63  	// ModuleAddress is the module portion of the above address. Omitted if the
    64  	// instance is in the root module.
    65  	ModuleAddress string `json:"module_address,omitempty"`
    66  
    67  	// "managed" or "data"
    68  	Mode string `json:"mode,omitempty"`
    69  
    70  	Type         string          `json:"type,omitempty"`
    71  	Name         string          `json:"name,omitempty"`
    72  	Index        json.RawMessage `json:"index,omitempty"`
    73  	ProviderName string          `json:"provider_name,omitempty"`
    74  
    75  	// "deposed", if set, indicates that this action applies to a "deposed"
    76  	// object of the given instance rather than to its "current" object. Omitted
    77  	// for changes to the current object.
    78  	Deposed string `json:"deposed,omitempty"`
    79  
    80  	// Change describes the change that will be made to this object
    81  	Change Change `json:"change,omitempty"`
    82  
    83  	// ActionReason is a keyword representing some optional extra context
    84  	// for why the actions in Change.Actions were chosen.
    85  	//
    86  	// This extra detail is only for display purposes, to help a UI layer
    87  	// present some additional explanation to a human user. The possible
    88  	// values here might grow and change over time, so any consumer of this
    89  	// information should be resilient to encountering unrecognized values
    90  	// and treat them as an unspecified reason.
    91  	ActionReason string `json:"action_reason,omitempty"`
    92  }