Skip to content

Commit

Permalink
azurerm_cosmosdb_account - Support new capabilities `EnableNoSQLFul…
Browse files Browse the repository at this point in the history
…lTextSearch` (hashicorp#28114)
  • Loading branch information
shibayan authored Nov 26, 2024
1 parent 8e01fb0 commit 9672841
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 @@ -71,6 +71,7 @@ const (
databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl databaseAccountCapabilities = "EnableMongoRoleBasedAccessControl"
databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs databaseAccountCapabilities = "EnableUniqueCompoundNestedDocs"
databaseAccountCapabilitiesEnableNoSqlVectorSearch databaseAccountCapabilities = "EnableNoSQLVectorSearch"
databaseAccountCapabilitiesEnableNoSqlFullTextSearch databaseAccountCapabilities = "EnableNoSQLFullTextSearch"
databaseAccountCapabilitiesEnableTtlOnCustomPath databaseAccountCapabilities = "EnableTtlOnCustomPath"
databaseAccountCapabilitiesEnablePartialUniqueIndex databaseAccountCapabilities = "EnablePartialUniqueIndex"
)
Expand Down Expand Up @@ -103,6 +104,7 @@ var capabilitiesToKindMap = map[string]interface{}{
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(databaseAccountCapabilitiesEnableNoSqlFullTextSearch)): []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 @@ -443,6 +445,7 @@ func resourceCosmosDbAccount() *pluginsdk.Resource {
string(databaseAccountCapabilitiesEnableMongoRoleBasedAccessControl),
string(databaseAccountCapabilitiesEnableUniqueCompoundNestedDocs),
string(databaseAccountCapabilitiesEnableNoSqlVectorSearch),
string(databaseAccountCapabilitiesEnableNoSqlFullTextSearch),
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 @@ -731,6 +731,10 @@ func TestAccCosmosDBAccount_capabilities_EnableNoSQLVectorSearch(t *testing.T) {
testAccCosmosDBAccount_capabilitiesWith(t, cosmosdb.DatabaseAccountKindGlobalDocumentDB, []string{"EnableNoSQLVectorSearch"})
}

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

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 @@ -222,7 +222,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`, `EnableNoSQLVectorSearch`, `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`, `EnableNoSQLFullTextSearch`, `EnablePartialUniqueIndex`, `EnableServerless`, `EnableTable`, `EnableTtlOnCustomPath`, `EnableUniqueCompoundNestedDocs`, `MongoDBv3.4` and `mongoEnableDocLevelTTL`.

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

Expand Down

0 comments on commit 9672841

Please sign in to comment.