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

Support for AllowSelfServeUpgradeToMongo36 to cosmosdb_account #8334

Closed
ichizero opened this issue Sep 3, 2020 · 3 comments · Fixed by #8335
Closed

Support for AllowSelfServeUpgradeToMongo36 to cosmosdb_account #8334

ichizero opened this issue Sep 3, 2020 · 3 comments · Fixed by #8335

Comments

@ichizero
Copy link
Contributor

ichizero commented Sep 3, 2020

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

Description

When the feature to upgrade an existing Cosmos DB mongo version to 3.6 was rolled out to our Cosmos DB, the AllowSelfServeUpgradeToMongo36 was added to a terraform state and caused a force resource replacement.
After upgrading Cosmos DB on the portal, the AllowSelfServeUpgradeToMongo36 feature remains in a terraform state.

https://feedback.azure.com/forums/263030-azure-cosmos-db/suggestions/39654955-upgrading-existing-accounts-from-mongodb-server-ve

  # azurerm_cosmosdb_account.xxx must be replaced
-/+ resource "azurerm_cosmosdb_account" "xxx" {
      ~ connection_strings                = (sensitive value)
        enable_automatic_failover         = false
        enable_free_tier                  = false
        enable_multiple_write_locations   = false
      ~ endpoint                          = "https://xxx.documents.azure.com:443/" -> (known after apply)
      ~ id                                = "/subscriptions/xxx" -> (known after apply)
        is_virtual_network_filter_enabled = false
        kind                              = "MongoDB"
        location                          = "japaneast"
        name                              = "xxx"
        offer_type                        = "Standard"
      ~ primary_master_key                = (sensitive value)
      ~ primary_readonly_master_key       = (sensitive value)
      ~ read_endpoints                    = [
          - "https://xxx.documents.azure.com:443/",
        ] -> (known after apply)
        resource_group_name               = "xxx"
      ~ secondary_master_key              = (sensitive value)
      ~ secondary_readonly_master_key     = (sensitive value)
      ~ write_endpoints                   = [
          - "https://xxx.documents.azure.com:443/",
        ] -> (known after apply)

      - capabilities { # forces replacement
          - name = "AllowSelfServeUpgradeToMongo36" -> null
        }
       capabilities {
            name = "DisableRateLimitingResponses"
        }
       capabilities {
            name = "EnableMongo"
        }

        consistency_policy {
            consistency_level       = "BoundedStaleness"
            max_interval_in_seconds = 5
            max_staleness_prefix    = 100
        }

      - geo_location {
          - failover_priority = 0 -> null
          - id                = "xxx" -> null
          - location          = "japaneast" -> null
        }
      + geo_location {
          + failover_priority = 0
          + id                = (known after apply)
          + location          = "japaneast"
        }
    }

I added the AllowSelfServeUpgradeToMongo36 to the tf file, but the Azure provider refused it.

Error: expected capabilities.0.name to be one of [EnableAggregationPipeline EnableCassandra EnableGremlin EnableTable EnableMongo MongoDBv3.4 mongoEnableDocLevelTTL DisableRateLimitingResponses], got AllowSelfServeUpgradeToMongo36

  on main.tf line 224, in resource "azurerm_cosmosdb_account" "xxx":
 224: resource "azurerm_cosmosdb_account" "xxx" {

I'd like to add support for AlowServeUpgradeToMongo36 to cosmosdb_account.

New or Affected Resource(s)

  • azurerm_cosmosdb_account

Potential Terraform Configuration

resource "azurerm_cosmosdb_account" "db" {
  name                = "tfex-cosmos-db-${random_integer.ri.result}"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name
  offer_type          = "Standard"
  kind                = "GlobalDocumentDB"

  enable_automatic_failover = true

  consistency_policy {
    consistency_level       = "BoundedStaleness"
    max_interval_in_seconds = 10
    max_staleness_prefix    = 200
  }

  geo_location {
    location          = var.failover_location
    failover_priority = 1
  }

  geo_location {
    prefix            = "tfex-cosmos-db-${random_integer.ri.result}-customid"
    location          = azurerm_resource_group.rg.location
    failover_priority = 0
  }

  capabilities {
    name = "AllowSelfServeUpgradeToMongo36" # support it
  }
}
@dazwin
Copy link

dazwin commented Sep 3, 2020

Workaround for now (but should removed again ASAP after the PR has been released)...

resource "azurerm_cosmosdb_account" "db" {
lifecycle {
    prevent_destroy = true
    ignore_changes = [
      capabilities
    ]
  }
}

@ghost
Copy link

ghost commented Sep 10, 2020

This has been released in version 2.27.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.27.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Oct 4, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants