Skip to content

Commit

Permalink
Merge pull request #31733 from hashicorp/megan_pr_touch_up
Browse files Browse the repository at this point in the history
removes EnableForcePush and other unrelated code
  • Loading branch information
megan07 committed Sep 8, 2022
2 parents bce43fa + 72ba8a8 commit 629b6dc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
15 changes: 2 additions & 13 deletions internal/cloud/state.go
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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()
Expand Down
3 changes: 0 additions & 3 deletions internal/command/command_test.go
Expand Up @@ -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),
},
}
}
Expand Down

0 comments on commit 629b6dc

Please sign in to comment.