-
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_sql_container - support for indexing_policy
#8461
azurerm_cosmosdb_sql_container - support for indexing_policy
#8461
Conversation
@@ -0,0 +1,122 @@ | |||
package common |
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.
Added these to common as the Gremlin Graph resource could migrate over to these in the future
Computed: true, | ||
Elem: &schema.Resource{ | ||
Schema: map[string]*schema.Schema{ | ||
"path": { |
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.
I only did path
here as the indexes
field was accepted by the REST API, but did not return the indexes
field in response.
|
||
func CosmosDbIndexingPolicySchema() *schema.Schema { | ||
return &schema.Schema{ | ||
Type: schema.TypeList, |
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.
Is there a suggested pattern for validating TypeList
that does cross field validation? In the indexing policy case there are the validations of
included_path
andexcluded_path
can't be set when theindexing_mode
isNone
- One of
included_path
orexcluded_path
must contain the path/*
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.
The best solution is to validate it in create and return an error at that point if it fails
This comment has been minimized.
This comment has been minimized.
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.
Thanks for the PR @marc-sensenich - overall looks good to me! if we can add that validation to the create/update function this should be good to merge 🙁
|
||
func CosmosDbIndexingPolicySchema() *schema.Schema { | ||
return &schema.Schema{ | ||
Type: schema.TypeList, |
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.
The best solution is to validate it in create and return an error at that point if it fails
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.
thanks @marc-sensenich - running the tests for the latest changes however and i'm getting:
Test Failed
------- Stdout: -------
=== RUN TestValidateAzureRmCosmosDbIndexingPolicy
TestValidateAzureRmCosmosDbIndexingPolicy: indexing_policy_test.go:198: Expected an error but didn't get one for "included_path and excluded_path with /*"
--- FAIL: TestValidateAzureRmCosmosDbIndexingPolicy (0.00s)
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.
NM @marc-sensenich, ran it again and it passed! thanks for the changes 🙂
indexing_policy
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! |
Allows for the setting of indexing policies on Cosmos DB SQL Containers. Completes the work from #5546.
Test status as of e06ca00