-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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_log_analytics_data_export_rule
- support for the destination_metadata
property
#17019
Conversation
@neil-yechenwei LGTM 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neil-yechenwei LGTM as well, just one minor comment about the documentation. 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@neil-yechenwei Thanks for pushing that change, LGTM! 🚀
|
||
The `metadata` block supports the following attributes: | ||
|
||
* `eventhub_name` - (Optional) The name of the EventHub that is defined for the Log Analytics Data Export Rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as above, what is this actually doing? if this is setting anything? just a place to put the destination event hub name? should it just be
* `eventhub_name` - (Optional) The name of the EventHub that is defined for the Log Analytics Data Export Rule. | |
* `destination_eventhub_name` - (Optional) The name of the EventHub that Log Analytics Data Export Rule exports too. |
also given we are giving the id above? what is the point of this? could we not just grab it from the ID and set it ourselves so the user doesn't have to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It means "Select an Event Hub name to send data from all tables in the rule to a specific Event Hub. If nothing is selected, an Event Hub is created for each table in the selected namespace".
When this is setting anything, it would fail.
I think it's better to update metadata
to destination_metadata
and keep eventhub_name
since maybe service team would introduce other destinations.
As this azure doc indicates "Select an Event Hub name to send data from all tables in the rule to a specific Event Hub. If nothing is selected, an Event Hub is created for each table in the selected namespace.", so I think supporting this property is meaningful.
As setting it or not setting it represents different meaning, so I think it should be set by user. And destination_resource_id
should be set with eventhub namespace resource id or storage account id not eventhub resource id. Below data export rule is created on Azure Portal and the destination resource id is set with eventhub namespace resource id.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well i think that's pretty self explanatory, we should match what the portal is doing. and really. going by these images, maybe have two resources 1 for storage account, 1 for eventhubs - there no metadata in those pages, and the property names are much easier to decipher when correctly named vs being overloaded in the api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Azure portal also allows to set or not set event hub name under destination metadata. So I assume my PR is aligned with Azure Portal. If I am wrong, please correct me.
Currently the destination metadata only supports event hub name.
I already updated the property name and the name description. Seems you're still referencing old commit. Could you refresh your PR to get my latest update?Thanks.
And suggest go thourgh this azure doc (https://docs.microsoft.com/en-us/azure/azure-monitor/logs/logs-data-export?tabs=portal#create-or-update-data-export-rule) and play this log analytics data export rule resource on Azure Portal first.
Or could you provide the suggested code/commit for them? Thanks in advance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What i'm thinking is we model the two twps you can select in the portal:
resource "azurerm_log_analytics_data_export_rule_storage_account" "test" {
name = "acctest-DER-%d"
resource_group_name = azurerm_resource_group.test.name
workspace_resource_id = azurerm_log_analytics_workspace.test.id
table_names = ["Heartbeat"]
destination_storage_account_id =
}
resource "azurerm_log_analytics_data_export_rule_evenhub" "test" {
name = "acctest-DER-%d"
resource_group_name = azurerm_resource_group.test.name
workspace_resource_id = azurerm_log_analytics_workspace.test.id
table_names = ["Heartbeat"]
destination_evenhub_id = azurerm_eventhub.test.id
}
or even
resource "azurerm_log_analytics_data_export_rule" "test" {
name = "acctest-DER-%d"
resource_group_name = azurerm_resource_group.test.name
workspace_resource_id = azurerm_log_analytics_workspace.test.id
table_names = ["Heartbeat"]
destination_evenhub_id = azurerm_eventhub.test.id
destination_storage_account_id =
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@katbyte , sorry, seems I cannot get your point.
This PR is to support new property destination_metadata
not destination_resource_id
. May I ask why we have to split the existing property destination_resource_id
in this PR because I think they're different things? Does it make sense to implement it in another PR if we intend to split it?
As destination_resource_id
already supports Storage Account and EventHub, is there any impact if we don't split destination_resource_id
while introducing destination_metadata
in this PR?
Do you agree with the part of destination_metadata
in this PR?
@katbyte , thanks for your comments. I've updated code and shared my understanding. Please take another look. Thanks in advance. |
} | ||
|
||
var eventHubName string | ||
if input.DestinationMetaData.EventHubName != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is destination metadata? is this metadata added to the destination OR is it the final destination for the data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It's destination metadata. The whole block means the data from all tables in the rule are sent to a specific Event Hub when an Event Hub name is selected. See more details from https://docs.microsoft.com/en-us/azure/azure-monitor/logs/logs-data-export?tabs=portal#create-or-update-data-export-rule.
|
||
The `metadata` block supports the following attributes: | ||
|
||
* `eventhub_name` - (Optional) The name of the EventHub that is defined for the Log Analytics Data Export Rule. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well i think that's pretty self explanatory, we should match what the portal is doing. and really. going by these images, maybe have two resources 1 for storage account, 1 for eventhubs - there no metadata in those pages, and the property names are much easier to decipher when correctly named vs being overloaded in the api
@katbyte , Azure portal also allows to set or not set event hub name under destination metadata. So I assume my PR is aligned with Azure Portal. If I am wrong, please correct me. Currently the destination metadata only supports event hub name. Maybe it would support more metdatas when service team introduces other new destination type in the future. I already updated the property name and the name description. Seems you're still referencing old commit. Could you refresh the PR to get my latest update?Thanks. And suggest go thourgh this azure doc (https://docs.microsoft.com/en-us/azure/azure-monitor/logs/logs-data-export?tabs=portal#create-or-update-data-export-rule) and play this log analytics data export rule resource on Azure Portal to better understand the background. Or if it's possible, could you provide the suggested code/commit for them? Thanks in advance. |
azurerm_log_analytics_data_export_rule
- support for the destination_metadata
property
As the |
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. |
This PR is to support new property
destination_metadata
.Note: I think service team would expand the sub properties of
destination_metadata
in the future so that I make it as block.--- PASS: TestAccLogAnalyticsDataExportRule_basic (295.37s)
--- PASS: TestAccLogAnalyticsDataExportRule_complete (303.93s)
--- PASS: TestAccLogAnalyticsDataExportRule_requiresImport (334.64s)
--- PASS: TestAccLogAnalyticsDataExportRule_destinationMetadata (405.26s)
--- PASS: TestAccLogAnalyticsDataExportRule_update (435.80s)