diff --git a/integrationtest/fixtures/database-encryption/manifest.yml b/integrationtest/fixtures/database-encryption/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/database-encryption/manifest.yml +++ b/integrationtest/fixtures/database-encryption/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/global-labels/manifest.yml b/integrationtest/fixtures/global-labels/manifest.yml index a0982be16..9bec6cec4 100644 --- a/integrationtest/fixtures/global-labels/manifest.yml +++ b/integrationtest/fixtures/global-labels/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 + version: 1.5.7 - name: terraform-provider-random version: 2.2.1 service_definitions: diff --git a/integrationtest/fixtures/multiple-update-properties/manifest.yml b/integrationtest/fixtures/multiple-update-properties/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/multiple-update-properties/manifest.yml +++ b/integrationtest/fixtures/multiple-update-properties/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/prevent-destroy-during-update/manifest.yml b/integrationtest/fixtures/prevent-destroy-during-update/manifest.yml index a0982be16..9bec6cec4 100644 --- a/integrationtest/fixtures/prevent-destroy-during-update/manifest.yml +++ b/integrationtest/fixtures/prevent-destroy-during-update/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 + version: 1.5.7 - name: terraform-provider-random version: 2.2.1 service_definitions: diff --git a/integrationtest/fixtures/purge-service-instance/manifest.yml b/integrationtest/fixtures/purge-service-instance/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/purge-service-instance/manifest.yml +++ b/integrationtest/fixtures/purge-service-instance/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/subsume/manifest.yml b/integrationtest/fixtures/subsume/manifest.yml index cf4e8f62b..c785ddcf1 100644 --- a/integrationtest/fixtures/subsume/manifest.yml +++ b/integrationtest/fixtures/subsume/manifest.yml @@ -10,8 +10,8 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip - name: terraform-provider-random version: 3.1.0 service_definitions: diff --git a/integrationtest/fixtures/terraform-block-action-before-upgrade-updated/manifest.yml b/integrationtest/fixtures/terraform-block-action-before-upgrade-updated/manifest.yml index 342708706..9ffdf999c 100644 --- a/integrationtest/fixtures/terraform-block-action-before-upgrade-updated/manifest.yml +++ b/integrationtest/fixtures/terraform-block-action-before-upgrade-updated/manifest.yml @@ -10,9 +10,9 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 + version: 1.4.6 - name: terraform - version: 0.13.7 + version: 1.5.7 default: true - name: terraform-provider-random version: 3.1.0 @@ -20,7 +20,7 @@ terraform_binaries: terraform_state_provider_replacements: registry.terraform.io/-/random: "registry.terraform.io/hashicorp/random" terraform_upgrade_path: - - version: 0.12.21 - - version: 0.13.7 + - version: 1.4.6 + - version: 1.5.7 service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/terraform-block-action-before-upgrade/manifest.yml b/integrationtest/fixtures/terraform-block-action-before-upgrade/manifest.yml index a0982be16..f3bbdb7c3 100644 --- a/integrationtest/fixtures/terraform-block-action-before-upgrade/manifest.yml +++ b/integrationtest/fixtures/terraform-block-action-before-upgrade/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 + version: 1.4.6 - name: terraform-provider-random version: 2.2.1 service_definitions: diff --git a/integrationtest/fixtures/terraform-module-upgrade-updated/fake-provision.tf b/integrationtest/fixtures/terraform-module-upgrade-updated/fake-provision.tf index b6b5f0a4b..0935dd92a 100644 --- a/integrationtest/fixtures/terraform-module-upgrade-updated/fake-provision.tf +++ b/integrationtest/fixtures/terraform-module-upgrade-updated/fake-provision.tf @@ -13,4 +13,5 @@ resource "random_password" "password" { output "provision_output" { value = random_password.password.result + sensitive = true } \ No newline at end of file diff --git a/integrationtest/fixtures/terraform-module-upgrade-updated/fake-service.yml b/integrationtest/fixtures/terraform-module-upgrade-updated/fake-service.yml index 51c95339b..cc32bc957 100644 --- a/integrationtest/fixtures/terraform-module-upgrade-updated/fake-service.yml +++ b/integrationtest/fixtures/terraform-module-upgrade-updated/fake-service.yml @@ -12,13 +12,15 @@ plans: description: First plan display_name: First provision: - template_ref: fake-provision.tf + template_refs: + main: fake-provision.tf outputs: - field_name: provision_output type: string details: provision output bind: - template_ref: fake-provision.tf + template_refs: + main: fake-provision.tf outputs: - field_name: provision_output type: string diff --git a/integrationtest/fixtures/terraform-module-upgrade-updated/manifest.yml b/integrationtest/fixtures/terraform-module-upgrade-updated/manifest.yml index 3d512cfb5..4efbda9e6 100644 --- a/integrationtest/fixtures/terraform-module-upgrade-updated/manifest.yml +++ b/integrationtest/fixtures/terraform-module-upgrade-updated/manifest.yml @@ -19,6 +19,8 @@ terraform_binaries: version: 1.0.10 - name: terraform version: 1.1.6 +- name: terraform + version: 1.5.7 default: true - name: terraform-provider-random version: 3.1.0 @@ -30,5 +32,6 @@ terraform_upgrade_path: - version: 0.14.9 - version: 1.0.10 - version: 1.1.6 +- version: 1.5.7 service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/terraform-module-upgrade/fake-service.yml b/integrationtest/fixtures/terraform-module-upgrade/fake-service.yml index 30650f079..6623ed133 100644 --- a/integrationtest/fixtures/terraform-module-upgrade/fake-service.yml +++ b/integrationtest/fixtures/terraform-module-upgrade/fake-service.yml @@ -12,13 +12,15 @@ plans: description: First plan display_name: First provision: - template_ref: fake-provision.tf + template_refs: + main: fake-provision.tf outputs: - field_name: provision_output type: string details: provision output bind: - template_ref: fake-provision.tf + template_refs: + main: fake-provision.tf outputs: - field_name: provision_output type: string diff --git a/integrationtest/fixtures/terraform-rename-provider/manifest.yml b/integrationtest/fixtures/terraform-rename-provider/manifest.yml index b2f401f6f..1fe75ec4a 100644 --- a/integrationtest/fixtures/terraform-rename-provider/manifest.yml +++ b/integrationtest/fixtures/terraform-rename-provider/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.13.7 + version: 1.5.7 default: true - name: terraform-provider-random provider: "ContentSquare/random" diff --git a/integrationtest/fixtures/terraform-upgrade-updated/manifest.yml b/integrationtest/fixtures/terraform-upgrade-updated/manifest.yml index 1353df14b..4efbda9e6 100644 --- a/integrationtest/fixtures/terraform-upgrade-updated/manifest.yml +++ b/integrationtest/fixtures/terraform-upgrade-updated/manifest.yml @@ -20,7 +20,7 @@ terraform_binaries: - name: terraform version: 1.1.6 - name: terraform - version: 1.2.3 + version: 1.5.7 default: true - name: terraform-provider-random version: 3.1.0 @@ -32,6 +32,6 @@ terraform_upgrade_path: - version: 0.14.9 - version: 1.0.10 - version: 1.1.6 -- version: 1.2.3 +- version: 1.5.7 service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/tf_attribute_skip/fake-provision.tf b/integrationtest/fixtures/tf_attribute_skip/fake-provision.tf index e69de29bb..657e19251 100644 --- a/integrationtest/fixtures/tf_attribute_skip/fake-provision.tf +++ b/integrationtest/fixtures/tf_attribute_skip/fake-provision.tf @@ -0,0 +1,16 @@ +## new versions of terraform fail with a different error to the one we want to trigger if this file is empty. +## adding some dummy terraform to test errors when a particular field is not present. + +terraform { + required_providers { + random = { + source = "hashicorp/random" + version = "3.1.0" + } + } +} + +resource "random_integer" "priority" { + min = 3 + max = 4 +} \ No newline at end of file diff --git a/integrationtest/fixtures/tf_attribute_skip/manifest.yml b/integrationtest/fixtures/tf_attribute_skip/manifest.yml index 0b637ba25..f67c27a07 100644 --- a/integrationtest/fixtures/tf_attribute_skip/manifest.yml +++ b/integrationtest/fixtures/tf_attribute_skip/manifest.yml @@ -10,7 +10,9 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.4.6 + source: https://github.com/hashicorp/terraform/archive/v1.4.6.zip +- name: terraform-provider-random + version: 3.1.0 service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/update-brokerpak-hcl-updated-with-error/manifest.yml b/integrationtest/fixtures/update-brokerpak-hcl-updated-with-error/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/update-brokerpak-hcl-updated-with-error/manifest.yml +++ b/integrationtest/fixtures/update-brokerpak-hcl-updated-with-error/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/update-brokerpak-hcl-updated/manifest.yml b/integrationtest/fixtures/update-brokerpak-hcl-updated/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/update-brokerpak-hcl-updated/manifest.yml +++ b/integrationtest/fixtures/update-brokerpak-hcl-updated/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/fixtures/update-brokerpak-hcl/manifest.yml b/integrationtest/fixtures/update-brokerpak-hcl/manifest.yml index 0b637ba25..2c8c3ed0e 100644 --- a/integrationtest/fixtures/update-brokerpak-hcl/manifest.yml +++ b/integrationtest/fixtures/update-brokerpak-hcl/manifest.yml @@ -10,7 +10,7 @@ platforms: arch: amd64 terraform_binaries: - name: terraform - version: 0.12.21 - source: https://github.com/hashicorp/terraform/archive/v0.12.21.zip + version: 1.5.7 + source: https://github.com/hashicorp/terraform/archive/v1.5.7.zip service_definitions: - fake-service.yml diff --git a/integrationtest/terraform_block_action_before_upgrade_test.go b/integrationtest/terraform_block_action_before_upgrade_test.go index 0207c1583..53a7eb9d8 100644 --- a/integrationtest/terraform_block_action_before_upgrade_test.go +++ b/integrationtest/terraform_block_action_before_upgrade_test.go @@ -15,6 +15,7 @@ import ( var _ = Describe("Terraform block action before upgrade", func() { const serviceOfferingGUID = "df2c1512-3013-11ec-8704-2fbfa9c8a802" const servicePlanGUID = "e59773ce-3013-11ec-9bbb-9376b4f72d14" + const oldTerraformVersion = "1.4.6" var ( brokerpak string @@ -48,9 +49,9 @@ var _ = Describe("Terraform block action before upgrade", func() { Describe("Bind", func() { When("Default Terraform version greater than instance", func() { It("returns an error", func() { - By("provisioning a service instance at 0.12") + By("provisioning a service instance at an older version of terraform") serviceInstance := must(broker.Provision(serviceOfferingGUID, servicePlanGUID)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) By("updating the brokerpak and restarting the broker") Expect(broker.Stop()).To(Succeed()) @@ -62,7 +63,7 @@ var _ = Describe("Terraform block action before upgrade", func() { _, err := broker.CreateBinding(serviceInstance) Expect(err).To(MatchError(ContainSubstring("operation attempted with newer version of Terraform than current state, upgrade the service before retrying operation"))) Expect(broker.LastOperationFinalState(serviceInstance.GUID)).To(Equal(domain.Succeeded)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) }) }) }) @@ -70,9 +71,9 @@ var _ = Describe("Terraform block action before upgrade", func() { Describe("Unbind", func() { When("Default Terraform version greater than instance", func() { It("returns an error", func() { - By("provisioning a service instance at 0.12") + By("provisioning a service instance at an old terraform version") serviceInstance := must(broker.Provision(serviceOfferingGUID, servicePlanGUID)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) By("creating a binding") binding := must(broker.CreateBinding(serviceInstance)) @@ -87,7 +88,7 @@ var _ = Describe("Terraform block action before upgrade", func() { err := broker.DeleteBinding(serviceInstance, binding.GUID) Expect(err).To(MatchError(ContainSubstring("operation attempted with newer version of Terraform than current state, upgrade the service before retrying operation"))) Expect(broker.LastOperationFinalState(serviceInstance.GUID)).To(Equal(domain.Succeeded)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) }) }) }) @@ -95,9 +96,9 @@ var _ = Describe("Terraform block action before upgrade", func() { Describe("Delete", func() { When("Default Terraform version greater than instance", func() { It("returns an error", func() { - By("provisioning a service instance at 0.12") + By("provisioning a service instance at an old terraform version") serviceInstance := must(broker.Provision(serviceOfferingGUID, servicePlanGUID)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) By("updating the brokerpak and restarting the broker") Expect(broker.Stop()).To(Succeed()) @@ -109,7 +110,7 @@ var _ = Describe("Terraform block action before upgrade", func() { err := broker.Deprovision(serviceInstance) Expect(err).To(MatchError(ContainSubstring("operation attempted with newer version of Terraform than current state, upgrade the service before retrying operation"))) Expect(broker.LastOperationFinalState(serviceInstance.GUID)).To(Equal(domain.Succeeded)) - Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal("0.12.21")) + Expect(terraformStateVersion(serviceInstance.GUID)).To(Equal(oldTerraformVersion)) }) }) }) diff --git a/integrationtest/terraform_module_upgrade_test.go b/integrationtest/terraform_module_upgrade_test.go index 7c8d2f5f0..5743d94d6 100644 --- a/integrationtest/terraform_module_upgrade_test.go +++ b/integrationtest/terraform_module_upgrade_test.go @@ -14,6 +14,7 @@ var _ = Describe("Terraform Module Upgrade", func() { const ( serviceOfferingGUID = "df2c1512-3013-11ec-8704-2fbfa9c8a802" servicePlanGUID = "e59773ce-3013-11ec-9bbb-9376b4f72d14" + newTerraformVersion = "1.5.7" ) var ( @@ -65,12 +66,12 @@ var _ = Describe("Terraform Module Upgrade", func() { Expect(bindingTerraformStateVersion(serviceInstance.GUID, secondBinding.GUID)).To(Equal("0.12.21")) By("running 'cf update-service'") - Expect(broker.UpgradeService(serviceInstance, "1.1.6", testdrive.WithUpgradePreviousValues(domain.PreviousValues{PlanID: servicePlanGUID}))).To(Succeed()) + Expect(broker.UpgradeService(serviceInstance, newTerraformVersion, testdrive.WithUpgradePreviousValues(domain.PreviousValues{PlanID: servicePlanGUID}))).To(Succeed()) By("observing that the instance TF state file has been updated to the latest version") - Expect(instanceTerraformStateVersion(serviceInstance.GUID)).To(Equal("1.1.6")) - Expect(bindingTerraformStateVersion(serviceInstance.GUID, firstBinding.GUID)).To(Equal("1.1.6")) - Expect(bindingTerraformStateVersion(serviceInstance.GUID, secondBinding.GUID)).To(Equal("1.1.6")) + Expect(instanceTerraformStateVersion(serviceInstance.GUID)).To(Equal(newTerraformVersion)) + Expect(bindingTerraformStateVersion(serviceInstance.GUID, firstBinding.GUID)).To(Equal(newTerraformVersion)) + Expect(bindingTerraformStateVersion(serviceInstance.GUID, secondBinding.GUID)).To(Equal(newTerraformVersion)) }) }) }) diff --git a/integrationtest/terraform_rename_provider_test.go b/integrationtest/terraform_rename_provider_test.go index 37b6efb33..f2c3e64d9 100644 --- a/integrationtest/terraform_rename_provider_test.go +++ b/integrationtest/terraform_rename_provider_test.go @@ -10,8 +10,9 @@ import ( var _ = Describe("Terraform Rename Provider", func() { var ( - brokerpak string - broker *testdrive.Broker + brokerpak string + broker *testdrive.Broker + terraformVersion = "1.5.7" ) BeforeEach(func() { @@ -40,10 +41,10 @@ var _ = Describe("Terraform Rename Provider", func() { By("running 'cf update-service'") Expect(broker.UpgradeService( - serviceInstance, "0.13.7", + serviceInstance, terraformVersion, testdrive.WithUpgradePreviousValues(domain.PreviousValues{ PlanID: servicePlanGUID, - MaintenanceInfo: &domain.MaintenanceInfo{Version: "0.13.7"}, + MaintenanceInfo: &domain.MaintenanceInfo{Version: terraformVersion}, }), testdrive.WithUpgradeParams(`{"alpha_input":"quz"}`), )).To(Succeed()) diff --git a/integrationtest/terraform_upgrade_test.go b/integrationtest/terraform_upgrade_test.go index 963025ff3..a71b73013 100644 --- a/integrationtest/terraform_upgrade_test.go +++ b/integrationtest/terraform_upgrade_test.go @@ -17,7 +17,7 @@ var _ = Describe("Terraform Upgrade", func() { serviceOfferingGUID = "df2c1512-3013-11ec-8704-2fbfa9c8a802" servicePlanGUID = "e59773ce-3013-11ec-9bbb-9376b4f72d14" startingVersion = "0.12.21" - endingVersion = "1.2.3" + endingVersion = "1.5.7" ) var (