Field for the previous address of each resource instance in the plan

In order to expose the effect of any relevant "moved" statements we dealt
with prior to creating the plan, we'll record with each
ResourceInstanceChange both is current address and the address it was
tracked at for the previous run.

To save consumers of these objects from having to special-case the
situation where there _was_ no previous run (e.g. because this is a Create
change), we'll just pretend the previous run address was the same as the
current address in that case, the same as for an update without any
renaming in effect.

This includes a breaking change to the plan file format, but one that
doesn't require a version number increment because there is no ambiguity
between the two formats and so mismatched parsers will already fail with
an error message.

As of this commit we've just added the new field but not yet populated it
with any useful information: it always just matches Addr. A future commit
will wire this up to the result of applying the moves so that we can
populate it correctly. We also don't yet expose this new information
anywhere in the UI layer.
This commit is contained in:
Martin Atkins 2021-08-20 16:08:12 -07:00
parent c29e10b0f1
commit 22b36d1f4c
7 changed files with 241 additions and 344 deletions

View File

@ -147,6 +147,19 @@ type ResourceInstanceChange struct {
// will apply to. // will apply to.
Addr addrs.AbsResourceInstance Addr addrs.AbsResourceInstance
// PrevRunAddr is the absolute address that this resource instance had at
// the conclusion of a previous run.
//
// This will typically be the same as Addr, but can be different if the
// previous resource instance was subject to a "moved" block that we
// handled in the process of creating this plan.
//
// For the initial creation of a resource instance there isn't really any
// meaningful "previous run address", but PrevRunAddr will still be set
// equal to Addr in that case in order to simplify logic elsewhere which
// aims to detect and react to the movement of instances between addresses.
PrevRunAddr addrs.AbsResourceInstance
// DeposedKey is the identifier for a deposed object associated with the // DeposedKey is the identifier for a deposed object associated with the
// given instance, or states.NotDeposed if this change applies to the // given instance, or states.NotDeposed if this change applies to the
// current object. // current object.
@ -203,8 +216,15 @@ func (rc *ResourceInstanceChange) Encode(ty cty.Type) (*ResourceInstanceChangeSr
if err != nil { if err != nil {
return nil, err return nil, err
} }
prevRunAddr := rc.PrevRunAddr
if prevRunAddr.Resource.Resource.Type == "" {
// Suggests an old caller that hasn't been properly updated to
// populate this yet.
prevRunAddr = rc.Addr
}
return &ResourceInstanceChangeSrc{ return &ResourceInstanceChangeSrc{
Addr: rc.Addr, Addr: rc.Addr,
PrevRunAddr: prevRunAddr,
DeposedKey: rc.DeposedKey, DeposedKey: rc.DeposedKey,
ProviderAddr: rc.ProviderAddr, ProviderAddr: rc.ProviderAddr,
ChangeSrc: *cs, ChangeSrc: *cs,

View File

@ -16,6 +16,19 @@ type ResourceInstanceChangeSrc struct {
// will apply to. // will apply to.
Addr addrs.AbsResourceInstance Addr addrs.AbsResourceInstance
// PrevRunAddr is the absolute address that this resource instance had at
// the conclusion of a previous run.
//
// This will typically be the same as Addr, but can be different if the
// previous resource instance was subject to a "moved" block that we
// handled in the process of creating this plan.
//
// For the initial creation of a resource instance there isn't really any
// meaningful "previous run address", but PrevRunAddr will still be set
// equal to Addr in that case in order to simplify logic elsewhere which
// aims to detect and react to the movement of instances between addresses.
PrevRunAddr addrs.AbsResourceInstance
// DeposedKey is the identifier for a deposed object associated with the // DeposedKey is the identifier for a deposed object associated with the
// given instance, or states.NotDeposed if this change applies to the // given instance, or states.NotDeposed if this change applies to the
// current object. // current object.
@ -66,8 +79,15 @@ func (rcs *ResourceInstanceChangeSrc) Decode(ty cty.Type) (*ResourceInstanceChan
if err != nil { if err != nil {
return nil, err return nil, err
} }
prevRunAddr := rcs.PrevRunAddr
if prevRunAddr.Resource.Resource.Type == "" {
// Suggests an old caller that hasn't been properly updated to
// populate this yet.
prevRunAddr = rcs.Addr
}
return &ResourceInstanceChange{ return &ResourceInstanceChange{
Addr: rcs.Addr, Addr: rcs.Addr,
PrevRunAddr: prevRunAddr,
DeposedKey: rcs.DeposedKey, DeposedKey: rcs.DeposedKey,
ProviderAddr: rcs.ProviderAddr, ProviderAddr: rcs.ProviderAddr,
Change: *change, Change: *change,

View File

@ -194,52 +194,6 @@ func (ResourceInstanceActionReason) EnumDescriptor() ([]byte, []int) {
return file_planfile_proto_rawDescGZIP(), []int{2} return file_planfile_proto_rawDescGZIP(), []int{2}
} }
type ResourceInstanceChange_ResourceMode int32
const (
ResourceInstanceChange_managed ResourceInstanceChange_ResourceMode = 0 // for "resource" blocks in configuration
ResourceInstanceChange_data ResourceInstanceChange_ResourceMode = 1 // for "data" blocks in configuration
)
// Enum value maps for ResourceInstanceChange_ResourceMode.
var (
ResourceInstanceChange_ResourceMode_name = map[int32]string{
0: "managed",
1: "data",
}
ResourceInstanceChange_ResourceMode_value = map[string]int32{
"managed": 0,
"data": 1,
}
)
func (x ResourceInstanceChange_ResourceMode) Enum() *ResourceInstanceChange_ResourceMode {
p := new(ResourceInstanceChange_ResourceMode)
*p = x
return p
}
func (x ResourceInstanceChange_ResourceMode) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ResourceInstanceChange_ResourceMode) Descriptor() protoreflect.EnumDescriptor {
return file_planfile_proto_enumTypes[3].Descriptor()
}
func (ResourceInstanceChange_ResourceMode) Type() protoreflect.EnumType {
return &file_planfile_proto_enumTypes[3]
}
func (x ResourceInstanceChange_ResourceMode) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ResourceInstanceChange_ResourceMode.Descriptor instead.
func (ResourceInstanceChange_ResourceMode) EnumDescriptor() ([]byte, []int) {
return file_planfile_proto_rawDescGZIP(), []int{3, 0}
}
// Plan is the root message type for the tfplan file // Plan is the root message type for the tfplan file
type Plan struct { type Plan struct {
state protoimpl.MessageState state protoimpl.MessageState
@ -553,27 +507,16 @@ type ResourceInstanceChange struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
// module_path is an address to the module that defined this resource. // addr is a string representation of the resource instance address that
// module_path is omitted for resources in the root module. For descendent modules // this change will apply to.
// it is a string like module.foo.module.bar as would be seen at the beginning of a Addr string `protobuf:"bytes,13,opt,name=addr,proto3" json:"addr,omitempty"`
// resource address. The format of this string is not yet frozen and so external // prev_run_addr is a string representation of the address at which
// callers should treat it as an opaque key for filtering purposes. // this resource instance was tracked during the previous apply operation.
ModulePath string `protobuf:"bytes,1,opt,name=module_path,json=modulePath,proto3" json:"module_path,omitempty"`
// mode is the resource mode.
Mode ResourceInstanceChange_ResourceMode `protobuf:"varint,2,opt,name=mode,proto3,enum=tfplan.ResourceInstanceChange_ResourceMode" json:"mode,omitempty"`
// type is the resource type name, like "aws_instance".
Type string `protobuf:"bytes,3,opt,name=type,proto3" json:"type,omitempty"`
// name is the logical name of the resource as defined in configuration.
// For example, in aws_instance.foo this would be "foo".
Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
// instance_key is either an integer index or a string key, depending on which iteration
// attributes ("count" or "for_each") are being used for this resource. If none
// are in use, this field is omitted.
// //
// Types that are assignable to InstanceKey: // This is populated only if it would be different from addr due to
// *ResourceInstanceChange_Str // Terraform having reacted to refactoring annotations in the configuration.
// *ResourceInstanceChange_Int // If empty, the previous run address is the same as the current address.
InstanceKey isResourceInstanceChange_InstanceKey `protobuf_oneof:"instance_key"` PrevRunAddr string `protobuf:"bytes,14,opt,name=prev_run_addr,json=prevRunAddr,proto3" json:"prev_run_addr,omitempty"`
// deposed_key, if set, indicates that this change applies to a deposed // deposed_key, if set, indicates that this change applies to a deposed
// object for the indicated instance with the given deposed key. If not // object for the indicated instance with the given deposed key. If not
// set, the change applies to the instance's current object. // set, the change applies to the instance's current object.
@ -583,8 +526,7 @@ type ResourceInstanceChange struct {
// apply it. // apply it.
Provider string `protobuf:"bytes,8,opt,name=provider,proto3" json:"provider,omitempty"` Provider string `protobuf:"bytes,8,opt,name=provider,proto3" json:"provider,omitempty"`
// Description of the proposed change. May use "create", "read", "update", // Description of the proposed change. May use "create", "read", "update",
// "replace" and "delete" actions. "no-op" changes are not currently used here // "replace", "delete" and "no-op" actions.
// but consumers must accept and discard them to allow for future expansion.
Change *Change `protobuf:"bytes,9,opt,name=change,proto3" json:"change,omitempty"` Change *Change `protobuf:"bytes,9,opt,name=change,proto3" json:"change,omitempty"`
// raw blob value provided by the provider as additional context for the // raw blob value provided by the provider as additional context for the
// change. Must be considered an opaque value for any consumer other than // change. Must be considered an opaque value for any consumer other than
@ -633,55 +575,20 @@ func (*ResourceInstanceChange) Descriptor() ([]byte, []int) {
return file_planfile_proto_rawDescGZIP(), []int{3} return file_planfile_proto_rawDescGZIP(), []int{3}
} }
func (x *ResourceInstanceChange) GetModulePath() string { func (x *ResourceInstanceChange) GetAddr() string {
if x != nil { if x != nil {
return x.ModulePath return x.Addr
} }
return "" return ""
} }
func (x *ResourceInstanceChange) GetMode() ResourceInstanceChange_ResourceMode { func (x *ResourceInstanceChange) GetPrevRunAddr() string {
if x != nil { if x != nil {
return x.Mode return x.PrevRunAddr
}
return ResourceInstanceChange_managed
}
func (x *ResourceInstanceChange) GetType() string {
if x != nil {
return x.Type
} }
return "" return ""
} }
func (x *ResourceInstanceChange) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (m *ResourceInstanceChange) GetInstanceKey() isResourceInstanceChange_InstanceKey {
if m != nil {
return m.InstanceKey
}
return nil
}
func (x *ResourceInstanceChange) GetStr() string {
if x, ok := x.GetInstanceKey().(*ResourceInstanceChange_Str); ok {
return x.Str
}
return ""
}
func (x *ResourceInstanceChange) GetInt() int64 {
if x, ok := x.GetInstanceKey().(*ResourceInstanceChange_Int); ok {
return x.Int
}
return 0
}
func (x *ResourceInstanceChange) GetDeposedKey() string { func (x *ResourceInstanceChange) GetDeposedKey() string {
if x != nil { if x != nil {
return x.DeposedKey return x.DeposedKey
@ -724,22 +631,6 @@ func (x *ResourceInstanceChange) GetActionReason() ResourceInstanceActionReason
return ResourceInstanceActionReason_NONE return ResourceInstanceActionReason_NONE
} }
type isResourceInstanceChange_InstanceKey interface {
isResourceInstanceChange_InstanceKey()
}
type ResourceInstanceChange_Str struct {
Str string `protobuf:"bytes,5,opt,name=str,proto3,oneof"`
}
type ResourceInstanceChange_Int struct {
Int int64 `protobuf:"varint,6,opt,name=int,proto3,oneof"`
}
func (*ResourceInstanceChange_Str) isResourceInstanceChange_InstanceKey() {}
func (*ResourceInstanceChange_Int) isResourceInstanceChange_InstanceKey() {}
type OutputChange struct { type OutputChange struct {
state protoimpl.MessageState state protoimpl.MessageState
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
@ -1125,84 +1016,73 @@ var file_planfile_proto_rawDesc = []byte{
0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0c, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x52, 0x13, 0x61, 0x0c, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x52, 0x13, 0x61,
0x66, 0x74, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x66, 0x74, 0x65, 0x72, 0x53, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74,
0x68, 0x73, 0x22, 0x84, 0x04, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x68, 0x73, 0x22, 0xd3, 0x02, 0x0a, 0x16, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49,
0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a,
0x0b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x04, 0x61, 0x64, 0x64, 0x72, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x61, 0x64, 0x64,
0x28, 0x09, 0x52, 0x0a, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x61, 0x74, 0x68, 0x12, 0x3f, 0x72, 0x12, 0x22, 0x0a, 0x0d, 0x70, 0x72, 0x65, 0x76, 0x5f, 0x72, 0x75, 0x6e, 0x5f, 0x61, 0x64,
0x0a, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x2b, 0x2e, 0x74, 0x64, 0x72, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x70, 0x72, 0x65, 0x76, 0x52, 0x75,
0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x6e, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x65, 0x64,
0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x2e, 0x52, 0x65, 0x73, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x6f,
0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x73, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64,
0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64,
0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01,
0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x03, 0x73, 0x74, 0x72, 0x18, 0x05, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x6e,
0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x03, 0x73, 0x74, 0x72, 0x12, 0x12, 0x0a, 0x03, 0x69, 0x67, 0x65, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72,
0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x00, 0x52, 0x03, 0x69, 0x6e, 0x74, 0x12, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x69,
0x1f, 0x0a, 0x0b, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x07, 0x76, 0x61, 0x74, 0x65, 0x12, 0x37, 0x0a, 0x10, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64,
0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c,
0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0f, 0x72, 0x65,
0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x12, 0x26, 0x0a, 0x06, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x49, 0x0a,
0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0c,
0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x52, 0x65,
0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x22, 0x68, 0x0a, 0x0c, 0x4f, 0x75, 0x74, 0x70,
0x75, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65,
0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x06,
0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x74,
0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x63, 0x68, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x63, 0x68,
0x61, 0x6e, 0x67, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x18, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76,
0x0a, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x70, 0x72, 0x69, 0x76, 0x61, 0x74, 0x65, 0x12, 0x37, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69,
0x0a, 0x10, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x72, 0x65, 0x70, 0x6c, 0x61, 0x76, 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x56, 0x61, 0x6c,
0x63, 0x65, 0x18, 0x0b, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x70, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x20,
0x6e, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0f, 0x72, 0x65, 0x71, 0x75, 0x69, 0x72, 0x65, 0x64, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x70, 0x61, 0x63, 0x6b, 0x22, 0x1e, 0x0a, 0x04,
0x52, 0x65, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x49, 0x0a, 0x0d, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x48, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x01,
0x6e, 0x5f, 0x72, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x22, 0xa5, 0x01, 0x0a,
0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x01,
0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x61,
0x61, 0x73, 0x6f, 0x6e, 0x52, 0x0c, 0x61, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x74, 0x68, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x52, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x74,
0x6f, 0x6e, 0x22, 0x25, 0x0a, 0x0c, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4d, 0x6f, 0x0a, 0x04, 0x53, 0x74, 0x65, 0x70, 0x12, 0x27, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62,
0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x61, 0x67, 0x65, 0x64, 0x10, 0x00, 0x12, 0x75, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x00,
0x08, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x10, 0x01, 0x42, 0x0e, 0x0a, 0x0c, 0x69, 0x6e, 0x73, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12,
0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x22, 0x68, 0x0a, 0x0c, 0x4f, 0x75, 0x74, 0x37, 0x0a, 0x0b, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02,
0x70, 0x75, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x44, 0x79,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x26, 0x0a, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x6c,
0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x65,
0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x63, 0x63, 0x74, 0x6f, 0x72, 0x2a, 0x31, 0x0a, 0x04, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0a, 0x0a, 0x06,
0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x54,
0x76, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x52, 0x4f, 0x59, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x48,
0x69, 0x76, 0x65, 0x22, 0x28, 0x0a, 0x0c, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x56, 0x61, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x2a, 0x70, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6f,
0x6c, 0x75, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x73, 0x67, 0x70, 0x61, 0x63, 0x6b, 0x18, 0x01, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4f, 0x50, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x43,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x6d, 0x73, 0x67, 0x70, 0x61, 0x63, 0x6b, 0x22, 0x1e, 0x0a, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x10,
0x04, 0x48, 0x61, 0x73, 0x68, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x18, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a, 0x0a,
0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x73, 0x68, 0x61, 0x32, 0x35, 0x36, 0x22, 0xa5, 0x01, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x45, 0x4c,
0x0a, 0x04, 0x50, 0x61, 0x74, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x18, 0x45, 0x54, 0x45, 0x5f, 0x54, 0x48, 0x45, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x48, 0x45, 0x4e,
0x61, 0x74, 0x68, 0x2e, 0x53, 0x74, 0x65, 0x70, 0x52, 0x05, 0x73, 0x74, 0x65, 0x70, 0x73, 0x1a, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x07, 0x2a, 0x80, 0x01, 0x0a, 0x1c, 0x52, 0x65,
0x74, 0x0a, 0x04, 0x53, 0x74, 0x65, 0x70, 0x12, 0x27, 0x0a, 0x0e, 0x61, 0x74, 0x74, 0x72, 0x69, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x63,
0x62, 0x75, 0x74, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x48, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f,
0x00, 0x52, 0x0d, 0x61, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f,
0x12, 0x37, 0x0a, 0x0b, 0x65, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x42, 0x45, 0x43, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x54, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x44, 0x10,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x44, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x42, 0x59, 0x5f,
0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x48, 0x00, 0x52, 0x0a, 0x65, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x52, 0x45, 0x50,
0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x4b, 0x65, 0x79, 0x42, 0x0a, 0x0a, 0x08, 0x73, 0x65, 0x6c, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x42, 0x45, 0x43, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x43, 0x41, 0x4e,
0x65, 0x63, 0x74, 0x6f, 0x72, 0x2a, 0x31, 0x0a, 0x04, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x0a, 0x0a, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x42, 0x42, 0x5a, 0x40,
0x06, 0x4e, 0x4f, 0x52, 0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x45, 0x53, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68, 0x69,
0x54, 0x52, 0x4f, 0x59, 0x10, 0x01, 0x12, 0x10, 0x0a, 0x0c, 0x52, 0x45, 0x46, 0x52, 0x45, 0x53, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x74, 0x65, 0x72, 0x72, 0x61, 0x66, 0x6f, 0x72, 0x6d, 0x2f, 0x69,
0x48, 0x5f, 0x4f, 0x4e, 0x4c, 0x59, 0x10, 0x02, 0x2a, 0x70, 0x0a, 0x06, 0x41, 0x63, 0x74, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x2f, 0x69, 0x6e,
0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e, 0x4f, 0x4f, 0x50, 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, 0x45, 0x41, 0x44, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x12, 0x0a,
0x0a, 0x06, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x05, 0x12, 0x16, 0x0a, 0x12, 0x44, 0x45,
0x4c, 0x45, 0x54, 0x45, 0x5f, 0x54, 0x48, 0x45, 0x4e, 0x5f, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45,
0x10, 0x06, 0x12, 0x16, 0x0a, 0x12, 0x43, 0x52, 0x45, 0x41, 0x54, 0x45, 0x5f, 0x54, 0x48, 0x45,
0x4e, 0x5f, 0x44, 0x45, 0x4c, 0x45, 0x54, 0x45, 0x10, 0x07, 0x2a, 0x80, 0x01, 0x0a, 0x1c, 0x52,
0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x12, 0x08, 0x0a, 0x04, 0x4e,
0x4f, 0x4e, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45,
0x5f, 0x42, 0x45, 0x43, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x54, 0x41, 0x49, 0x4e, 0x54, 0x45, 0x44,
0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x52, 0x45, 0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x42, 0x59,
0x5f, 0x52, 0x45, 0x51, 0x55, 0x45, 0x53, 0x54, 0x10, 0x02, 0x12, 0x21, 0x0a, 0x1d, 0x52, 0x45,
0x50, 0x4c, 0x41, 0x43, 0x45, 0x5f, 0x42, 0x45, 0x43, 0x41, 0x55, 0x53, 0x45, 0x5f, 0x43, 0x41,
0x4e, 0x4e, 0x4f, 0x54, 0x5f, 0x55, 0x50, 0x44, 0x41, 0x54, 0x45, 0x10, 0x03, 0x42, 0x42, 0x5a,
0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x68, 0x61, 0x73, 0x68,
0x69, 0x63, 0x6f, 0x72, 0x70, 0x2f, 0x74, 0x65, 0x72, 0x72, 0x61, 0x66, 0x6f, 0x72, 0x6d, 0x2f,
0x69, 0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x73, 0x2f, 0x69,
0x6e, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x2f, 0x70, 0x6c, 0x61, 0x6e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
} }
var ( var (
@ -1217,51 +1097,49 @@ func file_planfile_proto_rawDescGZIP() []byte {
return file_planfile_proto_rawDescData return file_planfile_proto_rawDescData
} }
var file_planfile_proto_enumTypes = make([]protoimpl.EnumInfo, 4) var file_planfile_proto_enumTypes = make([]protoimpl.EnumInfo, 3)
var file_planfile_proto_msgTypes = make([]protoimpl.MessageInfo, 11) var file_planfile_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
var file_planfile_proto_goTypes = []interface{}{ var file_planfile_proto_goTypes = []interface{}{
(Mode)(0), // 0: tfplan.Mode (Mode)(0), // 0: tfplan.Mode
(Action)(0), // 1: tfplan.Action (Action)(0), // 1: tfplan.Action
(ResourceInstanceActionReason)(0), // 2: tfplan.ResourceInstanceActionReason (ResourceInstanceActionReason)(0), // 2: tfplan.ResourceInstanceActionReason
(ResourceInstanceChange_ResourceMode)(0), // 3: tfplan.ResourceInstanceChange.ResourceMode (*Plan)(nil), // 3: tfplan.Plan
(*Plan)(nil), // 4: tfplan.Plan (*Backend)(nil), // 4: tfplan.Backend
(*Backend)(nil), // 5: tfplan.Backend (*Change)(nil), // 5: tfplan.Change
(*Change)(nil), // 6: tfplan.Change (*ResourceInstanceChange)(nil), // 6: tfplan.ResourceInstanceChange
(*ResourceInstanceChange)(nil), // 7: tfplan.ResourceInstanceChange (*OutputChange)(nil), // 7: tfplan.OutputChange
(*OutputChange)(nil), // 8: tfplan.OutputChange (*DynamicValue)(nil), // 8: tfplan.DynamicValue
(*DynamicValue)(nil), // 9: tfplan.DynamicValue (*Hash)(nil), // 9: tfplan.Hash
(*Hash)(nil), // 10: tfplan.Hash (*Path)(nil), // 10: tfplan.Path
(*Path)(nil), // 11: tfplan.Path nil, // 11: tfplan.Plan.VariablesEntry
nil, // 12: tfplan.Plan.VariablesEntry nil, // 12: tfplan.Plan.ProviderHashesEntry
nil, // 13: tfplan.Plan.ProviderHashesEntry (*Path_Step)(nil), // 13: tfplan.Path.Step
(*Path_Step)(nil), // 14: tfplan.Path.Step
} }
var file_planfile_proto_depIdxs = []int32{ var file_planfile_proto_depIdxs = []int32{
0, // 0: tfplan.Plan.ui_mode:type_name -> tfplan.Mode 0, // 0: tfplan.Plan.ui_mode:type_name -> tfplan.Mode
12, // 1: tfplan.Plan.variables:type_name -> tfplan.Plan.VariablesEntry 11, // 1: tfplan.Plan.variables:type_name -> tfplan.Plan.VariablesEntry
7, // 2: tfplan.Plan.resource_changes:type_name -> tfplan.ResourceInstanceChange 6, // 2: tfplan.Plan.resource_changes:type_name -> tfplan.ResourceInstanceChange
8, // 3: tfplan.Plan.output_changes:type_name -> tfplan.OutputChange 7, // 3: tfplan.Plan.output_changes:type_name -> tfplan.OutputChange
13, // 4: tfplan.Plan.provider_hashes:type_name -> tfplan.Plan.ProviderHashesEntry 12, // 4: tfplan.Plan.provider_hashes:type_name -> tfplan.Plan.ProviderHashesEntry
5, // 5: tfplan.Plan.backend:type_name -> tfplan.Backend 4, // 5: tfplan.Plan.backend:type_name -> tfplan.Backend
9, // 6: tfplan.Backend.config:type_name -> tfplan.DynamicValue 8, // 6: tfplan.Backend.config:type_name -> tfplan.DynamicValue
1, // 7: tfplan.Change.action:type_name -> tfplan.Action 1, // 7: tfplan.Change.action:type_name -> tfplan.Action
9, // 8: tfplan.Change.values:type_name -> tfplan.DynamicValue 8, // 8: tfplan.Change.values:type_name -> tfplan.DynamicValue
11, // 9: tfplan.Change.before_sensitive_paths:type_name -> tfplan.Path 10, // 9: tfplan.Change.before_sensitive_paths:type_name -> tfplan.Path
11, // 10: tfplan.Change.after_sensitive_paths:type_name -> tfplan.Path 10, // 10: tfplan.Change.after_sensitive_paths:type_name -> tfplan.Path
3, // 11: tfplan.ResourceInstanceChange.mode:type_name -> tfplan.ResourceInstanceChange.ResourceMode 5, // 11: tfplan.ResourceInstanceChange.change:type_name -> tfplan.Change
6, // 12: tfplan.ResourceInstanceChange.change:type_name -> tfplan.Change 10, // 12: tfplan.ResourceInstanceChange.required_replace:type_name -> tfplan.Path
11, // 13: tfplan.ResourceInstanceChange.required_replace:type_name -> tfplan.Path 2, // 13: tfplan.ResourceInstanceChange.action_reason:type_name -> tfplan.ResourceInstanceActionReason
2, // 14: tfplan.ResourceInstanceChange.action_reason:type_name -> tfplan.ResourceInstanceActionReason 5, // 14: tfplan.OutputChange.change:type_name -> tfplan.Change
6, // 15: tfplan.OutputChange.change:type_name -> tfplan.Change 13, // 15: tfplan.Path.steps:type_name -> tfplan.Path.Step
14, // 16: tfplan.Path.steps:type_name -> tfplan.Path.Step 8, // 16: tfplan.Plan.VariablesEntry.value:type_name -> tfplan.DynamicValue
9, // 17: tfplan.Plan.VariablesEntry.value:type_name -> tfplan.DynamicValue 9, // 17: tfplan.Plan.ProviderHashesEntry.value:type_name -> tfplan.Hash
10, // 18: tfplan.Plan.ProviderHashesEntry.value:type_name -> tfplan.Hash 8, // 18: tfplan.Path.Step.element_key:type_name -> tfplan.DynamicValue
9, // 19: tfplan.Path.Step.element_key:type_name -> tfplan.DynamicValue 19, // [19:19] is the sub-list for method output_type
20, // [20:20] is the sub-list for method output_type 19, // [19:19] is the sub-list for method input_type
20, // [20:20] is the sub-list for method input_type 19, // [19:19] is the sub-list for extension type_name
20, // [20:20] is the sub-list for extension type_name 19, // [19:19] is the sub-list for extension extendee
20, // [20:20] is the sub-list for extension extendee 0, // [0:19] is the sub-list for field type_name
0, // [0:20] is the sub-list for field type_name
} }
func init() { file_planfile_proto_init() } func init() { file_planfile_proto_init() }
@ -1379,10 +1257,6 @@ func file_planfile_proto_init() {
} }
} }
} }
file_planfile_proto_msgTypes[3].OneofWrappers = []interface{}{
(*ResourceInstanceChange_Str)(nil),
(*ResourceInstanceChange_Int)(nil),
}
file_planfile_proto_msgTypes[10].OneofWrappers = []interface{}{ file_planfile_proto_msgTypes[10].OneofWrappers = []interface{}{
(*Path_Step_AttributeName)(nil), (*Path_Step_AttributeName)(nil),
(*Path_Step_ElementKey)(nil), (*Path_Step_ElementKey)(nil),
@ -1392,7 +1266,7 @@ func file_planfile_proto_init() {
File: protoimpl.DescBuilder{ File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(), GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_planfile_proto_rawDesc, RawDescriptor: file_planfile_proto_rawDesc,
NumEnums: 4, NumEnums: 3,
NumMessages: 11, NumMessages: 11,
NumExtensions: 0, NumExtensions: 0,
NumServices: 0, NumServices: 0,

View File

@ -129,34 +129,23 @@ enum ResourceInstanceActionReason {
} }
message ResourceInstanceChange { message ResourceInstanceChange {
// module_path is an address to the module that defined this resource. // addr is a string representation of the resource instance address that
// module_path is omitted for resources in the root module. For descendent modules // this change will apply to.
// it is a string like module.foo.module.bar as would be seen at the beginning of a string addr = 13;
// resource address. The format of this string is not yet frozen and so external
// callers should treat it as an opaque key for filtering purposes.
string module_path = 1;
// mode is the resource mode. // prev_run_addr is a string representation of the address at which
ResourceMode mode = 2; // this resource instance was tracked during the previous apply operation.
enum ResourceMode { //
managed = 0; // for "resource" blocks in configuration // This is populated only if it would be different from addr due to
data = 1; // for "data" blocks in configuration // Terraform having reacted to refactoring annotations in the configuration.
} // If empty, the previous run address is the same as the current address.
string prev_run_addr = 14;
// type is the resource type name, like "aws_instance". // NOTE: Earlier versions of this format had fields 1 through 6 describing
string type = 3; // various indivdual parts of "addr". We're now using our standard compact
// string representation to capture the same information. We don't support
// name is the logical name of the resource as defined in configuration. // preserving plan files from one Terraform version to the next, so we
// For example, in aws_instance.foo this would be "foo". // no longer declare nor accept those fields.
string name = 4;
// instance_key is either an integer index or a string key, depending on which iteration
// attributes ("count" or "for_each") are being used for this resource. If none
// are in use, this field is omitted.
oneof instance_key {
string str = 5;
int64 int = 6;
};
// deposed_key, if set, indicates that this change applies to a deposed // deposed_key, if set, indicates that this change applies to a deposed
// object for the indicated instance with the given deposed key. If not // object for the indicated instance with the given deposed key. If not
@ -169,8 +158,7 @@ message ResourceInstanceChange {
string provider = 8; string provider = 8;
// Description of the proposed change. May use "create", "read", "update", // Description of the proposed change. May use "create", "read", "update",
// "replace" and "delete" actions. "no-op" changes are not currently used here // "replace", "delete" and "no-op" actions.
// but consumers must accept and discard them to allow for future expansion.
Change change = 9; Change change = 9;
// raw blob value provided by the provider as additional context for the // raw blob value provided by the provider as additional context for the

View File

@ -12,7 +12,6 @@ import (
"github.com/hashicorp/terraform/internal/plans" "github.com/hashicorp/terraform/internal/plans"
"github.com/hashicorp/terraform/internal/plans/internal/planproto" "github.com/hashicorp/terraform/internal/plans/internal/planproto"
"github.com/hashicorp/terraform/internal/states" "github.com/hashicorp/terraform/internal/states"
"github.com/hashicorp/terraform/internal/tfdiags"
"github.com/hashicorp/terraform/version" "github.com/hashicorp/terraform/version"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
@ -157,12 +156,23 @@ func resourceChangeFromTfplan(rawChange *planproto.ResourceInstanceChange) (*pla
ret := &plans.ResourceInstanceChangeSrc{} ret := &plans.ResourceInstanceChangeSrc{}
moduleAddr := addrs.RootModuleInstance if rawChange.Addr == "" {
if rawChange.ModulePath != "" { // If "Addr" isn't populated then seems likely that this is a plan
var diags tfdiags.Diagnostics // file created by an earlier version of Terraform, which had the
moduleAddr, diags = addrs.ParseModuleInstanceStr(rawChange.ModulePath) // same information spread over various other fields:
// ModulePath, Mode, Name, Type, and InstanceKey.
return nil, fmt.Errorf("no instance address for resource instance change; perhaps this plan was created by a different version of Terraform?")
}
instAddr, diags := addrs.ParseAbsResourceInstanceStr(rawChange.Addr)
if diags.HasErrors() {
return nil, fmt.Errorf("invalid resource instance address %q: %w", rawChange.Addr, diags.Err())
}
prevRunAddr := instAddr
if rawChange.PrevRunAddr != "" {
prevRunAddr, diags = addrs.ParseAbsResourceInstanceStr(rawChange.PrevRunAddr)
if diags.HasErrors() { if diags.HasErrors() {
return nil, diags.Err() return nil, fmt.Errorf("invalid resource instance previous run address %q: %w", rawChange.PrevRunAddr, diags.Err())
} }
} }
@ -172,37 +182,8 @@ func resourceChangeFromTfplan(rawChange *planproto.ResourceInstanceChange) (*pla
} }
ret.ProviderAddr = providerAddr ret.ProviderAddr = providerAddr
var mode addrs.ResourceMode ret.Addr = instAddr
switch rawChange.Mode { ret.PrevRunAddr = prevRunAddr
case planproto.ResourceInstanceChange_managed:
mode = addrs.ManagedResourceMode
case planproto.ResourceInstanceChange_data:
mode = addrs.DataResourceMode
default:
return nil, fmt.Errorf("resource has invalid mode %s", rawChange.Mode)
}
typeName := rawChange.Type
name := rawChange.Name
resAddr := addrs.Resource{
Mode: mode,
Type: typeName,
Name: name,
}
var instKey addrs.InstanceKey
switch rawTk := rawChange.InstanceKey.(type) {
case nil:
case *planproto.ResourceInstanceChange_Int:
instKey = addrs.IntKey(rawTk.Int)
case *planproto.ResourceInstanceChange_Str:
instKey = addrs.StringKey(rawTk.Str)
default:
return nil, fmt.Errorf("instance of %s has invalid key type %T", resAddr.Absolute(moduleAddr), rawChange.InstanceKey)
}
ret.Addr = resAddr.Instance(instKey).Absolute(moduleAddr)
if rawChange.DeposedKey != "" { if rawChange.DeposedKey != "" {
if len(rawChange.DeposedKey) != 8 { if len(rawChange.DeposedKey) != 8 {
@ -454,35 +435,20 @@ func writeTfplan(plan *plans.Plan, w io.Writer) error {
func resourceChangeToTfplan(change *plans.ResourceInstanceChangeSrc) (*planproto.ResourceInstanceChange, error) { func resourceChangeToTfplan(change *plans.ResourceInstanceChangeSrc) (*planproto.ResourceInstanceChange, error) {
ret := &planproto.ResourceInstanceChange{} ret := &planproto.ResourceInstanceChange{}
ret.ModulePath = change.Addr.Module.String() if change.PrevRunAddr.Resource.Resource.Type == "" {
// Suggests that an old caller wasn't yet updated to populate this
relAddr := change.Addr.Resource // properly. All code that generates plans should populate this field,
// even if it's just to write in the same value as in change.Addr.
switch relAddr.Resource.Mode { change.PrevRunAddr = change.Addr
case addrs.ManagedResourceMode:
ret.Mode = planproto.ResourceInstanceChange_managed
case addrs.DataResourceMode:
ret.Mode = planproto.ResourceInstanceChange_data
default:
return nil, fmt.Errorf("resource %s has unsupported mode %s", relAddr, relAddr.Resource.Mode)
} }
ret.Type = relAddr.Resource.Type ret.Addr = change.Addr.String()
ret.Name = relAddr.Resource.Name ret.PrevRunAddr = change.PrevRunAddr.String()
if ret.PrevRunAddr == ret.Addr {
switch tk := relAddr.Key.(type) { // In the on-disk format we leave PrevRunAddr unpopulated in the common
case nil: // case where it's the same as Addr, and then fill it back in again on
// Nothing to do, then. // read.
case addrs.IntKey: ret.PrevRunAddr = ""
ret.InstanceKey = &planproto.ResourceInstanceChange_Int{
Int: int64(tk),
}
case addrs.StringKey:
ret.InstanceKey = &planproto.ResourceInstanceChange_Str{
Str: string(tk),
}
default:
return nil, fmt.Errorf("resource %s has unsupported instance key type %T", relAddr, relAddr.Key)
} }
ret.DeposedKey = string(change.DeposedKey) ret.DeposedKey = string(change.DeposedKey)
@ -500,7 +466,7 @@ func resourceChangeToTfplan(change *plans.ResourceInstanceChangeSrc) (*planproto
valChange, err := changeToTfplan(&change.ChangeSrc) valChange, err := changeToTfplan(&change.ChangeSrc)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to serialize resource %s change: %s", relAddr, err) return nil, fmt.Errorf("failed to serialize resource %s change: %s", change.Addr, err)
} }
ret.Change = valChange ret.Change = valChange
@ -514,7 +480,7 @@ func resourceChangeToTfplan(change *plans.ResourceInstanceChangeSrc) (*planproto
case plans.ResourceInstanceReplaceByRequest: case plans.ResourceInstanceReplaceByRequest:
ret.ActionReason = planproto.ResourceInstanceActionReason_REPLACE_BY_REQUEST ret.ActionReason = planproto.ResourceInstanceActionReason_REPLACE_BY_REQUEST
default: default:
return nil, fmt.Errorf("resource %s has unsupported action reason %s", relAddr, change.ActionReason) return nil, fmt.Errorf("resource %s has unsupported action reason %s", change.Addr, change.ActionReason)
} }
if len(change.Private) > 0 { if len(change.Private) > 0 {

View File

@ -57,6 +57,11 @@ func TestTFPlanRoundTrip(t *testing.T) {
Type: "test_thing", Type: "test_thing",
Name: "woot", Name: "woot",
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
PrevRunAddr: addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_thing",
Name: "woot",
}.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance),
ProviderAddr: addrs.AbsProviderConfig{ ProviderAddr: addrs.AbsProviderConfig{
Provider: addrs.NewDefaultProvider("test"), Provider: addrs.NewDefaultProvider("test"),
Module: addrs.RootModule, Module: addrs.RootModule,
@ -93,7 +98,12 @@ func TestTFPlanRoundTrip(t *testing.T) {
Mode: addrs.ManagedResourceMode, Mode: addrs.ManagedResourceMode,
Type: "test_thing", Type: "test_thing",
Name: "woot", Name: "woot",
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), }.Instance(addrs.IntKey(1)).Absolute(addrs.RootModuleInstance),
PrevRunAddr: addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_thing",
Name: "woot",
}.Instance(addrs.IntKey(1)).Absolute(addrs.RootModuleInstance),
DeposedKey: "foodface", DeposedKey: "foodface",
ProviderAddr: addrs.AbsProviderConfig{ ProviderAddr: addrs.AbsProviderConfig{
Provider: addrs.NewDefaultProvider("test"), Provider: addrs.NewDefaultProvider("test"),
@ -214,6 +224,11 @@ func TestTFPlanRoundTripDestroy(t *testing.T) {
Type: "test_thing", Type: "test_thing",
Name: "woot", Name: "woot",
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
PrevRunAddr: addrs.Resource{
Mode: addrs.ManagedResourceMode,
Type: "test_thing",
Name: "woot",
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
ProviderAddr: addrs.AbsProviderConfig{ ProviderAddr: addrs.AbsProviderConfig{
Provider: addrs.NewDefaultProvider("test"), Provider: addrs.NewDefaultProvider("test"),
Module: addrs.RootModule, Module: addrs.RootModule,

View File

@ -392,8 +392,9 @@ func (n *NodeAbstractResourceInstance) planDestroy(ctx EvalContext, currentState
// that we checked something and concluded no changes were needed // that we checked something and concluded no changes were needed
// vs. that something being entirely excluded e.g. due to -target. // vs. that something being entirely excluded e.g. due to -target.
noop := &plans.ResourceInstanceChange{ noop := &plans.ResourceInstanceChange{
Addr: absAddr, Addr: absAddr,
DeposedKey: deposedKey, PrevRunAddr: absAddr, // TODO-PrevRunAddr: If this instance was moved/renamed in this run, record its old address
DeposedKey: deposedKey,
Change: plans.Change{ Change: plans.Change{
Action: plans.NoOp, Action: plans.NoOp,
Before: cty.NullVal(cty.DynamicPseudoType), Before: cty.NullVal(cty.DynamicPseudoType),
@ -419,8 +420,9 @@ func (n *NodeAbstractResourceInstance) planDestroy(ctx EvalContext, currentState
// Plan is always the same for a destroy. We don't need the provider's // Plan is always the same for a destroy. We don't need the provider's
// help for this one. // help for this one.
plan := &plans.ResourceInstanceChange{ plan := &plans.ResourceInstanceChange{
Addr: absAddr, Addr: absAddr,
DeposedKey: deposedKey, PrevRunAddr: absAddr, // TODO-PrevRunAddr: If this instance was moved/renamed in this run, record its old address
DeposedKey: deposedKey,
Change: plans.Change{ Change: plans.Change{
Action: plans.Delete, Action: plans.Delete,
Before: currentState.Value, Before: currentState.Value,
@ -444,7 +446,7 @@ func (n *NodeAbstractResourceInstance) planDestroy(ctx EvalContext, currentState
return plan, diags return plan, diags
} }
// writeChange saves a planned change for an instance object into the set of // writeChange saves a planned change for an instance object into the set of
// global planned changes. // global planned changes.
func (n *NodeAbstractResourceInstance) writeChange(ctx EvalContext, change *plans.ResourceInstanceChange, deposedKey states.DeposedKey) error { func (n *NodeAbstractResourceInstance) writeChange(ctx EvalContext, change *plans.ResourceInstanceChange, deposedKey states.DeposedKey) error {
changes := ctx.Changes() changes := ctx.Changes()
@ -469,6 +471,16 @@ func (n *NodeAbstractResourceInstance) writeChange(ctx EvalContext, change *plan
// Should never happen, and indicates a bug in the caller. // Should never happen, and indicates a bug in the caller.
panic("inconsistent address and/or deposed key in writeChange") panic("inconsistent address and/or deposed key in writeChange")
} }
if change.PrevRunAddr.Resource.Resource.Type == "" {
// Should never happen, and indicates a bug in the caller.
// (The change.Encode function actually has its own fixup to just
// quietly make this match change.Addr in the incorrect case, but we
// intentionally panic here in order to catch incorrect callers where
// the stack trace will hopefully be actually useful. The tolerance
// at the next layer down is mainly to accommodate sloppy input in
// older tests.)
panic("unpopulated ResourceInstanceChange.PrevRunAddr in writeChange")
}
ri := n.Addr.Resource ri := n.Addr.Resource
schema, _ := providerSchema.SchemaForResourceAddr(ri.Resource) schema, _ := providerSchema.SchemaForResourceAddr(ri.Resource)
@ -1054,6 +1066,7 @@ func (n *NodeAbstractResourceInstance) plan(
// Update our return plan // Update our return plan
plan = &plans.ResourceInstanceChange{ plan = &plans.ResourceInstanceChange{
Addr: n.Addr, Addr: n.Addr,
PrevRunAddr: n.Addr, // TODO-PrevRunAddr: If this instance was moved/renamed in this run, record its old address
Private: plannedPrivate, Private: plannedPrivate,
ProviderAddr: n.ResolvedProvider, ProviderAddr: n.ResolvedProvider,
Change: plans.Change{ Change: plans.Change{
@ -1515,6 +1528,7 @@ func (n *NodeAbstractResourceInstance) planDataSource(ctx EvalContext, currentSt
// value containing unknowns from PlanDataResourceObject. // value containing unknowns from PlanDataResourceObject.
plannedChange := &plans.ResourceInstanceChange{ plannedChange := &plans.ResourceInstanceChange{
Addr: n.Addr, Addr: n.Addr,
PrevRunAddr: n.Addr, // data resources are not refactorable
ProviderAddr: n.ResolvedProvider, ProviderAddr: n.ResolvedProvider,
Change: plans.Change{ Change: plans.Change{
Action: plans.Read, Action: plans.Read,