@@ -342,6 +342,39 @@ func TestAccAzureRMCosmosDBAccount_capabilitiesUpdate(t *testing.T) {
342
342
})
343
343
}
344
344
345
+ func TestAccAzureRMCosmosDBAccount_geoLocationsUpdate (t * testing.T ) {
346
+ data := acceptance .BuildTestData (t , "azurerm_cosmosdb_account" , "test" )
347
+
348
+ resource .ParallelTest (t , resource.TestCase {
349
+ PreCheck : func () { acceptance .PreCheck (t ) },
350
+ Providers : acceptance .SupportedProviders ,
351
+ CheckDestroy : testCheckAzureRMCosmosDBAccountDestroy ,
352
+ Steps : []resource.TestStep {
353
+ {
354
+ Config : testAccAzureRMCosmosDBAccount_basic (data , "GlobalDocumentDB" , documentdb .Eventual ),
355
+ Check : resource .ComposeAggregateTestCheckFunc (
356
+ checkAccAzureRMCosmosDBAccount_basic (data , documentdb .Eventual , 1 ),
357
+ ),
358
+ },
359
+ data .ImportStep (),
360
+ {
361
+ Config : testAccAzureRMCosmosDBAccount_geoLocationUpdate (data , "GlobalDocumentDB" , documentdb .Eventual ),
362
+ Check : resource .ComposeAggregateTestCheckFunc (
363
+ checkAccAzureRMCosmosDBAccount_basic (data , documentdb .Eventual , 2 ),
364
+ ),
365
+ },
366
+ data .ImportStep (),
367
+ {
368
+ Config : testAccAzureRMCosmosDBAccount_basic (data , "GlobalDocumentDB" , documentdb .Eventual ),
369
+ Check : resource .ComposeAggregateTestCheckFunc (
370
+ checkAccAzureRMCosmosDBAccount_basic (data , documentdb .Eventual , 1 ),
371
+ ),
372
+ },
373
+ data .ImportStep (),
374
+ },
375
+ })
376
+ }
377
+
345
378
func testCheckAzureRMCosmosDBAccountDestroy (s * terraform.State ) error {
346
379
conn := acceptance .AzureProvider .Meta ().(* clients.Client ).Cosmos .DatabaseClient
347
380
ctx := acceptance .AzureProvider .Meta ().(* clients.Client ).StopContext
@@ -644,6 +677,41 @@ resource "azurerm_cosmosdb_account" "test" {
644
677
` , data .RandomInteger , data .Locations .Primary , data .RandomInteger , string (kind ), capeTf )
645
678
}
646
679
680
+ func testAccAzureRMCosmosDBAccount_geoLocationUpdate (data acceptance.TestData , kind documentdb.DatabaseAccountKind , consistency documentdb.DefaultConsistencyLevel ) string {
681
+ return fmt .Sprintf (`
682
+ provider "azurerm" {
683
+ features {}
684
+ }
685
+
686
+ resource "azurerm_resource_group" "test" {
687
+ name = "acctestRG-cosmos-%d"
688
+ location = "%s"
689
+ }
690
+
691
+ resource "azurerm_cosmosdb_account" "test" {
692
+ name = "acctest-ca-%d"
693
+ location = azurerm_resource_group.test.location
694
+ resource_group_name = azurerm_resource_group.test.name
695
+ offer_type = "Standard"
696
+ kind = "%s"
697
+
698
+ consistency_policy {
699
+ consistency_level = "%s"
700
+ }
701
+
702
+ geo_location {
703
+ location = azurerm_resource_group.test.location
704
+ failover_priority = 0
705
+ }
706
+
707
+ geo_location {
708
+ location = "%s"
709
+ failover_priority = 1
710
+ }
711
+ }
712
+ ` , data .RandomInteger , data .Locations .Primary , data .RandomInteger , string (kind ), string (consistency ), data .Locations .Secondary )
713
+ }
714
+
647
715
func checkAccAzureRMCosmosDBAccount_basic (data acceptance.TestData , consistency documentdb.DefaultConsistencyLevel , locationCount int ) resource.TestCheckFunc {
648
716
return resource .ComposeTestCheckFunc (
649
717
testCheckAzureRMCosmosDBAccountExists (data .ResourceName ),
0 commit comments