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

CosmosDB SQL Container Disable Indexing Doesn't Remove "included_path" block #19901

Closed
1 task done
PrestonR opened this issue Jan 7, 2023 · 3 comments · Fixed by #19998
Closed
1 task done

CosmosDB SQL Container Disable Indexing Doesn't Remove "included_path" block #19901

PrestonR opened this issue Jan 7, 2023 · 3 comments · Fixed by #19998
Labels
Milestone

Comments

@PrestonR
Copy link

PrestonR commented Jan 7, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.3.4

AzureRM Provider Version

3.32.0

Affected Resource(s)/Data Source(s)

azurerm_cosmosdb_sql_container

Terraform Configuration Files

resource "azurerm_cosmosdb_sql_container" "container" {
  name                  = var.container_name
  resource_group_name   = var.resource_group_name
  account_name          = var.account_name
  database_name         = var.database_name
  partition_key_path    = var.partition_key_path
  partition_key_version = 2

  dynamic "indexing_policy" {
    for_each = var.disable_indexing ? [] : [1]
    content {
      indexing_mode = "consistent"
      included_path {
        path = "/*"
      }
    }
  }

  dynamic "indexing_policy" {
    for_each = var.disable_indexing ? [1] : []
    content {
      indexing_mode = "none"
    }
  }

  conflict_resolution_policy {
    mode                     = "LastWriterWins"
    conflict_resolution_path = "/_ts"
  }

  timeouts {
    read = "10m"
  }
}

Debug Output/Panic Output

https://gist.github.com/PrestonR/7f92252ac0a56757f745a8520ecb6226

Expected Behaviour

Azure doesn't allow included_path to be set when indexing_mode="none" so I would expect that when I set the indexing policy to none, Terraform removes the included_path block.

Even when providing two separate dynamic blocks, Terraform doesn't detect that the included_path should be removed.

I would further note that disabling indexing for data migrations is a common task. Since we can't do this with our Terraform configuration, we have to write scripts to change the index mode.

Actual Behaviour

Since included_path isn't removed, Azure throws the following error:

Error: updating Cosmos SQL Container "[redacted]" (Account: "[redacted]", Database: "[redacted]"): included_path must not be set if indexing_mode is "None"

Steps to Reproduce

  1. terraform apply

Important Factoids

No response

References

No response

@PrestonR PrestonR added the bug label Jan 7, 2023
@github-actions github-actions bot removed the bug label Jan 7, 2023
@PrestonR
Copy link
Author

PrestonR commented Jan 7, 2023

Some Azure references advising this recommendation:

@github-actions
Copy link

This functionality has been released in v3.39.0 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants