cognitive_account_rai_blocklist_resource - support tags property and add validation for name property#31871
Conversation
…rule 1. Add `tags` field 2. Add validation rule for `name` for CognitiveRaiBlockLlist
cognitive_account_rai_blocklist_resoure - add field and validationcognitive_account_rai_blocklist_resource - add tags field and create validation for name field
cognitive_account_rai_blocklist_resource - add tags field and create validation for name fieldcognitive_account_rai_blocklist_resource - add property tags and validate name property
cognitive_account_rai_blocklist_resource - add property tags and validate name propertycognitive_account_rai_blocklist_resource - add property tags and validate property name
cognitive_account_rai_blocklist_resource - add property tags and validate property name cognitive_account_rai_blocklist_resource - support tags property and add validation for name property
gerrytan
left a comment
There was a problem hiding this comment.
As discussed offline, the name validation is inconsistent between portal, spec and API. We need to confirm with service what is the intended validation, and get them to fix portal + spec too if needed.
|
|
||
| * `cognitive_account_id` - (Required) The ID of the Cognitive Services Account. Changing this forces a new Cognitive Account Rai Blocklist to be created. | ||
|
|
||
| * `tags` - (Optional) A mapping of tags assigned to the resource. |
There was a problem hiding this comment.
A bit of scope creep, but I was struggling to correlate "Guardrail + Controls" -> blocklist in portal to this resource. Perhaps you can improve this docs a bit to help our customers.
gerrytan
left a comment
There was a problem hiding this comment.
Nice work @ZiChuanBuXiu , I left just 1 minor code style comment, otherwise this PR is good to go.
| } | ||
| }) | ||
| } | ||
| } |
There was a problem hiding this comment.
Nice 👍, thank you for adding unit tests
|
|
||
| if model.Tags != nil { | ||
| payload.Tags = pointer.To(model.Tags) | ||
| } |
There was a problem hiding this comment.
Wrapping this in a != nil if block is not necessary. If model.Tags is nil (zero value for map), pointer.To will still return a pointer to this zero value and subsequent JSON serialisation logic will handle this just fine.
Do a codebase search for Tags.*pointer\.To and observe how we never wrap such code in this kind of if block.
gerrytan
left a comment
There was a problem hiding this comment.
Thanks @ZiChuanBuXiu this PR looks good to me.
Also thanks for running acctest against latest commit: https://hashicorp.teamcity.com/buildConfiguration/TF_AzureRM_AZURERM_SERVICE_PUBLIC_COGNITIVE/631922?buildTab=changes&expandRevisionsSection=true&showGraph=false
sreallymatt
left a comment
There was a problem hiding this comment.
Thanks @ZiChuanBuXiu - LGTM ✅
Community Note
Description
tagspropertynamepropertyRaiBlocklistNameas this will be reused forRaiBlocklistItemresource in futureRaiBlocklistNameis aligned with the backend API enforced rule. The API spec and Azure Portal will be updated by the service team to align with the backend rule.cognitive_account_rai_blocklist_item_resourceimplementation is in progress and will be in another PRPR Checklist
For example: “
resource_name_here- description of change e.g. adding propertynew_property_name_here”Changes to existing Resource / Data Source
Testing
Change Log
Below please provide what should go into the changelog (if anything) conforming to the Changelog Format documented here.
cognitive_account_rai_blocklist_resource- support for thetagsproperty [GH-00000]cognitive_account_rai_blocklist_resource- add validation for thenameproperty [GH-00000]This is a (please select all that apply):
Related Issue(s)
Fixes #0000
AI Assistance Disclosure
Rollback Plan
If a change needs to be reverted, we will publish an updated version of the provider.
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
Note
If this PR changes meaningfully during the course of review please update the title and description as required.