From 4e34e6ebfa77c18a1484fc2f9743a7fad67d11af Mon Sep 17 00:00:00 2001 From: Martin Atkins Date: Mon, 23 Oct 2023 17:57:45 -0700 Subject: [PATCH] stacks: Track prior state for all resource instance objects Previously our raw plan data structure only included information about resource instances that have planned actions, which meant we were missing those which only get their state updated during refresh and don't actually need any real work done. Now we'll track everything, accepting that some "planned changes" for resource instance objects will not actually include a planned change in the typical sense, and instead only represent a state update. --- internal/plans/planfile/tfplan.go | 4 + internal/stacks/stackplan/component.go | 4 +- internal/stacks/stackplan/from_proto.go | 41 ++++-- internal/stacks/stackplan/planned_change.go | 85 +++++++++---- .../stacks/stackplan/planned_change_test.go | 24 +++- .../internal/stackeval/component_instance.go | 96 +++++++++++++- internal/stacks/stackruntime/plan_test.go | 19 ++- .../stacks/tfstackdata1/tfstackdata1.pb.go | 119 ++++++++++-------- .../stacks/tfstackdata1/tfstackdata1.proto | 2 + 9 files changed, 297 insertions(+), 97 deletions(-) diff --git a/internal/plans/planfile/tfplan.go b/internal/plans/planfile/tfplan.go index 327d340fb2..4ca04971f3 100644 --- a/internal/plans/planfile/tfplan.go +++ b/internal/plans/planfile/tfplan.go @@ -714,6 +714,10 @@ func resourceAttrFromTfplan(ra *planproto.PlanResourceAttr) (globalref.ResourceA // This is used by the stackplan package, which includes planproto messages // in its own wire format while using a different overall container. func ResourceChangeToProto(change *plans.ResourceInstanceChangeSrc) (*planproto.ResourceInstanceChange, error) { + if change == nil { + // We assume this represents the absense of a change, then. + return nil, nil + } return resourceChangeToTfplan(change) } diff --git a/internal/stacks/stackplan/component.go b/internal/stacks/stackplan/component.go index faddc19acb..3b8688c08d 100644 --- a/internal/stacks/stackplan/component.go +++ b/internal/stacks/stackplan/component.go @@ -64,7 +64,9 @@ func (c *Component) ForModulesRuntime() (*plans.Plan, error) { sc := changes.SyncWrapper() for _, elem := range c.ResourceInstancePlanned.Elems { changeSrc := elem.Value - sc.AppendResourceInstanceChange(changeSrc) + if changeSrc != nil { + sc.AppendResourceInstanceChange(changeSrc) + } } priorState := states.NewState() diff --git a/internal/stacks/stackplan/from_proto.go b/internal/stacks/stackplan/from_proto.go index 81c4b25be0..4a9ce9650b 100644 --- a/internal/stacks/stackplan/from_proto.go +++ b/internal/stacks/stackplan/from_proto.go @@ -84,26 +84,45 @@ func LoadFromProto(msgs []*anypb.Any) (*Plan, error) { } case *tfstackdata1.PlanResourceInstanceChangePlanned: - if msg.Change == nil { - return nil, fmt.Errorf("%T has nil Change", msg) - } cAddr, diags := stackaddrs.ParseAbsComponentInstanceStr(msg.ComponentInstanceAddr) if diags.HasErrors() { return nil, fmt.Errorf("invalid component instance address syntax in %q", msg.ComponentInstanceAddr) } + riAddr, diags := addrs.ParseAbsResourceInstanceStr(msg.ResourceInstanceAddr) + if diags.HasErrors() { + return nil, fmt.Errorf("invalid resource instance address syntax in %q", msg.ResourceInstanceAddr) + } + var deposedKey addrs.DeposedKey + if msg.DeposedKey != "" { + deposedKey, err = addrs.ParseDeposedKey(msg.DeposedKey) + if err != nil { + return nil, fmt.Errorf("invalid deposed key syntax in %q", msg.DeposedKey) + } + } + fullAddr := addrs.AbsResourceInstanceObject{ + ResourceInstance: riAddr, + DeposedKey: deposedKey, + } c, ok := ret.Components.GetOk(cAddr) if !ok { return nil, fmt.Errorf("resource instance change for unannounced component instance %s", cAddr) } - riPlan, err := planfile.ResourceChangeFromProto(msg.Change) - if err != nil { - return nil, fmt.Errorf("invalid resource instance change: %w", err) - } - fullAddr := addrs.AbsResourceInstanceObject{ - ResourceInstance: riPlan.Addr, - DeposedKey: riPlan.DeposedKey, + var riPlan *plans.ResourceInstanceChangeSrc + // Not all "planned changes" for resource instances are actually + // changes in the plans.Change sense, confusingly: sometimes the + // "change" we're recording is just to overwrite the state entry + // with a refreshed copy, in which case riPlan is nil and + // msg.PriorState is the main content of this change, handled below. + if msg.Change != nil { + riPlan, err = planfile.ResourceChangeFromProto(msg.Change) + if err != nil { + return nil, fmt.Errorf("invalid resource instance change: %w", err) + } + if !riPlan.Addr.Equal(fullAddr.ResourceInstance) && riPlan.DeposedKey == fullAddr.DeposedKey { + return nil, fmt.Errorf("planned change has inconsistent address to its containing object") + } + c.ResourceInstancePlanned.Put(fullAddr, riPlan) } - c.ResourceInstancePlanned.Put(fullAddr, riPlan) if msg.PriorState != nil { stateSrc, err := stackstate.DecodeProtoResourceInstanceObject(msg.PriorState) diff --git a/internal/stacks/stackplan/planned_change.go b/internal/stacks/stackplan/planned_change.go index 6d67310d7b..76e207b690 100644 --- a/internal/stacks/stackplan/planned_change.go +++ b/internal/stacks/stackplan/planned_change.go @@ -169,12 +169,31 @@ func (pc *PlannedChangeComponentInstance) PlannedChangeProto() (*terraform1.Plan // PlannedChangeResourceInstancePlanned announces an action that Terraform // is proposing to take if this plan is applied. type PlannedChangeResourceInstancePlanned struct { - ComponentInstanceAddr stackaddrs.AbsComponentInstance - ChangeSrc *plans.ResourceInstanceChangeSrc - PriorStateSrc *states.ResourceInstanceObjectSrc + ResourceInstanceObjectAddr stackaddrs.AbsResourceInstanceObject + + // ChangeSrc describes the planned change, if any. This can be nil if + // we're only intending to update the state to match PriorStateSrc. + ChangeSrc *plans.ResourceInstanceChangeSrc + + // PriorStateSrc describes the "prior state" that the planned change, if + // any, was generated against. + // + // This can be nil if the object didn't previously exist. If both + // PriorStateSrc and ChangeSrc are nil then that suggests that the + // object existed in the previous run's state but was found to no + // longer exist while refreshing during plan. + PriorStateSrc *states.ResourceInstanceObjectSrc + + // ProviderConfigAddr is the address of the provider configuration + // that planned this change, resolved in terms of the configuration for + // the component this resource instance object belongs to. + ProviderConfigAddr addrs.AbsProviderConfig // Schema MUST be the same schema that was used to encode the dynamic - // values inside ChangeSrc. + // values inside ChangeSrc and PriorStateSrc. + // + // Can be nil if and only if ChangeSrc and PriorStateSrc are both nil + // themselves. Schema *configschema.Block } @@ -182,8 +201,26 @@ var _ PlannedChange = (*PlannedChangeResourceInstancePlanned)(nil) // PlannedChangeProto implements PlannedChange. func (pc *PlannedChangeResourceInstancePlanned) PlannedChangeProto() (*terraform1.PlannedChange, error) { - if pc.ChangeSrc == nil { - return nil, fmt.Errorf("nil ChangeSrc") + rioAddr := pc.ResourceInstanceObjectAddr + + if pc.ChangeSrc == nil && pc.PriorStateSrc == nil { + // This is just a stubby placeholder to remind us to drop the + // apparently-deleted-outside-of-Terraform object from the state + // if this plan later gets applied. + // We only emit a "raw" in this case, because this is a relatively + // uninteresting edge-case. + var raw anypb.Any + err := anypb.MarshalFrom(&raw, &tfstackdata1.PlanResourceInstanceChangePlanned{ + ComponentInstanceAddr: rioAddr.Component.String(), + ResourceInstanceAddr: rioAddr.Item.ResourceInstance.String(), + DeposedKey: rioAddr.Item.DeposedKey.String(), + }, proto.MarshalOptions{}) + if err != nil { + return nil, err + } + return &terraform1.PlannedChange{ + Raw: []*anypb.Any{&raw}, + }, nil } // We include the prior state as part of the raw plan because that @@ -191,7 +228,7 @@ func (pc *PlannedChangeResourceInstancePlanned) PlannedChangeProto() (*terraform // schema version and incorporating any changes detected in the refresh // step, which we'll rely on during the apply step to make sure that // the final plan is consistent, etc. - priorStateProto := tfstackdata1.ResourceInstanceObjectStateToTFStackData1(pc.PriorStateSrc, pc.ChangeSrc.ProviderAddr) + priorStateProto := tfstackdata1.ResourceInstanceObjectStateToTFStackData1(pc.PriorStateSrc, pc.ProviderConfigAddr) changeProto, err := planfile.ResourceChangeToProto(pc.ChangeSrc) if err != nil { @@ -199,7 +236,9 @@ func (pc *PlannedChangeResourceInstancePlanned) PlannedChangeProto() (*terraform } var raw anypb.Any err = anypb.MarshalFrom(&raw, &tfstackdata1.PlanResourceInstanceChangePlanned{ - ComponentInstanceAddr: pc.ComponentInstanceAddr.String(), + ComponentInstanceAddr: rioAddr.Component.String(), + ResourceInstanceAddr: rioAddr.Item.ResourceInstance.String(), + DeposedKey: rioAddr.Item.DeposedKey.String(), Change: changeProto, PriorState: priorStateProto, }, proto.MarshalOptions{}) @@ -207,19 +246,16 @@ func (pc *PlannedChangeResourceInstancePlanned) PlannedChangeProto() (*terraform return nil, err } - protoChangeTypes, err := terraform1.ChangeTypesForPlanAction(pc.ChangeSrc.Action) - if err != nil { - return nil, err - } - - rioAddr := stackaddrs.AbsResourceInstanceObject{ - Component: pc.ComponentInstanceAddr, - Item: pc.ChangeSrc.ObjectAddr(), - } - - return &terraform1.PlannedChange{ - Raw: []*anypb.Any{&raw}, - Descriptions: []*terraform1.PlannedChange_ChangeDescription{ + var descs []*terraform1.PlannedChange_ChangeDescription + // We only emit an external description if there's a change to describe. + // Otherwise, we just emit a raw to remind us to update the state for + // this object during the apply step, to match the prior state. + if pc.ChangeSrc != nil { + protoChangeTypes, err := terraform1.ChangeTypesForPlanAction(pc.ChangeSrc.Action) + if err != nil { + return nil, err + } + descs = []*terraform1.PlannedChange_ChangeDescription{ { Description: &terraform1.PlannedChange_ChangeDescription_ResourceInstancePlanned{ ResourceInstancePlanned: &terraform1.PlannedChange_ResourceInstance{ @@ -237,7 +273,12 @@ func (pc *PlannedChangeResourceInstancePlanned) PlannedChangeProto() (*terraform }, }, }, - }, + } + } + + return &terraform1.PlannedChange{ + Raw: []*anypb.Any{&raw}, + Descriptions: descs, }, nil } diff --git a/internal/stacks/stackplan/planned_change_test.go b/internal/stacks/stackplan/planned_change_test.go index 167c7e58c8..2be6443b2a 100644 --- a/internal/stacks/stackplan/planned_change_test.go +++ b/internal/stacks/stackplan/planned_change_test.go @@ -189,11 +189,23 @@ func TestPlannedChangeAsProto(t *testing.T) { }, "resource instance planned create": { Receiver: &PlannedChangeResourceInstancePlanned{ - ComponentInstanceAddr: stackaddrs.AbsComponentInstance{ - Stack: stackaddrs.RootStackInstance.Child("a", addrs.StringKey("boop")), - Item: stackaddrs.ComponentInstance{ - Component: stackaddrs.Component{Name: "foo"}, - Key: addrs.StringKey("beep"), + ResourceInstanceObjectAddr: stackaddrs.AbsResourceInstanceObject{ + Component: stackaddrs.AbsComponentInstance{ + Stack: stackaddrs.RootStackInstance.Child("a", addrs.StringKey("boop")), + Item: stackaddrs.ComponentInstance{ + Component: stackaddrs.Component{Name: "foo"}, + Key: addrs.StringKey("beep"), + }, + }, + Item: addrs.AbsResourceInstanceObject{ + ResourceInstance: addrs.Resource{ + Mode: addrs.ManagedResourceMode, + Type: "thingy", + Name: "wotsit", + }.Instance(addrs.IntKey(1)).Absolute( + addrs.RootModuleInstance.Child("pizza", addrs.StringKey("chicken")), + ), + DeposedKey: addrs.DeposedKey("aaaaaaaa"), }, }, ChangeSrc: &plans.ResourceInstanceChangeSrc{ @@ -220,6 +232,8 @@ func TestPlannedChangeAsProto(t *testing.T) { Raw: []*anypb.Any{ mustMarshalAnyPb(&tfstackdata1.PlanResourceInstanceChangePlanned{ ComponentInstanceAddr: `stack.a["boop"].component.foo["beep"]`, + ResourceInstanceAddr: `module.pizza["chicken"].thingy.wotsit[1]`, + DeposedKey: "aaaaaaaa", Change: &planproto.ResourceInstanceChange{ Addr: `module.pizza["chicken"].thingy.wotsit[1]`, DeposedKey: "aaaaaaaa", diff --git a/internal/stacks/stackruntime/internal/stackeval/component_instance.go b/internal/stacks/stackruntime/internal/stackeval/component_instance.go index 34500f2a02..5510329767 100644 --- a/internal/stacks/stackruntime/internal/stackeval/component_instance.go +++ b/internal/stacks/stackruntime/internal/stackeval/component_instance.go @@ -889,6 +889,7 @@ func (c *ComponentInstance) PlanChanges(ctx context.Context) ([]stackplan.Planne PlanTimestamp: corePlan.Timestamp, }) + seenObjects := addrs.MakeSet[addrs.AbsResourceInstanceObject]() for _, rsrcChange := range corePlan.Changes.Resources { schema, err := c.resourceTypeSchema( ctx, @@ -918,10 +919,14 @@ func (c *ComponentInstance) PlanChanges(ctx context.Context) ([]stackplan.Planne } changes = append(changes, &stackplan.PlannedChangeResourceInstancePlanned{ - ComponentInstanceAddr: c.Addr(), - ChangeSrc: rsrcChange, - Schema: schema, - PriorStateSrc: priorStateSrc, + ResourceInstanceObjectAddr: stackaddrs.AbsResourceInstanceObject{ + Component: c.Addr(), + Item: objAddr, + }, + ChangeSrc: rsrcChange, + Schema: schema, + PriorStateSrc: priorStateSrc, + ProviderConfigAddr: rsrcChange.ProviderAddr, // TODO: Also provide the previous run state, if it's // different from the prior state, and signal whether the @@ -931,6 +936,89 @@ func (c *ComponentInstance) PlanChanges(ctx context.Context) ([]stackplan.Planne // "changes outside of Terraform" part of the plan UI; // the raw plan only needs the prior state. }) + seenObjects.Add(objAddr) + } + + // We also need to catch any objects that exist in the "prior state" + // but don't have any actions planned, since we still need to capture + // the prior state part in case it was updated by refreshing during + // the plan walk. + if priorState := corePlan.PriorState; priorState != nil { + for _, addr := range priorState.AllResourceInstanceObjectAddrs() { + if seenObjects.Has(addr) { + // We're only interested in objects that didn't appear + // in the plan, such as data resources whose read has + // completed during the plan phase. + continue + } + + rs := priorState.Resource(addr.ResourceInstance.ContainingResource()) + os := priorState.ResourceInstanceObjectSrc(addr) + schema, err := c.resourceTypeSchema( + ctx, + rs.ProviderConfig.Provider, + addr.ResourceInstance.Resource.Resource.Mode, + addr.ResourceInstance.Resource.Resource.Type, + ) + if err != nil { + diags = diags.Append(tfdiags.Sourceless( + tfdiags.Error, + "Can't fetch provider schema to save plan", + fmt.Sprintf( + "Failed to retrieve the schema for %s from provider %s: %s. This is a bug in Terraform.", + addr, rs.ProviderConfig.Provider, err, + ), + )) + continue + } + + changes = append(changes, &stackplan.PlannedChangeResourceInstancePlanned{ + ResourceInstanceObjectAddr: stackaddrs.AbsResourceInstanceObject{ + Component: c.Addr(), + Item: addr, + }, + Schema: schema, + PriorStateSrc: os, + ProviderConfigAddr: rs.ProviderConfig, + // We intentionally omit ChangeSrc, because we're not actually + // planning to change this object during the apply phase, only + // to update its state data. + }) + seenObjects.Add(addr) + } + } + + // We also have one more unusual case to deal with: if an object + // existed at the end of the previous run but was found to have + // been deleted when we refreshed during planning then it will + // not be present in either the prior state _or_ the plan, but + // we still need to include a stubby object for it in the plan + // so we can remember to discard it from the state during the + // apply phase. + if prevRunState := corePlan.PrevRunState; prevRunState != nil { + for _, addr := range prevRunState.AllResourceInstanceObjectAddrs() { + if seenObjects.Has(addr) { + // We're only interested in objects that didn't appear + // in the plan, such as data resources whose read has + // completed during the plan phase. + continue + } + + rs := prevRunState.Resource(addr.ResourceInstance.ContainingResource()) + + changes = append(changes, &stackplan.PlannedChangeResourceInstancePlanned{ + ResourceInstanceObjectAddr: stackaddrs.AbsResourceInstanceObject{ + Component: c.Addr(), + Item: addr, + }, + ProviderConfigAddr: rs.ProviderConfig, + // Everything except the addresses are omitted in this case, + // which represents that we should just delete the object + // from the state when applied, and not take any other + // action. + }) + seenObjects.Add(addr) + } } } diff --git a/internal/stacks/stackruntime/plan_test.go b/internal/stacks/stackruntime/plan_test.go index e2c83a34dd..c447cedaf4 100644 --- a/internal/stacks/stackruntime/plan_test.go +++ b/internal/stacks/stackruntime/plan_test.go @@ -96,12 +96,21 @@ func TestPlanWithSingleResource(t *testing.T) { })), }, &stackplan.PlannedChangeResourceInstancePlanned{ - ComponentInstanceAddr: stackaddrs.Absolute( - stackaddrs.RootStackInstance, - stackaddrs.ComponentInstance{ - Component: stackaddrs.Component{Name: "self"}, + ResourceInstanceObjectAddr: stackaddrs.AbsResourceInstanceObject{ + Component: stackaddrs.Absolute( + stackaddrs.RootStackInstance, + stackaddrs.ComponentInstance{ + Component: stackaddrs.Component{Name: "self"}, + }, + ), + Item: addrs.AbsResourceInstanceObject{ + ResourceInstance: addrs.Resource{ + Mode: addrs.ManagedResourceMode, + Type: "terraform_data", + Name: "main", + }.Instance(addrs.NoKey).Absolute(addrs.RootModuleInstance), }, - ), + }, ChangeSrc: &plans.ResourceInstanceChangeSrc{ Addr: addrs.Resource{ Mode: addrs.ManagedResourceMode, diff --git a/internal/stacks/tfstackdata1/tfstackdata1.pb.go b/internal/stacks/tfstackdata1/tfstackdata1.pb.go index f41e311049..9c1648a24d 100644 --- a/internal/stacks/tfstackdata1/tfstackdata1.pb.go +++ b/internal/stacks/tfstackdata1/tfstackdata1.pb.go @@ -345,6 +345,8 @@ type PlanResourceInstanceChangePlanned struct { // The same string must previously have been announced with a // PlanComponentInstance message, or the overall plan sequence is invalid. ComponentInstanceAddr string `protobuf:"bytes,1,opt,name=component_instance_addr,json=componentInstanceAddr,proto3" json:"component_instance_addr,omitempty"` + ResourceInstanceAddr string `protobuf:"bytes,4,opt,name=resource_instance_addr,json=resourceInstanceAddr,proto3" json:"resource_instance_addr,omitempty"` + DeposedKey string `protobuf:"bytes,5,opt,name=deposed_key,json=deposedKey,proto3" json:"deposed_key,omitempty"` // Description of the planned change in the standard "tfplan" (planproto) // format. Change *planproto.ResourceInstanceChange `protobuf:"bytes,2,opt,name=change,proto3" json:"change,omitempty"` @@ -398,6 +400,20 @@ func (x *PlanResourceInstanceChangePlanned) GetComponentInstanceAddr() string { return "" } +func (x *PlanResourceInstanceChangePlanned) GetResourceInstanceAddr() string { + if x != nil { + return x.ResourceInstanceAddr + } + return "" +} + +func (x *PlanResourceInstanceChangePlanned) GetDeposedKey() string { + if x != nil { + return x.DeposedKey + } + return "" +} + func (x *PlanResourceInstanceChangePlanned) GetChange() *planproto.ResourceInstanceChange { if x != nil { return x.Change @@ -705,60 +721,65 @@ var file_tfstackdata1_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x44, 0x79, 0x6e, 0x61, 0x6d, 0x69, 0x63, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xe1, 0x01, 0x0a, 0x21, 0x50, 0x6c, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xb8, 0x02, 0x0a, 0x21, 0x50, 0x6c, 0x61, 0x6e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x6c, 0x61, 0x6e, 0x6e, 0x65, 0x64, 0x12, 0x36, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x15, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x36, 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, - 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, - 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, - 0x4c, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x66, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x61, - 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, - 0x31, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x6a, 0x0a, - 0x17, 0x50, 0x6c, 0x61, 0x6e, 0x44, 0x69, 0x73, 0x63, 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, - 0x65, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x72, 0x61, 0x77, 0x5f, - 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, - 0x52, 0x0c, 0x72, 0x61, 0x77, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x29, - 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, - 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, - 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x61, - 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, - 0x6e, 0x63, 0x65, 0x56, 0x31, 0x22, 0xd7, 0x03, 0x0a, 0x1d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4f, - 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x31, 0x12, 0x1d, 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, - 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x35, 0x0a, 0x0f, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, - 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x0c, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x52, 0x0e, 0x73, - 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x25, 0x0a, - 0x0e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x56, 0x65, 0x72, - 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x74, 0x66, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x61, - 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, - 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, - 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, - 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x63, 0x69, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, - 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x64, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x13, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x42, 0x65, 0x66, 0x6f, 0x72, - 0x65, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x12, 0x30, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x61, 0x64, 0x64, 0x72, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, 0x72, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, - 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x14, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, - 0x22, 0x2d, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, - 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x41, 0x4d, 0x41, 0x47, 0x45, 0x44, 0x10, 0x02, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6e, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x34, 0x0a, 0x16, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x5f, 0x69, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x61, 0x64, 0x64, + 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x14, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x41, 0x64, 0x64, 0x72, 0x12, 0x1f, 0x0a, + 0x0b, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x0a, 0x64, 0x65, 0x70, 0x6f, 0x73, 0x65, 0x64, 0x4b, 0x65, 0x79, 0x12, 0x36, + 0x0a, 0x06, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1e, + 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x52, 0x06, + 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x12, 0x4c, 0x0a, 0x0b, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x5f, + 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x74, 0x66, + 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x61, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x31, 0x52, 0x0a, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x53, + 0x74, 0x61, 0x74, 0x65, 0x22, 0x6a, 0x0a, 0x17, 0x50, 0x6c, 0x61, 0x6e, 0x44, 0x69, 0x73, 0x63, + 0x61, 0x72, 0x64, 0x53, 0x74, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x70, 0x4b, 0x65, 0x79, 0x73, 0x12, + 0x24, 0x0a, 0x0e, 0x72, 0x61, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x65, 0x5f, 0x6b, 0x65, 0x79, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x72, 0x61, 0x77, 0x53, 0x74, 0x61, 0x74, + 0x65, 0x4b, 0x65, 0x79, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6b, 0x65, 0x79, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, + 0x0f, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4b, 0x65, 0x79, 0x73, + 0x22, 0x1a, 0x0a, 0x18, 0x53, 0x74, 0x61, 0x74, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x56, 0x31, 0x22, 0xd7, 0x03, 0x0a, + 0x1d, 0x53, 0x74, 0x61, 0x74, 0x65, 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, + 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x31, 0x12, 0x1d, + 0x0a, 0x0a, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x6a, 0x73, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0c, 0x52, 0x09, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x4a, 0x73, 0x6f, 0x6e, 0x12, 0x35, 0x0a, + 0x0f, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x5f, 0x70, 0x61, 0x74, 0x68, 0x73, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x74, 0x66, 0x70, 0x6c, 0x61, 0x6e, 0x2e, + 0x50, 0x61, 0x74, 0x68, 0x52, 0x0e, 0x73, 0x65, 0x6e, 0x73, 0x69, 0x74, 0x69, 0x76, 0x65, 0x50, + 0x61, 0x74, 0x68, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x73, 0x63, 0x68, 0x65, 0x6d, 0x61, 0x5f, 0x76, + 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x73, 0x63, + 0x68, 0x65, 0x6d, 0x61, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x12, 0x4a, 0x0a, 0x06, 0x73, + 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x32, 0x2e, 0x74, 0x66, + 0x73, 0x74, 0x61, 0x63, 0x6b, 0x64, 0x61, 0x74, 0x61, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x65, + 0x52, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6e, 0x63, 0x65, + 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x56, 0x31, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, + 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x64, + 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x12, 0x32, 0x0a, 0x15, 0x63, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x5f, 0x64, 0x65, 0x73, + 0x74, 0x72, 0x6f, 0x79, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x13, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x44, 0x65, 0x73, 0x74, 0x72, 0x6f, 0x79, 0x12, + 0x30, 0x0a, 0x14, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, + 0x69, 0x67, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x41, 0x64, 0x64, + 0x72, 0x12, 0x34, 0x0a, 0x16, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x73, 0x70, + 0x65, 0x63, 0x69, 0x66, 0x69, 0x63, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x0c, 0x52, 0x14, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x53, 0x70, 0x65, 0x63, 0x69, + 0x66, 0x69, 0x63, 0x44, 0x61, 0x74, 0x61, 0x22, 0x2d, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x09, + 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x44, 0x41, 0x4d, + 0x41, 0x47, 0x45, 0x44, 0x10, 0x02, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/internal/stacks/tfstackdata1/tfstackdata1.proto b/internal/stacks/tfstackdata1/tfstackdata1.proto index 87793e879c..12b7883d5c 100644 --- a/internal/stacks/tfstackdata1/tfstackdata1.proto +++ b/internal/stacks/tfstackdata1/tfstackdata1.proto @@ -101,6 +101,8 @@ message PlanResourceInstanceChangePlanned { // The same string must previously have been announced with a // PlanComponentInstance message, or the overall plan sequence is invalid. string component_instance_addr = 1; + string resource_instance_addr = 4; + string deposed_key = 5; // Description of the planned change in the standard "tfplan" (planproto) // format.