terraform: Plan.Context

This commit is contained in:
Mitchell Hashimoto 2014-07-03 11:32:44 -07:00
parent 99757dc930
commit 51396f02c6
1 changed files with 12 additions and 0 deletions

View File

@ -40,6 +40,18 @@ type Plan struct {
once sync.Once
}
// Context returns a Context with the data encapsulated in this plan.
//
// The following fields in opts are overridden by the plan: Config,
// Diff, State, Variables.
func (p *Plan) Context(opts *ContextOpts) *Context {
opts.Config = p.Config
opts.Diff = p.Diff
opts.State = p.State
opts.Variables = p.Vars
return NewContext(opts)
}
func (p *Plan) String() string {
buf := new(bytes.Buffer)
buf.WriteString("DIFF:\n\n")