Skip to content
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

properties not properly set in azurerm_sentinel_watchlist (missing itemsSearchKey, rawContent) #15851

Closed
bforte opened this issue Mar 16, 2022 · 2 comments · Fixed by #15861
Closed

Comments

@bforte
Copy link

bforte commented Mar 16, 2022

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

  • Terraform: v1.1.6
  • AzureRM Provider: v2.99.0

Affected Resource(s)

  • azurerm_sentinel_watchlist (ref)

Terraform Configuration Files

Any configuration will work to reproduce, for example:

resource "azurerm_sentinel_watchlist" "example" {
  name                       = "example-watchlist"
  log_analytics_workspace_id = azurerm_log_analytics_solution.example.workspace_resource_id
  display_name               = "example-wl"
}

Debug Output

Not really required as I know what the problem is (see below) - here is a short error log:

│ Error: creating Watchlist: (Name "MyWatchlist" / Workspace Name "my-workspace" / Resource Group "my-resource-group"): securityinsight.WatchlistsClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="400" Message="There is an issue with the payload : Required property 'itemsSearchKey' not found in JSON. Path 'properties', line 7, position 3."
│
│   with module.sentinel_watchlist["MyWatchlist"].azurerm_sentinel_watchlist.watchlist,
│   on ../../../terraform/watchlists/main.tf line 7, in resource "azurerm_sentinel_watchlist" "watchlist":
│    7: resource "azurerm_sentinel_watchlist" "watchlist" {
│
│ creating Watchlist: (Name "MyWatchlist" / Workspace Name
│ "my-workspace" / Resource Group "my-resource-group"):
│ securityinsight.WatchlistsClient#CreateOrUpdate: Failure responding to
│ request: StatusCode=400 -- Original Error: autorest/azure: Service returned
│ an error. Status=400 Code="400" Message="There is an issue with the payload
│ : Required property 'itemsSearchKey' not found in JSON. Path 'properties',
│ line 7, position 3."

Expected Behaviour

When creating a new watchlist, it should not result in an error.

Actual Behaviour

It errors.

Steps to Reproduce

Pick any valid tf config to deploy azurerm_sentinel_watchlist

  1. terraform apply
  2. error will be produced

Important Factoids

The problem is that the required property properties.itemsSearchKey (ref) are not being sent.

While not documented, to actually set such a search key, we also need to set rawContent otherwise we get:

{
  "error": {
    "code": "400",
    "message": "There is an issue with the payload: the payload rawContent is empty!"
  }
}

To fix this problem: The resource will need to add two new arguments items_search_key and raw_content.

References

bforte pushed a commit to bforte/terraform-provider-azurerm that referenced this issue Mar 16, 2022
@bforte bforte mentioned this issue Mar 16, 2022
katbyte pushed a commit that referenced this issue Apr 14, 2022
#15861)

Since March, the sentinel API now requires the itemSearchey in the PUT request. Meanwhile, the contentType is now not needed here as we don't actually send any content, but delegate it to the azurerm_sentinel_watchlist_item.

Fixes #15851.
Superseds: #15856.
@github-actions github-actions bot added this to the v3.2.0 milestone Apr 14, 2022
@github-actions
Copy link

This functionality has been released in v3.2.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!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants