plans: Record provider config address in each resource change

This allows us to record the resource-to-provider associations we made
during the plan phase and ensure that we use the same config during
apply.

This isn't technically necessary, since we can in principle just repeat
the same matching algorithm against the config, but that algorithm is
relatively complicated and so if we execute it just once during plan we
remove the risk of bugs causing different decisions to be made during
the apply phase.

This also includes updates to the plan file format to include the provider
addresses. Since we've not actually shipped any version of Terraform
using our protobuf schema yet, we renumber here all of the fields after
the new one to keep them incrementing consecutively. This example should
not be followed after we have a released version of Terraform using this,
as a courtesy to anyone trying to parse these files (even though we're
not yet guaranteeing compatibility between releases).
This commit is contained in:
Martin Atkins 2018-06-21 15:26:37 -07:00
parent ffe5f7c4e6
commit 51aeba2cf2
5 changed files with 101 additions and 66 deletions

View File

@ -32,6 +32,11 @@ type ResourceInstanceChange struct {
// the current object is being replaced with the deposed. // the current object is being replaced with the deposed.
DeposedKey states.DeposedKey DeposedKey states.DeposedKey
// Provider is the address of the provider configuration that was used
// to plan this change, and thus the configuration that must also be
// used to apply it.
ProviderAddr addrs.AbsProviderConfig
// Change is an embedded description of the change. // Change is an embedded description of the change.
Change Change
} }

View File

