-
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
azurerm_cosmosdb_mongo_collection
: ignore throughput if Cosmos DB provisioned in 'serverless' capacity mode
#10389
azurerm_cosmosdb_mongo_collection
: ignore throughput if Cosmos DB provisioned in 'serverless' capacity mode
#10389
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @wiebeck, thanks for taking the time to write this PR! I just have a minor comment for an extra anil check and a request to add serverless
tests to each of the resources you've touched. I believe a couple already have tests for serverless so we just have to make sure the others have them too
func isServerlessCapacityMode(accResp documentdb.DatabaseAccountGetResults) bool { | ||
if props := accResp.DatabaseAccountGetProperties; props != nil && props.Capabilities != nil { | ||
for _, v := range *props.Capabilities { | ||
if *v.Name == "EnableServerless" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should confirm that v
isn't nil before pointing to it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
azurerm_cosmosdb_mongo_collection
: ignore throughput if Cosmos DB provisioned in 'serverless' capacity mode
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! |
This should fix #9697. I stumbled upon the same "Error reading Throughput on Cosmos Mongo Collection" when I provisioned a "serverless" Cosmos DB in Mongo mode.
There was already some code in other places (obviously missing from
cosmosdb_mongo_collection_resource.go
) that handles throughput if and only if...Capabilities
Capabilities
do not containEnableServerless
However I think that throughput should also be handled if there are no
Capabilities
since "Provisioned throughput" is the default, so I fixed that as well.I moved the code into a central function
isServerlessCapacityMode
(DRY!) which I put into filecosmosdb_account_resource.go
. Not sure if this is the right place though.Feedback very welcome!