mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Merge pull request #26784 from hashicorp/alisdair/only-show-root-module-output-changes
backend: Only show root module output changes
This commit is contained in:
commit
7ec85a7588
@ -314,8 +314,18 @@ func RenderPlan(plan *plans.Plan, baseState *states.State, schemas *terraform.Sc
|
|||||||
|
|
||||||
// If there is at least one planned change to the root module outputs
|
// If there is at least one planned change to the root module outputs
|
||||||
// then we'll render a summary of those too.
|
// then we'll render a summary of those too.
|
||||||
if len(plan.Changes.Outputs) > 0 {
|
var changedRootModuleOutputs []*plans.OutputChangeSrc
|
||||||
ui.Output(colorize.Color("[reset]\n[bold]Changes to Outputs:[reset]" + format.OutputChanges(plan.Changes.Outputs, colorize)))
|
for _, output := range plan.Changes.Outputs {
|
||||||
|
if !output.Addr.Module.IsRoot() {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if output.ChangeSrc.Action == plans.NoOp {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
changedRootModuleOutputs = append(changedRootModuleOutputs, output)
|
||||||
|
}
|
||||||
|
if len(changedRootModuleOutputs) > 0 {
|
||||||
|
ui.Output(colorize.Color("[reset]\n[bold]Changes to Outputs:[reset]" + format.OutputChanges(changedRootModuleOutputs, colorize)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
module "submodule" {
|
||||||
|
source = "./submodule"
|
||||||
|
}
|
||||||
|
|
||||||
output "changed" {
|
output "changed" {
|
||||||
value = "after"
|
value = "after"
|
||||||
}
|
}
|
||||||
|
3
backend/local/testdata/plan-outputs-changed/submodule/main.tf
vendored
Normal file
3
backend/local/testdata/plan-outputs-changed/submodule/main.tf
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
output "foo" {
|
||||||
|
value = "bar"
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user