add state to plans.Plan

Since the refreshed state is now an artifact of the plan process, it
makes sense to add it to the Plan type, rather than adding an additional
return value to the Context.Plan method.
This commit is contained in:
James Bardin 2020-09-04 16:49:19 -04:00
parent 7b178b1788
commit 8cef62e455
1 changed files with 5 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"github.com/hashicorp/terraform/addrs" "github.com/hashicorp/terraform/addrs"
"github.com/hashicorp/terraform/configs/configschema" "github.com/hashicorp/terraform/configs/configschema"
"github.com/hashicorp/terraform/states"
"github.com/zclconf/go-cty/cty" "github.com/zclconf/go-cty/cty"
) )
@ -16,15 +17,16 @@ import (
// result that will be completed during apply by resolving any values that // result that will be completed during apply by resolving any values that
// cannot be predicted. // cannot be predicted.
// //
// A plan must always be accompanied by the state and configuration it was // A plan must always be accompanied by the configuration it was built from,
// built from, since the plan does not itself include all of the information // since the plan does not itself include all of the information required to
// required to make the changes indicated. // make the changes indicated.
type Plan struct { type Plan struct {
VariableValues map[string]DynamicValue VariableValues map[string]DynamicValue
Changes *Changes Changes *Changes
TargetAddrs []addrs.Targetable TargetAddrs []addrs.Targetable
ProviderSHA256s map[string][]byte ProviderSHA256s map[string][]byte
Backend Backend Backend Backend
State *states.State
} }
// Backend represents the backend-related configuration and other data as it // Backend represents the backend-related configuration and other data as it