Skip to content

Commit 511afcd

Browse files
committed
command: Adjust skipping of resource counts for any remote implementation
When using the Terraform Cloud integration - like the 'remote' backend - resource count output should be suppressed if those counts are being rendered remotely. This generalizes this to the shared BackendWithRemoteTerraformVersion interface.
1 parent de10559 commit 511afcd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎internal/command/apply.go‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"strings"
66

77
"github.com/hashicorp/terraform/internal/backend"
8-
remoteBackend "github.com/hashicorp/terraform/internal/backend/remote"
98
"github.com/hashicorp/terraform/internal/command/arguments"
109
"github.com/hashicorp/terraform/internal/command/views"
1110
"github.com/hashicorp/terraform/internal/plans/planfile"
@@ -130,9 +129,9 @@ func (c *ApplyCommand) Run(rawArgs []string) int {
130129
return op.Result.ExitStatus()
131130
}
132131

133-
// Render the resource count and outputs, unless we're using the remote
134-
// backend locally, in which case these are rendered remotely
135-
if rb, isRemoteBackend := be.(*remoteBackend.Remote); !isRemoteBackend || rb.IsLocalOperations() {
132+
// Render the resource count and outputs, unless those counts are being
133+
// rendered already in a remote Terraform process.
134+
if rb, isRemoteBackend := be.(BackendWithRemoteTerraformVersion); !isRemoteBackend || rb.IsLocalOperations() {
136135
view.ResourceCount(args.State.StateOutPath)
137136
if !c.Destroy && op.State != nil {
138137
view.Outputs(op.State.RootModule().OutputValues)

‎internal/command/meta_backend.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ type BackendOpts struct {
6060
type BackendWithRemoteTerraformVersion interface {
6161
IgnoreVersionConflict()
6262
VerifyWorkspaceTerraformVersion(workspace string) tfdiags.Diagnostics
63+
IsLocalOperations() bool
6364
}
6465

6566
// Backend initializes and returns the backend for this CLI session.

0 commit comments

Comments
 (0)