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

Create MongoDB v3.6 with azurerm_cosmosdb_account #4757

Closed
CapoD opened this issue Oct 30, 2019 · 6 comments · Fixed by #5325
Closed

Create MongoDB v3.6 with azurerm_cosmosdb_account #4757

CapoD opened this issue Oct 30, 2019 · 6 comments · Fixed by #5325

Comments

@CapoD
Copy link

CapoD commented Oct 30, 2019

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

We need to create a CosmosDB with a MongoDB 3.6 API Version.

New or Affected Resource(s)

  • azurerm_cosmosdb_account

Potential Terraform Configuration

capabilities {
    name = "MongoDBv3.6"
}

References

void

@peterbev
Copy link

I'm not a go developer but I'm assuming that the "good first issue" label is because at it's most basic, enabling MongoDB 3.6 simply needs EnableMongo adding to the capabilities:

"capabilities": {
	Type:     schema.TypeSet,
	Optional: true,
	Elem: &schema.Resource{
		Schema: map[string]*schema.Schema{
			"name": {
				Type:             schema.TypeString,
				Required:         true,
				DiffSuppressFunc: suppress.CaseDifference,
				ValidateFunc: validation.StringInSlice([]string{
					"EnableTable",
					"EnableGremlin",
					"EnableCassandra",
					"EnableMongo", // Enable MongoDB 3.6 wire protocol support
					"EnableAggregationPipeline",
					"MongoDBv3.4",
					"mongoEnableDocLevelTTL",
				}, true),
			},
		},
	},
	Set: resourceAzureRMCosmosDBAccountCapabilitiesHash,
},

However, as there is no validation of the capabilities I think it would only compound a situation that is already confusing:

  • EnableTable, EnableGremlin and EnableCassandra are only valid with kind GlobalDocumentDB and are all mutually exclusive.
  • EnableAggregationPipeline, MongoDBv3.4 and mongoEnableDocLevelTTL are only valid with kind MongoDB but are additive.

Adding EnableMongo which is not compatible with EnableAggregationPipeline, MongoDBv3.4 and mongoEnableDocLevelTTL as the latter are preview capabilities associated with the original MongoDB 3.2 to me just seems more confusing.

It's possible I'm over complicating things and it just needs calling out in the docs...

@peterbev
Copy link

Now I think about it, there's also the question of whether the resource needs to be recreated, EnableAggregationPipeline, MongoDBv3.4 and mongoEnableDocLevelTTL can be added to an existing CosmosDB account assuming it's of kind MongoDB and EnableMongo hasn't been specified. In all other cases the CosmosDB account will need recreating if capabilities are updated.

@peterbev
Copy link

Compiled a version for our own use that includes EnableMongo in capabilities and found it trips over this:

//for some reason capabilities doesn't always work on create, so lets patch it
//tracked: https://github.com/Azure/azure-sdk-for-go/issues/2864
future, err := client.Patch(ctx, resourceGroup, name, documentdb.DatabaseAccountPatchParameters{
	DatabaseAccountPatchProperties: &documentdb.DatabaseAccountPatchProperties{
		Capabilities: account.Capabilities,
	},
})

Crudely commented out to meet our requirements, something else to be aware of...

@aristosvo
Copy link
Collaborator

I'm trying to pick this up, but I'm not used to Go. I'll do my best:)

@ghost
Copy link

ghost commented Jan 27, 2020

This has been released in version 1.42.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 = "~> 1.42.0"
}
# ... other configuration ...

@ghost
Copy link

ghost commented Mar 28, 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 and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants