Skip to content

Commit

Permalink
azurerm_cosmosdb_sql_container - Fix property included_path can n…
Browse files Browse the repository at this point in the history
…ot be removed issue (#19998)

* fix issue 19901

* update code

* update code

* update code
  • Loading branch information
sinbai authored Jan 13, 2023
1 parent 6cb49e6 commit ed9e2ad
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
2 changes: 0 additions & 2 deletions internal/services/cosmos/common/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func CosmosDbIndexingPolicySchema() *pluginsdk.Schema {
"included_path": {
Type: pluginsdk.TypeList,
Optional: true,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"path": {
Expand All @@ -130,7 +129,6 @@ func CosmosDbIndexingPolicySchema() *pluginsdk.Schema {
"excluded_path": {
Type: pluginsdk.TypeList,
Optional: true,
Computed: true,
Elem: &pluginsdk.Resource{
Schema: map[string]*pluginsdk.Schema{
"path": {
Expand Down
25 changes: 25 additions & 0 deletions internal/services/cosmos/cosmosdb_sql_container_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ func TestAccCosmosDbSqlContainer_indexing_policy(t *testing.T) {
),
},
data.ImportStep(),
{
Config: r.indexing_policy_update_includedPath(data),
Check: acceptance.ComposeAggregateTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
{
Config: r.basic(data),
Check: acceptance.ComposeAggregateTestCheckFunc(
Expand Down Expand Up @@ -543,6 +550,24 @@ resource "azurerm_cosmosdb_sql_container" "test" {
`, CosmosSqlDatabaseResource{}.basic(data), data.RandomInteger, includedPath, excludedPath)
}

func (CosmosSqlContainerResource) indexing_policy_update_includedPath(data acceptance.TestData) string {
return fmt.Sprintf(`
%[1]s
resource "azurerm_cosmosdb_sql_container" "test" {
name = "acctest-CSQLC-%[2]d"
resource_group_name = azurerm_cosmosdb_account.test.resource_group_name
account_name = azurerm_cosmosdb_account.test.name
database_name = azurerm_cosmosdb_sql_database.test.name
partition_key_path = "/definition/id"
indexing_policy {
indexing_mode = "none"
}
}
`, CosmosSqlDatabaseResource{}.basic(data), data.RandomInteger)
}

func (CosmosSqlContainerResource) partition_key_version(data acceptance.TestData, version int) string {
return fmt.Sprintf(`
%[1]s
Expand Down

0 comments on commit ed9e2ad

Please sign in to comment.