Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] provider/azurerm: CosmosDB (DocumentDB) #11499

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
db3fb65
Adding the DocumentDB dependency
tombuildsstuff Jan 29, 2017
dfe0741
CRUD for DocumentDB
tombuildsstuff Jan 29, 2017
7db560c
Import tests for the super happy path
tombuildsstuff Jan 29, 2017
a7c8e32
Geo replicated tests
tombuildsstuff Jan 29, 2017
f4392c2
Scaffolding the Documentation
tombuildsstuff Feb 5, 2017
2b12d9a
Adding the computed fields
tombuildsstuff Feb 5, 2017
e3fcce5
explicitly setting the replication policy id
tombuildsstuff Feb 18, 2017
8ff2669
Refactoring
tombuildsstuff Feb 20, 2017
7b7e4f9
Removing the unused strings import
tombuildsstuff Feb 24, 2017
ff82f61
fixing the validation messages
tombuildsstuff Feb 24, 2017
c98eca7
Fixing the merge conflict
tombuildsstuff Feb 25, 2017
bfe93be
Updating the SDK
tombuildsstuff Feb 25, 2017
0cb29fa
Added tests for the interval in seconds validation
tombuildsstuff Mar 15, 2017
daa3bae
Checking each priority is unique
tombuildsstuff Apr 17, 2017
276b747
Re govendor syncing
tombuildsstuff Apr 17, 2017
465cd81
fixing the build
tombuildsstuff Apr 17, 2017
ad32590
Updating to v10 of the sdk
tombuildsstuff May 19, 2017
6a2b1a5
Updating to SDK v10
tombuildsstuff May 20, 2017
d9b1cc2
Fixing to use the new autorest
tombuildsstuff Jun 2, 2017
488c543
Adding validation for the name
tombuildsstuff Jun 2, 2017
c0a7f72
Validation and test changes
tombuildsstuff Jun 3, 2017
f9b049d
Updating the max staleness field
tombuildsstuff Jun 3, 2017
437c7bb
DocumentDB -> CosmosDB
tombuildsstuff Jun 3, 2017
a3c5b93
Renaming to match
tombuildsstuff Jun 3, 2017
84fd6e0
Updating the docs to use CosmosDB
tombuildsstuff Jun 3, 2017
d890319
Adding the ip_range_filter field
tombuildsstuff Jun 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions builtin/providers/azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/Azure/azure-sdk-for-go/arm/containerregistry"
"github.com/Azure/azure-sdk-for-go/arm/containerservice"
"github.com/Azure/azure-sdk-for-go/arm/disk"
"github.com/Azure/azure-sdk-for-go/arm/documentdb"
"github.com/Azure/azure-sdk-for-go/arm/eventhub"
"github.com/Azure/azure-sdk-for-go/arm/keyvault"
"github.com/Azure/azure-sdk-for-go/arm/network"
Expand Down Expand Up @@ -75,6 +76,8 @@ type ArmClient struct {
containerRegistryClient containerregistry.RegistriesClient
containerServicesClient containerservice.ContainerServicesClient

documentDbClient documentdb.DatabaseAccountsClient

eventHubClient eventhub.EventHubsClient
eventHubConsumerGroupClient eventhub.ConsumerGroupsClient
eventHubNamespacesClient eventhub.NamespacesClient
Expand Down Expand Up @@ -260,6 +263,12 @@ func (c *Config) getArmClient() (*ArmClient, error) {
dkc.Sender = autorest.CreateSender(withRequestLogging())
client.diskClient = dkc

ddbc := documentdb.NewDatabaseAccountsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ddbc.Client)
ddbc.Authorizer = auth
ddbc.Sender = autorest.CreateSender(withRequestLogging())
client.documentDbClient = ddbc

ehc := eventhub.NewEventHubsClientWithBaseURI(endpoint, c.SubscriptionID)
setUserAgent(&ehc.Client)
ehc.Authorizer = auth
Expand Down
80 changes: 80 additions & 0 deletions builtin/providers/azurerm/import_arm_cosmos_db_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package azurerm

import (
"testing"

"github.com/hashicorp/terraform/helper/acctest"
"github.com/hashicorp/terraform/helper/resource"
)

func TestAccAzureRMCosmosDB_importStandardBoundedStaleness(t *testing.T) {
resourceName := "azurerm_cosmos_db.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDB_standard_boundedStaleness(ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMCosmosDBDestroy,
Steps: []resource.TestStep{
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMCosmosDB_importStandardEventualConsistency(t *testing.T) {
resourceName := "azurerm_cosmos_db.test"

ri := acctest.RandInt()
config := testAccAzureRMCosmosDB_standard_eventualConsistency(ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMCosmosDBDestroy,
Steps: []resource.TestStep{
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccAzureRMDocumentDb_importStandardGeoReplicated(t *testing.T) {
resourceName := "azurerm_documentdb.test"

ri := acctest.RandInt()
config := testAccAzureRMDocumentDb_standardGeoReplicated(ri)

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testCheckAzureRMDocumentDbDestroy,
Steps: []resource.TestStep{
{
Config: config,
},

{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}
2 changes: 2 additions & 0 deletions builtin/providers/azurerm/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ func Provider() terraform.ResourceProvider {
"azurerm_cdn_profile": resourceArmCdnProfile(),
"azurerm_container_registry": resourceArmContainerRegistry(),
"azurerm_container_service": resourceArmContainerService(),
"azurerm_cosmos_db": resourceArmCosmosDB(),

"azurerm_eventhub": resourceArmEventHub(),
"azurerm_eventhub_authorization_rule": resourceArmEventHubAuthorizationRule(),
Expand Down Expand Up @@ -248,6 +249,7 @@ func registerAzureResourceProvidersWithSubscription(providerList []resources.Pro
"Microsoft.Cache": struct{}{},
"Microsoft.ContainerRegistry": struct{}{},
"Microsoft.ContainerService": struct{}{},
"Microsoft.DocumentDB": struct{}{},
"Microsoft.Network": struct{}{},
"Microsoft.Cdn": struct{}{},
"Microsoft.Storage": struct{}{},
Expand Down
Loading