terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

azurerm_cosmosdb_account: Removing "MongoDBv3.4" capability forces recreate with mongo_server_version="4.0"

Open markbangert opened this issue 2 years ago • 2 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: 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.1.5

AzureRM Provider Version

3.23.0

Affected Resource(s)/Data Source(s)

azurerm_cosmosdb_account

Terraform Configuration Files

resource "azurerm_cosmosdb_account" "cdb" {
  name                = local.cosmos_database_account
  resource_group_name = local.resource_group_name
  location            = local.location
  offer_type          = "Standard"
  kind                = "MongoDB"
  mongo_server_version = "4.0"
...

+++ Removing the following capability forces recreate +++
  capabilities {
    name = "MongoDBv3.4"
  }
+++
...
}

Debug Output/Panic Output

- capabilities { # forces replacement
          - name = "MongoDBv3.4" -> null
        }

Expected Behaviour

We are maintaining a Cosmos DB resource with TF. Currently we are running on Mongo Server Version 4.0. For whatever reason we also specified the capability "MongoDBv3.4" within our configuration. I would expect that I can savely remove the capability to run the earlier version 3.4 from the configuration but running the terraform plan states that this would result in a recreation of our DB.

Actual Behaviour

Removing the capability "MongoDBv3.4" from a azurerm_cosmosdb_account running Mongo Server Version 4.0 forces a recreate of the Cosmos DB according to TF plan.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

markbangert avatar Sep 22 '22 09:09 markbangert

@markbangert thanks for opening this issue. As far as I know, once the MongoDBv3.4 is set up, it could not be removed by Azure API. Please correct me if I were wrong. Per the tf doc, changing capabilities forces a new resource to be created, so this is by design.

sinbai avatar Sep 23 '22 03:09 sinbai

Thank you for your kind reply. Can you further clarify what the MongoDbv3.4 capability actually means for the resource? I understand that the property

mongo_server_version = "4.0"

controls the API version. What does this capability do? Does this mean I can use both API versions, 4.0 and 3.4?

markbangert avatar Sep 23 '22 18:09 markbangert