diff --git a/pkg/featureflags/feature_flags.go b/pkg/featureflags/feature_flags.go index fc7379225..812edb1a2 100644 --- a/pkg/featureflags/feature_flags.go +++ b/pkg/featureflags/feature_flags.go @@ -14,8 +14,7 @@ const ( // IF YOU USE THIS, PLEASE RAISE AN ISSUE. Since the new way of running examples was added, // the authors don't expect anyone to use the legacy method. Please let us know if you need // the old way to stay around. - EnableLegacyExamplesCommands FeatureFlagName = "legacy.examples.enabled" - DisableTfUpgradeProviderRenames FeatureFlagName = "brokerpak.terraform.upgrades.providerRenames.disabled" + EnableLegacyExamplesCommands FeatureFlagName = "legacy.examples.enabled" ) var AllFeatureFlagEnvVars []string @@ -26,7 +25,6 @@ func init() { DynamicHCLEnabled: "BROKERPAK_UPDATES_ENABLED", // deprecated pattern - future variables should start CSB_ DisableRequestPropertyValidation: "CSB_DISABLE_REQUEST_PROPERTY_VALIDATION", EnableLegacyExamplesCommands: "CSB_ENABLE_LEGACY_EXAMPLES_COMMANDS", - DisableTfUpgradeProviderRenames: "CSB_DISABLE_TF_UPGRADE_PROVIDER_RENAMES", } { viper.BindEnv(string(ffName), varName) viper.SetDefault(string(ffName), false) diff --git a/pkg/providers/tf/invoker/terraform_invoker_factory.go b/pkg/providers/tf/invoker/terraform_invoker_factory.go index 8fe7902d2..646243fd0 100644 --- a/pkg/providers/tf/invoker/terraform_invoker_factory.go +++ b/pkg/providers/tf/invoker/terraform_invoker_factory.go @@ -1,7 +1,6 @@ package invoker import ( - "github.com/cloudfoundry/cloud-service-broker/pkg/featureflags" "github.com/cloudfoundry/cloud-service-broker/pkg/providers/tf/executor" "github.com/hashicorp/go-version" ) @@ -20,8 +19,5 @@ func (factory TerraformInvokerFactory) VersionedTerraformInvoker(tfVersion *vers if tfVersion.LessThan(version.Must(version.NewVersion("0.13.0"))) { return NewTerraform012Invoker(factory.executorBuilder.VersionedExecutor(tfVersion), factory.terraformPluginsDirectory) } - if tfVersion.GreaterThanOrEqual(version.Must(version.NewVersion("1.2.0"))) && featureflags.Enabled(featureflags.DisableTfUpgradeProviderRenames) { - return NewTerraformDefaultInvoker(factory.executorBuilder.VersionedExecutor(tfVersion), factory.terraformPluginsDirectory, map[string]string{}) - } return NewTerraformDefaultInvoker(factory.executorBuilder.VersionedExecutor(tfVersion), factory.terraformPluginsDirectory, factory.pluginRenames) } diff --git a/pkg/providers/tf/invoker/terraform_invoker_factory_test.go b/pkg/providers/tf/invoker/terraform_invoker_factory_test.go index 9860cc1b9..07fbc6efd 100644 --- a/pkg/providers/tf/invoker/terraform_invoker_factory_test.go +++ b/pkg/providers/tf/invoker/terraform_invoker_factory_test.go @@ -1,13 +1,11 @@ package invoker_test import ( - "github.com/cloudfoundry/cloud-service-broker/pkg/featureflags" "github.com/cloudfoundry/cloud-service-broker/pkg/providers/tf/executor/executorfakes" "github.com/cloudfoundry/cloud-service-broker/pkg/providers/tf/invoker" "github.com/hashicorp/go-version" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/spf13/viper" ) var _ = Context("TerraformInvokerFactory", func() { @@ -58,68 +56,6 @@ var _ = Context("TerraformInvokerFactory", func() { Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.0.4"))) }) }) - - Context("1.2.0+", func() { - Context("with provider renames disabled", func() { - BeforeEach(func() { - viper.Set(string(featureflags.DisableTfUpgradeProviderRenames), true) - - }) - AfterEach(func() { - viper.Reset() - }) - - It("should return an invoker with renames, for terraform version 1.1.9", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.1.9")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, expectedProviderRenames))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.1.9"))) - }) - - It("should return an invoker with no renames, for terraform version 1.2.0", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.2.0")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, map[string]string{}))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.2.0"))) - }) - - It("should return an invoker with no renames, for terraform version 1.4.2", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.4.2")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, map[string]string{}))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.4.2"))) - }) - }) - - Context("with provider renames enabled", func() { - It("should return an invoker that performs renames, for 1.2.0", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.2.0")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, expectedProviderRenames))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.2.0"))) - }) - - It("should return an invoker that performs renames, for 1.4.2", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.4.2")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, expectedProviderRenames))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.4.2"))) - }) - - It("should return an invoker with renames, for terraform version 1.1.9", func() { - Expect( - invokerFactory.VersionedTerraformInvoker(newVersion("1.1.9")), - ).To(Equal(invoker.NewTerraformDefaultInvoker(fakeExecutor, expectedTerraformPluginDir, expectedProviderRenames))) - Expect(fakeBuilder.VersionedExecutorCallCount()).To(Equal(1)) - Expect(fakeBuilder.VersionedExecutorArgsForCall(0)).To(Equal(newVersion("1.1.9"))) - }) - }) - }) }) func newVersion(v string) *version.Version {