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

New Resource - azurerm_monitor_aad_diagnostic_setting #11660

Merged
merged 6 commits into from
May 13, 2021

Conversation

magodo
Copy link
Collaborator

@magodo magodo commented May 11, 2021

This PR implements a new resource: azurerm_monitor_aad_diagnostic_setting.

This is the same as the azurerm_monitor_diagnostic_setting in most parts, except it is using a different API endpoint: /providers/microsoft.aadiam/diagnosticSettings/{name}. I've verified this endpoint is not a wrapper API (at least from the API level) for the monitor one - /providers/microsoft.aadiam/diagnosticSettings/providers/microsoft.insights/diagnosticSettings/{name}, hence decided to create this separate resource.

Another point worth mentioning is that the data source to query the available log categories for AAD (which is analogous to the azuerm_monitor_diagnostic_catagories) is currently blocked due to Azure/azure-rest-api-specs#14355.

Fixes: #11565

Test

The test below was running via the user account in my local. This is because the SP seems has no permission to read the AAD's diagnostic setting. Please let me know whether it makes sense to skip the acctest for now until there is a way to run these tests via the SP.

💤 TF_ACC=1 go test -v -timeout=2h ./azurerm/internal/services/monitor -run="TestAccMonitorAADDiagnosticSetting_"
2021/05/11 21:08:13 [DEBUG] not using binary driver name, it's no longer needed
2021/05/11 21:08:14 [DEBUG] not using binary driver name, it's no longer needed
=== RUN   TestAccMonitorAADDiagnosticSetting_eventhubDefault
=== PAUSE TestAccMonitorAADDiagnosticSetting_eventhubDefault
=== RUN   TestAccMonitorAADDiagnosticSetting_eventhub
=== PAUSE TestAccMonitorAADDiagnosticSetting_eventhub
=== RUN   TestAccMonitorAADDiagnosticSetting_requiresImport
=== PAUSE TestAccMonitorAADDiagnosticSetting_requiresImport
=== RUN   TestAccMonitorAADDiagnosticSetting_logAnalyticsWorkspace
=== PAUSE TestAccMonitorAADDiagnosticSetting_logAnalyticsWorkspace
=== RUN   TestAccMonitorAADDiagnosticSetting_storageAccount
=== PAUSE TestAccMonitorAADDiagnosticSetting_storageAccount
=== CONT  TestAccMonitorAADDiagnosticSetting_eventhubDefault
=== CONT  TestAccMonitorAADDiagnosticSetting_logAnalyticsWorkspace
=== CONT  TestAccMonitorAADDiagnosticSetting_requiresImport
=== CONT  TestAccMonitorAADDiagnosticSetting_storageAccount
=== CONT  TestAccMonitorAADDiagnosticSetting_eventhub
--- PASS: TestAccMonitorAADDiagnosticSetting_storageAccount (366.39s)
--- PASS: TestAccMonitorAADDiagnosticSetting_logAnalyticsWorkspace (367.52s)
--- PASS: TestAccMonitorAADDiagnosticSetting_eventhub (455.61s)
--- PASS: TestAccMonitorAADDiagnosticSetting_requiresImport (482.31s)
--- PASS: TestAccMonitorAADDiagnosticSetting_eventhubDefault (484.99s)
PASS
ok      github.com/terraform-providers/terraform-provider-azurerm/azurerm/internal/services/monitor     485.162s

Copy link
Member

@manicminer manicminer left a comment

Choose a reason for hiding this comment

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

Hi @magodo, thanks for this PR! I've taken a look through and tried it out, it mostly LGTM and the tests are passing.

I noticed one filename azurerm/internal/services/monitor/parse/monitor_aad_diagnositc_setting_test.go has a typo in it. Are you able to generate ID parsers/formatters for this resource?

I've also left a few suggestions inline, if you can take a look at those then this should be good to merge. Thanks!

@magodo
Copy link
Collaborator Author

magodo commented May 13, 2021

@manicminer Thank you for the review! I've updated most of the comments, but leave some for open discussion. Please take another look.

Copy link
Member

@manicminer manicminer left a comment

Choose a reason for hiding this comment

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

Thanks @magodo! This LGTM and tests still passing

Screenshot 2021-05-13 at 10 26 59

@manicminer manicminer merged commit e29b417 into hashicorp:master May 13, 2021
@manicminer manicminer added this to the v2.59.0 milestone May 13, 2021
manicminer added a commit that referenced this pull request May 13, 2021
@ghost
Copy link

ghost commented May 14, 2021

This has been released in version 2.59.0 of the provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. As an example:

provider "azurerm" {
    version = "~> 2.59.0"
}
# ... other configuration ...

favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
)

* to be test

* fix

* remove the categories data source

* document

* fmt

* modify per review
favoretti pushed a commit to gro1m/terraform-provider-azurerm that referenced this pull request May 26, 2021
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, 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 Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for 'AzureActiveDirectoryDiagnostics' kind in azurerm_sentinel_data_connector_*
2 participants