From 72ba8a869e69feb8151a88e3499de1f8266de1f5 Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Fri, 2 Sep 2022 14:49:25 -0500 Subject: [PATCH] removes EnableForcePush and other unrelated code --- internal/cloud/state.go | 15 ++------------- internal/command/command_test.go | 3 --- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/internal/cloud/state.go b/internal/cloud/state.go index 04d9f7773439..6f1a433b0d2b 100644 --- a/internal/cloud/state.go +++ b/internal/cloud/state.go @@ -92,19 +92,13 @@ func (s *State) WriteStateForMigration(f *statefile.File, force bool) error { } } - // The remote backend needs to pass the `force` flag through to its client. - // For backends that support such operations, inform the client - // that a force push has been requested - if force { - s.EnableForcePush() - } - // We create a deep copy of the state here, because the caller also has // a reference to the given object and can potentially go on to mutate // it after we return, but we want the snapshot at this point in time. s.state = f.State.DeepCopy() s.lineage = f.Lineage s.serial = f.Serial + s.forcePush = force return nil } @@ -136,6 +130,7 @@ func (s *State) WriteState(state *states.State) error { // a reference to the given object and can potentially go on to mutate // it after we return, but we want the snapshot at this point in time. s.state = state.DeepCopy() + s.forcePush = false return nil } @@ -414,12 +409,6 @@ func (s *State) Delete() error { return nil } -// EnableForcePush to allow the remote client to overwrite state -// by implementing remote.ClientForcePusher -func (s *State) EnableForcePush() { - s.forcePush = true -} - // GetRootOutputValues fetches output values from Terraform Cloud func (s *State) GetRootOutputValues() (map[string]*states.OutputValue, error) { ctx := context.Background() diff --git a/internal/command/command_test.go b/internal/command/command_test.go index fa498b438270..7998a554224a 100644 --- a/internal/command/command_test.go +++ b/internal/command/command_test.go @@ -138,9 +138,6 @@ func metaOverridesForProvider(p providers.Interface) *testingOverrides { Providers: map[addrs.Provider]providers.Factory{ addrs.NewDefaultProvider("test"): providers.FactoryFixed(p), addrs.NewProvider(addrs.DefaultProviderRegistryHost, "hashicorp2", "test"): providers.FactoryFixed(p), - addrs.NewLegacyProvider("null"): providers.FactoryFixed(p), - addrs.NewLegacyProvider("azurerm"): providers.FactoryFixed(p), - addrs.NewProvider(addrs.DefaultProviderRegistryHost, "acmecorp", "aws"): providers.FactoryFixed(p), }, } }