@@ -24,7 +24,6 @@ type genericWalkFunc func(*walkContext, *Resource) error
2424//
2525// Additionally, a context can be created from a Plan using Plan.Context.
2626type Context struct {
27- config * config.Config
2827 module * module.Tree
2928 diff * Diff
3029 hooks []Hook
@@ -74,13 +73,7 @@ func NewContext(opts *ContextOpts) *Context {
7473 }
7574 parCh := make (chan struct {}, par )
7675
77- var config * config.Config
78- if opts .Module != nil {
79- config = opts .Module .Config ()
80- }
81-
8276 return & Context {
83- config : config ,
8477 diff : opts .Diff ,
8578 hooks : hooks ,
8679 module : opts .Module ,
@@ -139,7 +132,7 @@ func (c *Context) Plan(opts *PlanOpts) (*Plan, error) {
139132 defer c .releaseRun (v )
140133
141134 p := & Plan {
142- Config : c .config ,
135+ Module : c .module ,
143136 Vars : c .variables ,
144137 State : c .state ,
145138 }
@@ -223,12 +216,12 @@ func (c *Context) Validate() ([]string, []error) {
223216 var rerr * multierror.Error
224217
225218 // Validate the configuration itself
226- if err := c .config .Validate (); err != nil {
219+ if err := c .module . Config () .Validate (); err != nil {
227220 rerr = multierror .ErrorAppend (rerr , err )
228221 }
229222
230223 // Validate the user variables
231- if errs := smcUserVariables (c .config , c .variables ); len (errs ) > 0 {
224+ if errs := smcUserVariables (c .module . Config () , c .variables ); len (errs ) > 0 {
232225 rerr = multierror .ErrorAppend (rerr , errs ... )
233226 }
234227
@@ -1260,7 +1253,7 @@ func (c *walkContext) computeResourceMultiVariable(
12601253 // Get the resource from the configuration so we can know how
12611254 // many of the resource there is.
12621255 var cr * config.Resource
1263- for _ , r := range c .Context .config .Resources {
1256+ for _ , r := range c .Context .module . Config () .Resources {
12641257 if r .Id () == v .ResourceId () {
12651258 cr = r
12661259 break
0 commit comments