Skip to content

cognitive_account_rai_blocklist_resource - support tags property and add validation for name property#31871

Merged
sreallymatt merged 6 commits intohashicorp:mainfrom
ZiChuanBuXiu:feature/cognitive_account_rai_blocklist_resource-update
Mar 20, 2026
Merged

cognitive_account_rai_blocklist_resource - support tags property and add validation for name property#31871
sreallymatt merged 6 commits intohashicorp:mainfrom
ZiChuanBuXiu:feature/cognitive_account_rai_blocklist_resource-update

Conversation

@ZiChuanBuXiu
Copy link
Copy Markdown
Contributor

@ZiChuanBuXiu ZiChuanBuXiu commented Mar 3, 2026

Community Note

  • Please vote on this PR by adding a 👍 reaction to the original PR to help the community and maintainers prioritize for review
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for PR followers and do not help prioritize for review

Description

  1. Support tags property
  2. Add validation rule for name property
  3. NOTE: created stand-along validation function RaiBlocklistName as this will be reused for RaiBlocklistItem resource in future
  4. NOTE: the validation regex for RaiBlocklistName is 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.
  5. NOTE: the resource cognitive_account_rai_blocklist_item_resource implementation is in progress and will be in another PR
  6. NOTE: the description change is due to Cognitive Account changed to AI Foundry in portal and this is for better user experience

PR Checklist

  • I have followed the guidelines in our Contributing Documentation.
  • I have checked to ensure there aren't other open Pull Requests for the same update/change.
  • I have checked if my changes close any open issues. If so please include appropriate closing keywords below.
  • I have updated/added Documentation as required written in a helpful and kind way to assist users that may be unfamiliar with the resource / data source.
  • I have used a meaningful PR title to help maintainers and other users understand this change and help prevent duplicate work.
    For example: “resource_name_here - description of change e.g. adding property new_property_name_here

Changes to existing Resource / Data Source

  • I have added an explanation of what my changes do and why I'd like you to include them (This may be covered by linking to an issue above, but may benefit from additional explanation).
  • I have written new tests for my resource or datasource changes & updated any relevant documentation.
  • I have successfully run tests with my changes locally. If not, please provide details on testing challenges that prevented you running the tests.
  • (For changes that include a state migration only). I have manually tested the migration path between relevant versions of the provider.

Testing

  • My submission includes Test coverage as described in the Contribution Guide and the tests pass. (if this is not possible for any reason, please include details of why you did or could not add test coverage)
image

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 the tags property [GH-00000]
  • cognitive_account_rai_blocklist_resource - add validation for the name property [GH-00000]

This is a (please select all that apply):

  • Bug Fix
  • New Feature (ie adding a service, resource, or data source)
  • Enhancement
  • Breaking Change

Related Issue(s)

Fixes #0000

AI Assistance Disclosure

  • AI Assisted - This contribution was made by, or with the assistance of, AI/LLMs

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.

…rule

1. Add `tags` field
2. Add validation rule for `name` for CognitiveRaiBlockLlist
@ZiChuanBuXiu ZiChuanBuXiu changed the title cognitive_account_rai_blocklist_resoure - add field and validation cognitive_account_rai_blocklist_resource - add tags field and create validation for name field Mar 3, 2026
@ZiChuanBuXiu ZiChuanBuXiu changed the title cognitive_account_rai_blocklist_resource - add tags field and create validation for name field cognitive_account_rai_blocklist_resource - add property tags and validate name property Mar 3, 2026
@ZiChuanBuXiu ZiChuanBuXiu changed the title cognitive_account_rai_blocklist_resource - add property tags and validate name property cognitive_account_rai_blocklist_resource - add property tags and validate property name Mar 3, 2026
@ZiChuanBuXiu ZiChuanBuXiu changed the title 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 Mar 3, 2026
@ZiChuanBuXiu ZiChuanBuXiu marked this pull request as ready for review March 4, 2026 00:04
@ZiChuanBuXiu ZiChuanBuXiu requested review from a team, WodansSon and magodo as code owners March 4, 2026 00:04
promisinganuj
promisinganuj previously approved these changes Mar 4, 2026
Copy link
Copy Markdown
Collaborator

@promisinganuj promisinganuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is fixed

Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @ZiChuanBuXiu , I left just 1 minor code style comment, otherwise this PR is good to go.

}
})
}
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 👍, thank you for adding unit tests


if model.Tags != nil {
payload.Tags = pointer.To(model.Tags)
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@ZiChuanBuXiu ZiChuanBuXiu requested a review from gerrytan March 18, 2026 08:02
Copy link
Copy Markdown
Collaborator

@gerrytan gerrytan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Collaborator

@promisinganuj promisinganuj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Copy Markdown
Collaborator

@sreallymatt sreallymatt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ZiChuanBuXiu - LGTM ✅

@sreallymatt sreallymatt merged commit eded436 into hashicorp:main Mar 20, 2026
37 checks passed
@github-actions github-actions bot added this to the v4.66.0 milestone Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants