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

azurerm_monitor_activity_log_alert - support for levels, resource_providers, resource_types, resource_groups, resource_ids, statuses,and sub_statuses properties #21367

Merged
merged 4 commits into from May 24, 2023

Conversation

teowa
Copy link
Contributor

@teowa teowa commented Apr 11, 2023

resolves #21186
resolves #20759
resolves #21496

TF_ACC=1 go test -v ./internal/services/monitor -parallel 20 -test.run=TestAccMonitorActivityLogAlert_listCriteria -timeout 1440m -ldflags="-X=github.com/hashicorp/terraform-provider-azurerm/version.ProviderVersion=acc"
=== RUN   TestAccMonitorActivityLogAlert_listCriteria
=== PAUSE TestAccMonitorActivityLogAlert_listCriteria
=== CONT  TestAccMonitorActivityLogAlert_listCriteria
--- PASS: TestAccMonitorActivityLogAlert_listCriteria (204.76s)
PASS
ok      github.com/hashicorp/terraform-provider-azurerm/internal/services/monitor       204.786s

@teowa teowa changed the title azurerm_monitor_activity_log_alert - support for levels and statuses azurerm_monitor_activity_log_alert - support for levels and statuses properties Apr 11, 2023
@teowa teowa changed the title azurerm_monitor_activity_log_alert - support for levels and statuses properties azurerm_monitor_activity_log_alert - support for levels, resource_providers, resource_types, resource_groups, resource_ids, statuses,and sub_statuses properties Apr 11, 2023
Comment on lines +116 to +119
"Verbose",
"Informational",
"Warning",
"Error",
"Critical",
Copy link
Collaborator

Choose a reason for hiding this comment

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

are there not constants for these in the SDK? if not could we open an issue on the rest specs to have them added?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The API only specifies the condition should be key-value pairs, and there is no enum for values.

And more details on property mappings:
level corresponds to:

{
      "field": "level",
      "equals": "Verbose"
},

levels corresponds to:

{
    "anyOf": [
        {
            "field": "level",
            "equals": "Verbose"
        },
        {
            "field": "level",
            "equals": "Informational"
        }
    ]
},

or

{
      "field": "level",
      "containsAny": ["Verbose", "Informational"]
},

since levels may map to 2 REST API schemas, here I am using the anyOf one in create/update, but accept either one in read.

Signed-off-by: Tao <104055472+teowa@users.noreply.github.com>
…roups sub_statuses

Signed-off-by: Tao <104055472+teowa@users.noreply.github.com>
Signed-off-by: Tao <104055472+teowa@users.noreply.github.com>
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

LGTM 🦀

@katbyte katbyte merged commit c77a2ef into hashicorp:main May 24, 2023
14 checks passed
@github-actions github-actions bot added this to the v3.58.0 milestone May 24, 2023
katbyte added a commit that referenced this pull request May 24, 2023
@github-actions
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment