github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/plans/internal/planproto/planfile.proto (about) 1 syntax = "proto3"; 2 package tfplan; 3 4 // For Terraform's own parsing, the proto stub types go into an internal Go 5 // package. The public API is in github.com/hashicorp/terraform/plans/planfile . 6 option go_package = "github.com/hashicorp/terraform/plans/internal/planproto"; 7 8 // Plan is the root message type for the tfplan file 9 message Plan { 10 // Version is incremented whenever there is a breaking change to 11 // the serialization format. Programs reading serialized plans should 12 // verify that version is set to the expected value and abort processing 13 // if not. A breaking change is any change that may cause an older 14 // consumer to interpret the structure incorrectly. This number will 15 // not be incremented if an existing consumer can either safely ignore 16 // changes to the format or if an existing consumer would fail to process 17 // the file for another message- or field-specific reason. 18 uint64 version = 1; 19 20 // The variables that were set when creating the plan. Each value is 21 // a msgpack serialization of an HCL value. 22 map<string, DynamicValue> variables = 2; 23 24 // An unordered set of proposed changes to resources throughout the 25 // configuration, including any nested modules. Use the address of 26 // each resource to determine which module it belongs to. 27 repeated ResourceInstanceChange resource_changes = 3; 28 29 // An unordered set of proposed changes to outputs in the root module 30 // of the configuration. This set also includes "no action" changes for 31 // outputs that are not changing, as context for detecting inconsistencies 32 // at apply time. 33 repeated OutputChange output_changes = 4; 34 35 // An unordered set of target addresses to include when applying. If no 36 // target addresses are present, the plan applies to the whole 37 // configuration. 38 repeated string target_addrs = 5; 39 40 // The version string for the Terraform binary that created this plan. 41 string terraform_version = 14; 42 43 // SHA256 digests of all of the provider plugin binaries that were used 44 // in the creation of this plan. 45 map<string, Hash> provider_hashes = 15; 46 47 // Backend is a description of the backend configuration and other related 48 // settings at the time the plan was created. 49 Backend backend = 13; 50 } 51 52 // Backend is a description of backend configuration and other related settings. 53 message Backend { 54 string type = 1; 55 DynamicValue config = 2; 56 string workspace = 3; 57 } 58 59 // Action describes the type of action planned for an object. 60 // Not all action values are valid for all object types. 61 enum Action { 62 NOOP = 0; 63 CREATE = 1; 64 READ = 2; 65 UPDATE = 3; 66 DELETE = 5; 67 DELETE_THEN_CREATE = 6; 68 CREATE_THEN_DELETE = 7; 69 } 70 71 // Change represents a change made to some object, transforming it from an old 72 // state to a new state. 73 message Change { 74 // Not all action values are valid for all object types. Consult 75 // the documentation for any message that embeds Change. 76 Action action = 1; 77 78 // msgpack-encoded HCL values involved in the change. 79 // - For update and replace, two values are provided that give the old and new values, 80 // respectively. 81 // - For create, one value is provided that gives the new value to be created 82 // - For delete, one value is provided that describes the value being deleted 83 // - For read, two values are provided that give the prior value for this object 84 // (or null, if no prior value exists) and the value that was or will be read, 85 // respectively. 86 // - For no-op, one value is provided that is left unmodified by this non-change. 87 repeated DynamicValue values = 2; 88 } 89 90 message ResourceInstanceChange { 91 // module_path is an address to the module that defined this resource. 92 // module_path is omitted for resources in the root module. For descendent modules 93 // it is a string like module.foo.module.bar as would be seen at the beginning of a 94 // resource address. The format of this string is not yet frozen and so external 95 // callers should treat it as an opaque key for filtering purposes. 96 string module_path = 1; 97 98 // mode is the resource mode. 99 ResourceMode mode = 2; 100 enum ResourceMode { 101 managed = 0; // for "resource" blocks in configuration 102 data = 1; // for "data" blocks in configuration 103 } 104 105 // type is the resource type name, like "aws_instance". 106 string type = 3; 107 108 // name is the logical name of the resource as defined in configuration. 109 // For example, in aws_instance.foo this would be "foo". 110 string name = 4; 111 112 // instance_key is either an integer index or a string key, depending on which iteration 113 // attributes ("count" or "for_each") are being used for this resource. If none 114 // are in use, this field is omitted. 115 oneof instance_key { 116 string str = 5; 117 int64 int = 6; 118 }; 119 120 // deposed_key, if set, indicates that this change applies to a deposed 121 // object for the indicated instance with the given deposed key. If not 122 // set, the change applies to the instance's current object. 123 string deposed_key = 7; 124 125 // provider is the address of the provider configuration that this change 126 // was planned with, and thus the configuration that must be used to 127 // apply it. 128 string provider = 8; 129 130 // Description of the proposed change. May use "create", "read", "update", 131 // "replace" and "delete" actions. "no-op" changes are not currently used here 132 // but consumers must accept and discard them to allow for future expansion. 133 Change change = 9; 134 135 // raw blob value provided by the provider as additional context for the 136 // change. Must be considered an opaque value for any consumer other than 137 // the provider that generated it, and will be returned verbatim to the 138 // provider during the subsequent apply operation. 139 bytes private = 10; 140 141 // An unordered set of paths that prompted the change action to be 142 // "replace" rather than "update". Empty for any action other than 143 // "replace". 144 repeated Path required_replace = 11; 145 } 146 147 message OutputChange { 148 // Name of the output as defined in the root module. 149 string name = 1; 150 151 // Description of the proposed change. May use "no-op", "create", 152 // "update" and "delete" actions. 153 Change change = 2; 154 155 // Sensitive, if true, indicates that one or more of the values given 156 // in "change" is sensitive and should not be shown directly in any 157 // rendered plan. 158 bool sensitive = 3; 159 } 160 161 // DynamicValue represents a value whose type is not decided until runtime, 162 // often based on schema information obtained from a plugin. 163 // 164 // At present dynamic values are always encoded as msgpack, with extension 165 // id 0 used to represent the special "unknown" value indicating results 166 // that won't be known until after apply. 167 // 168 // In future other serialization formats may be used, possibly with a 169 // transitional period of including both as separate attributes of this type. 170 // Consumers must ignore attributes they don't support and fail if no supported 171 // attribute is present. The top-level format version will not be incremented 172 // for changes to the set of dynamic serialization formats. 173 message DynamicValue { 174 bytes msgpack = 1; 175 } 176 177 // Hash represents a hash value. 178 // 179 // At present hashes always use the SHA256 algorithm. In future other hash 180 // algorithms may be used, possibly with a transitional period of including 181 // both as separate attributes of this type. Consumers must ignore attributes 182 // they don't support and fail if no supported attribute is present. The 183 // top-level format version will not be incremented for changes to the set of 184 // hash algorithms. 185 message Hash { 186 bytes sha256 = 1; 187 } 188 189 // Path represents a set of steps to traverse into a data structure. It is 190 // used to refer to a sub-structure within a dynamic data structure presented 191 // separately. 192 message Path { 193 message Step { 194 oneof selector { 195 // Set "attribute_name" to represent looking up an attribute 196 // in the current object value. 197 string attribute_name = 1; 198 199 // Set "element_key" to represent looking up an element in 200 // an indexable collection type. 201 DynamicValue element_key = 2; 202 } 203 } 204 repeated Step steps = 1; 205 }