Skip to content

Commit 46c8c9f

Browse files
authored
chore: update to Azure V4 provider (#891)
- Some properties have been renamed or turned into sets - Tests for previous upgrade have been updated to no longer expect failure first time
1 parent 2bccd59 commit 46c8c9f

File tree

11 files changed

+15
-38
lines changed

11 files changed

+15
-38
lines changed

acceptance-tests/helpers/services/upgrade.go

-11
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,3 @@ func (s *ServiceInstance) UpgradeAvailable() bool {
3838
Expect(json.Unmarshal([]byte(out), &receiver)).NotTo(HaveOccurred())
3939
return receiver.UpgradeAvailable
4040
}
41-
42-
func (s *ServiceInstance) UpgradeExpectFailure() {
43-
Expect(s.UpgradeAvailable()).To(BeTrue(), "service instance does not have an upgrade available")
44-
45-
session := cf.Start("upgrade-service", s.Name, "--force", "--wait")
46-
Eventually(session).WithTimeout(operationTimeout).Should(Exit())
47-
48-
out, _ := cf.Run("service", s.Name)
49-
Expect(out).To(MatchRegexp(`status:\s+update failed`))
50-
Expect(out).To(MatchRegexp(`message:\s+upgrade failed: Error: A resource with the ID .* already exists`))
51-
}

acceptance-tests/upgrade/update_and_upgrade_mssql_db_failover_group_existing_test.go

+1-6
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,7 @@ var _ = Describe("Upgrade and Update csb-azure-mssql-db-failover-group 'existing
104104
Expect(plans.ExistsAndAvailable(servicePlan, serviceOffering, serviceBroker.Name))
105105
Expect(plans.ExistsAndAvailable(servicePlanExisting, serviceOffering, serviceBroker.Name))
106106

107-
By("upgrading previous service, failing first time and then repeating")
108-
// Because the "azurerm_sql_database" resource is deleted at the same time as the "azurerm_mssql_database"
109-
// is created, the upgrade will fail due to using the same name in Azure
110-
initialFogInstance.UpgradeExpectFailure()
111-
// The deletion operation of the "azurerm_sql_database" resource should now have completed, so the
112-
// "azurerm_mssql_database" can be created without a name conflict in Azure
107+
By("upgrading previous service")
113108
initialFogInstance.Upgrade()
114109

115110
By("upgrading previous 'existing' service")

acceptance-tests/upgrade/update_and_upgrade_mssql_db_failover_group_test.go

+1-8
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,7 @@ var _ = Describe("UpgradeMssqlDBFailoverGroupTest", Label("mssql-db-failover-gro
9090
By("validating that the instance plan is still active")
9191
Expect(plans.ExistsAndAvailable(servicePlan, serviceOffering, serviceBroker.Name))
9292

93-
// Because the "azurerm_sql_database" resource is deleted at the same time as the "azurerm_mssql_database"
94-
// is created, the upgrade will fail due to using the same name in Azure
95-
By("upgrading previous services and failing")
96-
initialFogInstance.UpgradeExpectFailure()
97-
98-
// The deletion operation of the "azurerm_sql_database" resource should now have completed, so the
99-
// "azurerm_mssql_database" can be created without a name conflict in Azure
100-
By("upgrading again and succeeding")
93+
By("upgrading previous services")
10194
initialFogInstance.Upgrade()
10295

10396
By("getting the previously set value using the second app")

manifest.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ terraform_binaries:
3333
source: https://github.com/opentofu/opentofu/archive/v1.9.0.zip
3434
default: true
3535
- name: terraform-provider-azurerm
36-
version: 3.117.0
37-
source: https://github.com/terraform-providers/terraform-provider-azurerm/archive/v3.117.0.zip
36+
version: 4.19.0
37+
source: https://github.com/terraform-providers/terraform-provider-azurerm/archive/v4.19.0.zip
3838
- name: terraform-provider-random
3939
version: 3.6.3
4040
source: https://github.com/terraform-providers/terraform-provider-random/archive/v3.6.3.zip

terraform-tests/cosmosdb_mongo_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ var _ = Describe("CosmosDB Mongo", Label("cosmosdb-mongo-terraform"), Ordered, f
8484
"resource_group_name": Equal(resourceGroupName),
8585
"offer_type": Equal("Standard"),
8686
"kind": Equal("MongoDB"),
87-
"enable_automatic_failover": BeTrue(),
88-
"enable_multiple_write_locations": BeTrue(),
87+
"automatic_failover_enabled": BeTrue(),
88+
"multiple_write_locations_enabled": BeTrue(),
8989
"is_virtual_network_filter_enabled": BeFalse(),
9090
"public_network_access_enabled": BeTrue(),
91-
"ip_range_filter": Equal("0.0.0.0"),
91+
"ip_range_filter": ConsistOf("0.0.0.0"),
9292
"tags": MatchAllKeys(Keys{
9393
"k1": Equal("v1"),
9494
}),

terraform/azure-mongodb/provision/main.tf

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ resource "azurerm_cosmosdb_account" "mongo-account" {
5151
}
5252
}
5353

54-
enable_automatic_failover = var.enable_automatic_failover
55-
enable_multiple_write_locations = var.enable_multiple_write_locations
54+
automatic_failover_enabled = var.enable_automatic_failover
55+
multiple_write_locations_enabled = var.enable_multiple_write_locations
5656
is_virtual_network_filter_enabled = local.enable_virtual_network_filter
57-
ip_range_filter = var.ip_range_filter
57+
ip_range_filter = [var.ip_range_filter]
5858
tags = var.labels
5959
public_network_access_enabled = var.public_network_access_enabled
6060

terraform/azure-mongodb/provision/outputs.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
output "uri" {
2-
value = replace(azurerm_cosmosdb_account.mongo-account.connection_strings[0], "/?", "/${azurerm_cosmosdb_mongo_database.mongo-db.name}?")
2+
value = replace(azurerm_cosmosdb_account.mongo-account.primary_mongodb_connection_string, "/?", "/${azurerm_cosmosdb_mongo_database.mongo-db.name}?")
33
sensitive = true
44
}
55
output "status" {

terraform/azure-mongodb/provision/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "registry.terraform.io/hashicorp/azurerm"
5-
version = "~> 3"
5+
version = "~> 4"
66
}
77
random = {
88
source = "registry.terraform.io/hashicorp/random"

terraform/azure-mssql-db-failover/azure-versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "registry.terraform.io/hashicorp/azurerm"
5-
version = "~> 3"
5+
version = "~> 4"
66
}
77
}
88
}

terraform/azure-mssql-db/provision/mssql-db-versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77

88
azurerm = {
99
source = "registry.terraform.io/hashicorp/azurerm"
10-
version = "~> 3"
10+
version = "~> 4"
1111
}
1212
}
1313
}

terraform/azure-redis/provision/versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "registry.terraform.io/hashicorp/azurerm"
5-
version = "~> 3"
5+
version = "~> 4"
66
}
77
random = {
88
source = "registry.terraform.io/hashicorp/random"

0 commit comments

Comments
 (0)