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

azurerm_cosmosdb_sql_container - Fix property included_path can not be removed issue #19998

Merged
merged 4 commits into from
Jan 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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