mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #32115 from hashicorp/jbardin/apply-refresh-plan
don't lose checks from refresh-only plan
This commit is contained in:
commit
52d724d1d0
@ -25,10 +25,6 @@ func (c *Context) Apply(plan *plans.Plan, config *configs.Config) (*states.State
|
|||||||
|
|
||||||
log.Printf("[DEBUG] Building and walking apply graph for %s plan", plan.UIMode)
|
log.Printf("[DEBUG] Building and walking apply graph for %s plan", plan.UIMode)
|
||||||
|
|
||||||
// FIXME: refresh plans still store outputs as changes, so we can't use
|
|
||||||
// Empty()
|
|
||||||
possibleRefresh := len(plan.Changes.Resources) == 0
|
|
||||||
|
|
||||||
graph, operation, diags := c.applyGraph(plan, config, true)
|
graph, operation, diags := c.applyGraph(plan, config, true)
|
||||||
if diags.HasErrors() {
|
if diags.HasErrors() {
|
||||||
return nil, diags
|
return nil, diags
|
||||||
@ -81,7 +77,10 @@ Note that the -target option is not suitable for routine use, and is provided on
|
|||||||
// cleanup is going to be needed to make the plan state match what apply
|
// cleanup is going to be needed to make the plan state match what apply
|
||||||
// would do. For now we can copy the checks over which were overwritten
|
// would do. For now we can copy the checks over which were overwritten
|
||||||
// during the apply walk.
|
// during the apply walk.
|
||||||
if possibleRefresh {
|
// Despite the intent of UIMode, it must still be used for apply-time
|
||||||
|
// differences in destroy plans too, so we can make use of that here as
|
||||||
|
// well.
|
||||||
|
if plan.UIMode == plans.RefreshOnlyMode {
|
||||||
newState.CheckResults = plan.Checks.DeepCopy()
|
newState.CheckResults = plan.Checks.DeepCopy()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user