mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-27 09:21:14 -06:00
make a destroy plan work the same as destroy
When working on an existing plan, the context always used walkApply, even if the plan was for a full destroy. Mark in the plan if it was icreated for a destroy, and transfer that to the context when reading the plan.
This commit is contained in:
parent
78964d305c
commit
7fde7d9f20
@ -539,6 +539,7 @@ func (c *Context) Plan() (*Plan, error) {
|
||||
var operation walkOperation
|
||||
if c.destroy {
|
||||
operation = walkPlanDestroy
|
||||
p.Destroy = true
|
||||
} else {
|
||||
// Set our state to be something temporary. We do this so that
|
||||
// the plan can update a fake state so that variables work, then
|
||||
|
@ -71,6 +71,9 @@ type Plan struct {
|
||||
// Backend is the backend that this plan should use and store data with.
|
||||
Backend *BackendState
|
||||
|
||||
// Destroy indicates that this plan was created for a full destroy operation
|
||||
Destroy bool
|
||||
|
||||
once sync.Once
|
||||
}
|
||||
|
||||
@ -100,6 +103,7 @@ func (p *Plan) contextOpts(base *ContextOpts) (*ContextOpts, error) {
|
||||
opts.Module = p.Module
|
||||
opts.Targets = p.Targets
|
||||
opts.ProviderSHA256s = p.ProviderSHA256s
|
||||
opts.Destroy = p.Destroy
|
||||
|
||||
if opts.State == nil {
|
||||
opts.State = p.State
|
||||
|
Loading…
Reference in New Issue
Block a user