@ -52,7 +52,7 @@ func (x Action) String() string {
return proto.EnumName(Action_name, int32(x)) return proto.EnumName(Action_name, int32(x))
} }
func (Action) EnumDescriptor() ([]byte, []int) { func (Action) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{0} return fileDescriptor_planfile_8d966014b6720da2, []int{0}
} }
type ResourceInstanceChange_ResourceMode int32 type ResourceInstanceChange_ResourceMode int32
@ -75,7 +75,7 @@ func (x ResourceInstanceChange_ResourceMode) String() string {
return proto.EnumName(ResourceInstanceChange_ResourceMode_name, int32(x)) return proto.EnumName(ResourceInstanceChange_ResourceMode_name, int32(x))
} }
func (ResourceInstanceChange_ResourceMode) EnumDescriptor() ([]byte, []int) { func (ResourceInstanceChange_ResourceMode) EnumDescriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{2, 0} return fileDescriptor_planfile_8d966014b6720da2, []int{2, 0}
} }
// Plan is the root message type for the tfplan file // Plan is the root message type for the tfplan file
@ -115,7 +115,7 @@ func (m *Plan) Reset() { *m = Plan{} }
func (m *Plan) String() string { return proto.CompactTextString(m) } func (m *Plan) String() string { return proto.CompactTextString(m) }
func (*Plan) ProtoMessage() {} func (*Plan) ProtoMessage() {}
func (*Plan) Descriptor() ([]byte, []int) { func (*Plan) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{0} return fileDescriptor_planfile_8d966014b6720da2, []int{0}
} }
func (m *Plan) XXX_Unmarshal(b []byte) error { func (m *Plan) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Plan.Unmarshal(m, b) return xxx_messageInfo_Plan.Unmarshal(m, b)
@ -202,7 +202,7 @@ func (m *Change) Reset() { *m = Change{} }
func (m *Change) String() string { return proto.CompactTextString(m) } func (m *Change) String() string { return proto.CompactTextString(m) }
func (*Change) ProtoMessage() {} func (*Change) ProtoMessage() {}
func (*Change) Descriptor() ([]byte, []int) { func (*Change) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{1} return fileDescriptor_planfile_8d966014b6720da2, []int{1}
} }
func (m *Change) XXX_Unmarshal(b []byte) error { func (m *Change) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Change.Unmarshal(m, b) return xxx_messageInfo_Change.Unmarshal(m, b)
@ -262,19 +262,23 @@ type ResourceInstanceChange struct {
// 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.
DeposedKey string `protobuf:"bytes,7,opt,name=deposed_key,json=deposedKey,proto3" json:"deposed_key,omitempty"` DeposedKey string `protobuf:"bytes,7,opt,name=deposed_key,json=deposedKey,proto3" json:"deposed_key,omitempty"`
// provider is the address of the provider configuration that this change
// was planned with, and thus the configuration that must be used to
// apply it.
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" and "delete" actions. "no-op" changes are not currently used here
// but consumers must accept and discard them to allow for future expansion. // but consumers must accept and discard them to allow for future expansion.
Change *Change `protobuf:"bytes,8,opt,name=change,proto3" json:"change,omitempty"` Change *Change `protobuf:"bytes,9,opt,name=change,proto3" json:"change,omitempty"`
// msgpack representation of an arbitrary object value provided by // msgpack representation of an arbitrary object value provided by
// the resource provider as additional context for the change. Must // the resource provider as additional context for the change. Must
// be considered an opaque value for any consumer other than the // be considered an opaque value for any consumer other than the
// provider that generated it. // provider that generated it.
Private *DynamicValue `protobuf:"bytes,9,opt,name=private,proto3" json:"private,omitempty"` Private *DynamicValue `protobuf:"bytes,10,opt,name=private,proto3" json:"private,omitempty"`
// An unordered set of paths that prompted the change action to be // An unordered set of paths that prompted the change action to be
// "replace" rather than "update". Empty for any action other than // "replace" rather than "update". Empty for any action other than
// "replace". // "replace".
RequiredReplace []*Path `protobuf:"bytes,10,rep,name=required_replace,json=requiredReplace,proto3" json:"required_replace,omitempty"` RequiredReplace []*Path `protobuf:"bytes,11,rep,name=required_replace,json=requiredReplace,proto3" json:"required_replace,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"` XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"` XXX_sizecache int32 `json:"-"`
@ -284,7 +288,7 @@ func (m *ResourceInstanceChange) Reset() { *m = ResourceInstanceChange{}
func (m *ResourceInstanceChange) String() string { return proto.CompactTextString(m) } func (m *ResourceInstanceChange) String() string { return proto.CompactTextString(m) }
func (*ResourceInstanceChange) ProtoMessage() {} func (*ResourceInstanceChange) ProtoMessage() {}
func (*ResourceInstanceChange) Descriptor() ([]byte, []int) { func (*ResourceInstanceChange) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{2} return fileDescriptor_planfile_8d966014b6720da2, []int{2}
} }
func (m *ResourceInstanceChange) XXX_Unmarshal(b []byte) error { func (m *ResourceInstanceChange) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_ResourceInstanceChange.Unmarshal(m, b) return xxx_messageInfo_ResourceInstanceChange.Unmarshal(m, b)
@ -374,6 +378,13 @@ func (m *ResourceInstanceChange) GetDeposedKey() string {
return "" return ""
} }
func (m *ResourceInstanceChange) GetProvider() string {
if m != nil {
return m.Provider
}
return ""
}
func (m *ResourceInstanceChange) GetChange() *Change { func (m *ResourceInstanceChange) GetChange() *Change {
if m != nil { if m != nil {
return m.Change return m.Change
@ -479,7 +490,7 @@ func (m *OutputChange) Reset() { *m = OutputChange{} }
func (m *OutputChange) String() string { return proto.CompactTextString(m) } func (m *OutputChange) String() string { return proto.CompactTextString(m) }
func (*OutputChange) ProtoMessage() {} func (*OutputChange) ProtoMessage() {}
func (*OutputChange) Descriptor() ([]byte, []int) { func (*OutputChange) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{3} return fileDescriptor_planfile_8d966014b6720da2, []int{3}
} }
func (m *OutputChange) XXX_Unmarshal(b []byte) error { func (m *OutputChange) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_OutputChange.Unmarshal(m, b) return xxx_messageInfo_OutputChange.Unmarshal(m, b)
@ -543,7 +554,7 @@ func (m *DynamicValue) Reset() { *m = DynamicValue{} }
func (m *DynamicValue) String() string { return proto.CompactTextString(m) } func (m *DynamicValue) String() string { return proto.CompactTextString(m) }
func (*DynamicValue) ProtoMessage() {} func (*DynamicValue) ProtoMessage() {}
func (*DynamicValue) Descriptor() ([]byte, []int) { func (*DynamicValue) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{4} return fileDescriptor_planfile_8d966014b6720da2, []int{4}
} }
func (m *DynamicValue) XXX_Unmarshal(b []byte) error { func (m *DynamicValue) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DynamicValue.Unmarshal(m, b) return xxx_messageInfo_DynamicValue.Unmarshal(m, b)
@ -589,7 +600,7 @@ func (m *Hash) Reset() { *m = Hash{} }
func (m *Hash) String() string { return proto.CompactTextString(m) } func (m *Hash) String() string { return proto.CompactTextString(m) }
func (*Hash) ProtoMessage() {} func (*Hash) ProtoMessage() {}
func (*Hash) Descriptor() ([]byte, []int) { func (*Hash) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{5} return fileDescriptor_planfile_8d966014b6720da2, []int{5}
} }
func (m *Hash) XXX_Unmarshal(b []byte) error { func (m *Hash) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Hash.Unmarshal(m, b) return xxx_messageInfo_Hash.Unmarshal(m, b)
@ -630,7 +641,7 @@ func (m *Path) Reset() { *m = Path{} }
func (m *Path) String() string { return proto.CompactTextString(m) } func (m *Path) String() string { return proto.CompactTextString(m) }
func (*Path) ProtoMessage() {} func (*Path) ProtoMessage() {}
func (*Path) Descriptor() ([]byte, []int) { func (*Path) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{6} return fileDescriptor_planfile_8d966014b6720da2, []int{6}
} }
func (m *Path) XXX_Unmarshal(b []byte) error { func (m *Path) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Path.Unmarshal(m, b) return xxx_messageInfo_Path.Unmarshal(m, b)
@ -671,7 +682,7 @@ func (m *Path_Step) Reset() { *m = Path_Step{} }
func (m *Path_Step) String() string { return proto.CompactTextString(m) } func (m *Path_Step) String() string { return proto.CompactTextString(m) }
func (*Path_Step) ProtoMessage() {} func (*Path_Step) ProtoMessage() {}
func (*Path_Step) Descriptor() ([]byte, []int) { func (*Path_Step) Descriptor() ([]byte, []int) {
return fileDescriptor_planfile_78f69d66ae9e7fdf, []int{6, 0} return fileDescriptor_planfile_8d966014b6720da2, []int{6, 0}
} }
func (m *Path_Step) XXX_Unmarshal(b []byte) error { func (m *Path_Step) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_Path_Step.Unmarshal(m, b) return xxx_messageInfo_Path_Step.Unmarshal(m, b)
@ -811,58 +822,59 @@ func init() {
proto.RegisterEnum("tfplan.ResourceInstanceChange_ResourceMode", ResourceInstanceChange_ResourceMode_name, ResourceInstanceChange_ResourceMode_value) proto.RegisterEnum("tfplan.ResourceInstanceChange_ResourceMode", ResourceInstanceChange_ResourceMode_name, ResourceInstanceChange_ResourceMode_value)
} }
func init() { proto.RegisterFile("planfile.proto", fileDescriptor_planfile_78f69d66ae9e7fdf) } func init() { proto.RegisterFile("planfile.proto", fileDescriptor_planfile_8d966014b6720da2) }
var fileDescriptor_planfile_78f69d66ae9e7fdf = []byte{ var fileDescriptor_planfile_8d966014b6720da2 = []byte{
// 794 bytes of a gzipped FileDescriptorProto // 804 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdb, 0x6e, 0xe3, 0x36, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x55, 0xdb, 0x6e, 0xe3, 0x36,
0x10, 0xb5, 0x6c, 0x45, 0x89, 0x27, 0x5e, 0x45, 0xcb, 0x16, 0x0b, 0x21, 0x2d, 0xb6, 0x86, 0x80, 0x10, 0xb5, 0x6c, 0x45, 0xb1, 0xc7, 0x5e, 0x45, 0xcb, 0x16, 0x0b, 0x21, 0x2d, 0xb6, 0x86, 0x80,
0x76, 0x8d, 0xdd, 0xc2, 0x01, 0x52, 0xb4, 0xe9, 0xb6, 0x0f, 0x45, 0x2e, 0x02, 0x12, 0xec, 0x25, 0x76, 0x8d, 0xdd, 0xc2, 0x01, 0x52, 0xb4, 0xe9, 0xb6, 0x0f, 0x45, 0x2e, 0x02, 0x12, 0xec, 0x25,
0x06, 0xbb, 0xcd, 0x43, 0x1f,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 0x58, 0x66, 0x43, 0xfb,
0xff, 0xff, 0x19, 0x9b, 0x98, 0x0d, 0x1f, 0x06, 0x00, 0x00, 0x17, 0x71, 0xeb, 0xd9, 0x9f, 0x1f, 0xfe, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x57, 0x66, 0x84, 0xc3,
0x3b, 0x06, 0x00, 0x00,
} }

View File

@ -105,21 +105,26 @@ message ResourceInstanceChange {
// set, the change applies to the instance's current object. // set, the change applies to the instance's current object.
string deposed_key = 7; string deposed_key = 7;
// provider is the address of the provider configuration that this change
// was planned with, and thus the configuration that must be used to
// apply it.
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" and "delete" actions. "no-op" changes are not currently used here
// but consumers must accept and discard them to allow for future expansion. // but consumers must accept and discard them to allow for future expansion.
Change change = 8; Change change = 9;
// msgpack representation of an arbitrary object value provided by // msgpack representation of an arbitrary object value provided by
// the resource provider as additional context for the change. Must // the resource provider as additional context for the change. Must
// be considered an opaque value for any consumer other than the // be considered an opaque value for any consumer other than the
// provider that generated it. // provider that generated it.
DynamicValue private = 9; DynamicValue private = 10;
// An unordered set of paths that prompted the change action to be // An unordered set of paths that prompted the change action to be
// "replace" rather than "update". Empty for any action other than // "replace" rather than "update". Empty for any action other than
// "replace". // "replace".
repeated Path required_replace = 10; repeated Path required_replace = 11;
} }
message OutputChange { message OutputChange {

View File

@ -119,6 +119,12 @@ func resourceChangeFromTfplan(rawChange *planproto.ResourceInstanceChange) (*pla
} }
} }
providerAddr, diags := addrs.ParseAbsProviderConfigStr(rawChange.Provider)
if diags.HasErrors() {
return nil, diags.Err()
}
ret.ProviderAddr = providerAddr
var mode addrs.ResourceMode var mode addrs.ResourceMode
switch rawChange.Mode { switch rawChange.Mode {
case planproto.ResourceInstanceChange_managed: case planproto.ResourceInstanceChange_managed:
@ -336,6 +342,7 @@ func resourceChangeToTfplan(change *plans.ResourceInstanceChange) (*planproto.Re
} }
ret.DeposedKey = string(change.DeposedKey) ret.DeposedKey = string(change.DeposedKey)
ret.Provider = change.ProviderAddr.String()
valChange, err := changeToTfplan(&change.Change) valChange, err := changeToTfplan(&change.Change)
if err != nil { if err != nil {

View File

@ -53,6 +53,9 @@ 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),
ProviderAddr: addrs.ProviderConfig{
Type: "test",
}.Absolute(addrs.RootModuleInstance),
Change: plans.Change{ Change: plans.Change{
Action: plans.Replace, Action: plans.Replace,
Before: mustNewDynamicValue(cty.ObjectVal(map[string]cty.Value{ Before: mustNewDynamicValue(cty.ObjectVal(map[string]cty.Value{
@ -70,6 +73,9 @@ func TestTFPlanRoundTrip(t *testing.T) {
Name: "woot", Name: "woot",
}.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance), }.Instance(addrs.IntKey(0)).Absolute(addrs.RootModuleInstance),
DeposedKey: "foodface", DeposedKey: "foodface",
ProviderAddr: addrs.ProviderConfig{
Type: "test",
}.Absolute(addrs.RootModuleInstance),
Change: plans.Change{ Change: plans.Change{
Action: plans.Delete, Action: plans.Delete,
Before: mustNewDynamicValue(cty.ObjectVal(map[string]cty.Value{ Before: mustNewDynamicValue(cty.ObjectVal(map[string]cty.Value{