Skip to content

Commit

Permalink
support new capability
Browse files Browse the repository at this point in the history
  • Loading branch information
sinbai committed Sep 11, 2024
1 parent 6367166 commit bdf6a33
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions internal/services/cosmos/cosmosdb_account_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ const (
databaseAccountCapabilitiesEnableMongoRetryableWrites databaseAccountCapabilities = "EnableMongoRetryableWrites"
databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl databaseAccountCapabilities = "EnableMongoRoleBasedAccessControl"
databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs databaseAccountCapabilities = "EnableUniqueCompoundNestedDocs"
databaseAccountCapabilitiesEnableNoSqlVectorSearch databaseAccountCapabilities = "EnableNoSQLVectorSearch"
databaseAccountCapabilitiesEnableTtlOnCustomPath databaseAccountCapabilities = "EnableTtlOnCustomPath"
databaseAccountCapabilitiesEnablePartialUniqueIndex databaseAccountCapabilities = "EnablePartialUniqueIndex"
)
Expand Down Expand Up @@ -99,6 +100,7 @@ var capabilitiesToKindMap = map[string]interface{}{
strings.ToLower(string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindMongoDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableTtlOnCustomPath)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindMongoDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnablePartialUniqueIndex)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindMongoDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableNoSqlVectorSearch)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB))},
strings.ToLower(string(databaseAccountCapabilitiesEnableCassandra)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
strings.ToLower(string(databaseAccountCapabilitiesEnableGremlin)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
strings.ToLower(string(databaseAccountCapabilitiesEnableTable)): []string{strings.ToLower(string(cosmosdb.DatabaseAccountKindGlobalDocumentDB)), strings.ToLower(string(cosmosdb.DatabaseAccountKindParse))},
Expand Down Expand Up @@ -427,6 +429,7 @@ func resourceCosmosDbAccount() *pluginsdk.Resource {
string(databaseAccountCapabilitiesEnableMongoRetryableWrites),
string(databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl),
string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs),
string(databaseAccountCapabilitiesEnableNoSqlVectorSearch),
string(databaseAccountCapabilitiesEnableTtlOnCustomPath),
string(databaseAccountCapabilitiesEnablePartialUniqueIndex),
}, false),
Expand Down
4 changes: 4 additions & 0 deletions internal/services/cosmos/cosmosdb_account_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,10 @@ func TestAccCosmosDBAccount_capabilities_EnableServerless(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindGlobalDocumentDB, []string{"EnableServerless"})
}

func TestAccCosmosDBAccount_capabilities_EnableNoSQLVectorSearch(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindGlobalDocumentDB, []string{"EnableNoSQLVectorSearch"})
}

func TestAccCosmosDBAccount_capabilities_EnableMongo(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindMongoDB, []string{"EnableMongo"})
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/cosmosdb_account.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ The `geo_location` block Configures the geographic locations the data is replica

A `capabilities` block Configures the capabilities to be enabled for this Cosmos DB account:

* `name` - (Required) The capability to enable - Possible values are `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `EnableCassandra`, `EnableGremlin`, `EnableMongo`, `EnableMongo16MBDocumentSupport`, `EnableMongoRetryableWrites`, `EnableMongoRoleBasedAccessControl`, `EnablePartialUniqueIndex`, `EnableServerless`, `EnableTable`, `EnableTtlOnCustomPath`, `EnableUniqueCompoundNestedDocs`, `MongoDBv3.4` and `mongoEnableDocLevelTTL`.
* `name` - (Required) The capability to enable - Possible values are `AllowSelfServeUpgradeToMongo36`, `DisableRateLimitingResponses`, `EnableAggregationPipeline`, `EnableCassandra`, `EnableGremlin`, `EnableMongo`, `EnableMongo16MBDocumentSupport`, `EnableMongoRetryableWrites`, `EnableMongoRoleBasedAccessControl`, `EnableNoSQLVectorSearch`, `EnablePartialUniqueIndex`, `EnableServerless`, `EnableTable`, `EnableTtlOnCustomPath`, `EnableUniqueCompoundNestedDocs`, `MongoDBv3.4` and `mongoEnableDocLevelTTL`.

~> **Note:** Setting `MongoDBv3.4` also requires setting `EnableMongo`.

Expand Down

0 comments on commit bdf6a33

Please sign in to comment.