Merge pull request #29836 from hashicorp/chrisarcand/fix-tfc-resource-counts

command: Adjust skipping of resource counts for any remote implementation
This commit is contained in:
Chris Arcand 2021-11-01 09:50:13 -05:00 committed by GitHub
commit 3cd6c0be7a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,6 @@ import (
"strings" "strings"
"github.com/hashicorp/terraform/internal/backend" "github.com/hashicorp/terraform/internal/backend"
remoteBackend "github.com/hashicorp/terraform/internal/backend/remote"
"github.com/hashicorp/terraform/internal/command/arguments" "github.com/hashicorp/terraform/internal/command/arguments"
"github.com/hashicorp/terraform/internal/command/views" "github.com/hashicorp/terraform/internal/command/views"
"github.com/hashicorp/terraform/internal/plans/planfile" "github.com/hashicorp/terraform/internal/plans/planfile"
@ -130,9 +129,9 @@ func (c *ApplyCommand) Run(rawArgs []string) int {
return op.Result.ExitStatus() return op.Result.ExitStatus()
} }
// Render the resource count and outputs, unless we're using the remote // Render the resource count and outputs, unless those counts are being
// backend locally, in which case these are rendered remotely // rendered already in a remote Terraform process.
if rb, isRemoteBackend := be.(*remoteBackend.Remote); !isRemoteBackend || rb.IsLocalOperations() { if rb, isRemoteBackend := be.(BackendWithRemoteTerraformVersion); !isRemoteBackend || rb.IsLocalOperations() {
view.ResourceCount(args.State.StateOutPath) view.ResourceCount(args.State.StateOutPath)
if !c.Destroy && op.State != nil { if !c.Destroy && op.State != nil {
view.Outputs(op.State.RootModule().OutputValues) view.Outputs(op.State.RootModule().OutputValues)

View File

@ -60,6 +60,7 @@ type BackendOpts struct {
type BackendWithRemoteTerraformVersion interface { type BackendWithRemoteTerraformVersion interface {
IgnoreVersionConflict() IgnoreVersionConflict()
VerifyWorkspaceTerraformVersion(workspace string) tfdiags.Diagnostics VerifyWorkspaceTerraformVersion(workspace string) tfdiags.Diagnostics
IsLocalOperations() bool
} }
// Backend initializes and returns the backend for this CLI session. // Backend initializes and returns the backend for this CLI session.