-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
"Invalid index key specified" for Cosmos DB collections after running TF plan without any code changes. #8144
Comments
Same issue with versions: |
hi @bbung. Did the problem for you also started after you did a provider upgrade > 2.20.0 or just after a certain date ? |
Hi @hkailantzis, Just yesterday. I did not do any provider upgrade. I updated the azurerm provider from 2.20.0 to 2.23.0 after the error occured, to make sure to use the latest. |
thanks @bbung for the info. Thinking that maybe something changed on cosmos API/Azure side that tf provider doesn't like/support related with indexes/collections. Not sure how to tackle this, and this is blocking our infrastructure deployment pipeline right now. |
I actually have a newer CosmosDB Account that is not failing. It is exactly configured as the ones failing, was just created three weeks later. I did not recognize this before. So i think you are right. I've contacted Azure Support on this and keep you posted if i get any new findigns. |
Terraform debug gave me Do not know how it can be worked around :/ |
Hi @hkailantzis , thanks for opening this issue. I have tried an example of |
Hi @yupwei68, thanks for the reply. According to our findings as described in the previous comments, seems that there are compatibilities issues with the new cosmos API introduced in v2.20.0 and preexisting cosmos dbs accounts/collections. Please check previous comment from @akokshar, where |
Hi, i've been in contact with the Azure Support and they "disabled the fix now". I've tested and it now works. Maybe it is a good idea to make the azurerm provider capable of setting the ARM Template Version as the older version works fine. I will look into it and maybe create an feature request. Cheers, |
HI @bbung thanks for the feedback!. what does it mean exactly the 'disabled the fix now' ??. is this by account and not globally ? we re-ran TF plan with v2.20.0 and we are experiencing same error... |
Hey @hkailantzis, that is was they said and it works for me now. I do not know if it is somehow account specific, sorry! I would suggest raising a support request with MS. There should be a free plan option if you do not have a paid plan. Cheers |
cc @JeffreyRichter - this is an example of a breaking behavioural change to the CosmosDB API |
If I read this right, this seems more like an unintentional bug than an intentional breaking change. Am I reading this right? |
Hi @bbung, @hkailantzis , would it be possible the details that need to be shared with Azure support to resolve this issue? Thanks. |
hi @avdhut1990, just sharing the TF error and the link to this issue would be enough for starters. |
ok , so we got a reply from Azure support regarding our current DB collections: |
@JeffreyRichter I mean this comment sounds like a breaking behavioural change to me - there's no documentation to this effect that I've seen? This is a good example of a Generic API housing multiple "specialized" products with incompatible payloads - so catching these breaking behavioural changes is incredibly hard - whilst technically this is a new API version (and so these are allowed), there's no context for if a new API version is a breaking change or not, and no details of these behavioural changes (that I've seen in a consistent location) - compared to say with Semver where this is immediately clear? |
Hi @hkailantzis - Did you manage to resolve the issue using the feedback from support? We're just discussing how to address this in the provider, since it's likely to represent a breaking change there to compensate for the apparent behavioural change in the API. Options include:
The last I think is the better option, despite representing a breaking change in the resource as it keeps all the settings in the open, rather than masking behaviour. WDYT? |
Hi @jackofallops, we tried to include it our TF scripts and enforce it with My concern is however, with future provider upgrades, where API is changing, e.g. postgres in v2.23.0, among others, if something similar happens with existing resources and breaking changes on the API... |
@hkailantzis A colleague of mine has experienced the exact same issue last night. So a fix has not yet been published. @jackofallops suggestion makes sense to me. |
Hi @hkailantzis , @jackofallops , We received the following RCA from MS:
They resolved the issue with our affected accounts from backend, however suggested adding the "_id" key explicitly only when using custom indexes. |
Thanks for the update @avdhut1990 We'll look to try and add some validation to the resource creation to help prevent this issue in future and update the docs to reflect the new stricter requirement on the service side. |
- explicitely enable mongo API through capabilities. Without this there is an account recreation on update - add required _id index. Some context for this change in hashicorp/terraform-provider-azurerm#8144 (comment) [#180197227](https://www.pivotaltracker.com/story/show/180197227)
- explicitely enable mongo API through capabilities. Without this there is an account recreation on update - add required _id index. Some context for this change in hashicorp/terraform-provider-azurerm#8144 (comment) [#180197227](https://www.pivotaltracker.com/story/show/180197227)
* Fix issues with mongodb update - explicitely enable mongo API through capabilities. Without this there is an account recreation on update - add required _id index. Some context for this change in hashicorp/terraform-provider-azurerm#8144 (comment) [#180197227](https://www.pivotaltracker.com/story/show/180197227) * test: mongodb update plan [#180363944](https://www.pivotaltracker.com/story/show/180363944) Co-authored-by: George Blue <[email protected]>
This functionality has been released in v2.92.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! |
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. |
After upgrading successfully to azure rm provider 2.20.0, on 14.08.2020, TF plan/apply pipeline ran successfully showing no infra changes. Starting today 17.08, any subsequent tf plans fails with following error even without any code changes.
"Invalid index key specified"
for Cosmos DB collections.See below for full error details. Any hints on why this might be happening ? Thank you in advance.
Community Note
Terraform (and AzureRM Provider) Version
Terraform v0.12.26
provider.azurerm v2.20.0
Affected Resource(s)
azurerm_cosmosdb_mongo_collection
Terraform Configuration Files
Debug Output
Panic Output
Expected Behavior
TF plan should ran again successfully since last run.
Actual Behavior
TF plan fails for all of the cosmosDB collections with:
Error: Error reading Cosmos Mongo Collection "test" (Account: "cosmos-db-test", Database: "test"): documentdb.MongoDBResourcesClient#GetMongoDBCollection: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="Invalid index key specified.\r\nActivityId: 76c8c64d-cb9c-4862-90aa-2004b805b5ea, Microsoft.Azure.Documents.Common/2.11.0"
Steps to Reproduce
terraform plan
Important Factoids
References
The text was updated successfully, but these errors were encountered: