-
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
Add application insights data source #2625
Add application insights data source #2625
Conversation
This simple data source allows to return the ID and Instrumentation Key for a given App Insights bucket name.
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.
Hi @inkel,
Thank you for the new data source!
I've noticed you left out the rest of the properties: location
, application_type
, tags
and app_id
Could we add these in? other then that this PR is looking pretty good 🙂
@@ -143,6 +143,7 @@ func Provider() terraform.ResourceProvider { | |||
"azurerm_virtual_machine": dataSourceArmVirtualMachine(), | |||
"azurerm_virtual_network": dataSourceArmVirtualNetwork(), | |||
"azurerm_virtual_network_gateway": dataSourceArmVirtualNetworkGateway(), | |||
"azurerm_application_insights": dataSourceArmApplicationInsights(), |
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.
minor could we sort this alphabetically to match the rest of this list? it helps when skimming it
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.
Ah, good point. I did an alphabetical sort of this list and there actually many elements out of order:
diff --git a/azurerm/provider.go b/azurerm/provider.go
index 13b180ea..842c4630 100644
--- a/azurerm/provider.go
+++ b/azurerm/provider.go
@@ -89,27 +89,28 @@ func Provider() terraform.ResourceProvider {
},
DataSourcesMap: map[string]*schema.Resource{
- "azurerm_azuread_application": dataSourceArmAzureADApplication(),
- "azurerm_azuread_service_principal": dataSourceArmActiveDirectoryServicePrincipal(),
"azurerm_api_management": dataSourceApiManagementService(),
- "azurerm_application_security_group": dataSourceArmApplicationSecurityGroup(),
- "azurerm_app_service": dataSourceArmAppService(),
"azurerm_app_service_plan": dataSourceAppServicePlan(),
+ "azurerm_app_service": dataSourceArmAppService(),
+ "azurerm_application_insights": dataSourceArmApplicationInsights(),
+ "azurerm_application_security_group": dataSourceArmApplicationSecurityGroup(),
+ "azurerm_azuread_application": dataSourceArmAzureADApplication(),
+ "azurerm_azuread_service_principal": dataSourceArmActiveDirectoryServicePrincipal(),
"azurerm_batch_account": dataSourceArmBatchAccount(),
"azurerm_builtin_role_definition": dataSourceArmBuiltInRoleDefinition(),
"azurerm_cdn_profile": dataSourceArmCdnProfile(),
"azurerm_client_config": dataSourceArmClientConfig(),
- "azurerm_cosmosdb_account": dataSourceArmCosmosDBAccount(),
"azurerm_container_registry": dataSourceArmContainerRegistry(),
+ "azurerm_cosmosdb_account": dataSourceArmCosmosDBAccount(),
"azurerm_data_lake_store": dataSourceArmDataLakeStoreAccount(),
"azurerm_dev_test_lab": dataSourceArmDevTestLab(),
"azurerm_dns_zone": dataSourceArmDnsZone(),
"azurerm_eventhub_namespace": dataSourceEventHubNamespace(),
"azurerm_image": dataSourceArmImage(),
- "azurerm_key_vault": dataSourceArmKeyVault(),
- "azurerm_key_vault_key": dataSourceArmKeyVaultKey(),
"azurerm_key_vault_access_policy": dataSourceArmKeyVaultAccessPolicy(),
+ "azurerm_key_vault_key": dataSourceArmKeyVaultKey(),
"azurerm_key_vault_secret": dataSourceArmKeyVaultSecret(),
+ "azurerm_key_vault": dataSourceArmKeyVault(),
"azurerm_kubernetes_cluster": dataSourceArmKubernetesCluster(),
"azurerm_log_analytics_workspace": dataSourceLogAnalyticsWorkspace(),
"azurerm_logic_app_workflow": dataSourceArmLogicAppWorkflow(),
@@ -120,8 +121,8 @@ func Provider() terraform.ResourceProvider {
"azurerm_monitor_log_profile": dataSourceArmMonitorLogProfile(),
"azurerm_network_interface": dataSourceArmNetworkInterface(),
"azurerm_network_security_group": dataSourceArmNetworkSecurityGroup(),
- "azurerm_notification_hub": dataSourceNotificationHub(),
"azurerm_notification_hub_namespace": dataSourceNotificationHubNamespace(),
+ "azurerm_notification_hub": dataSourceNotificationHub(),
"azurerm_platform_image": dataSourceArmPlatformImage(),
"azurerm_public_ip": dataSourceArmPublicIP(),
"azurerm_public_ips": dataSourceArmPublicIPs(),
@@ -143,7 +144,6 @@ func Provider() terraform.ResourceProvider {
"azurerm_virtual_machine": dataSourceArmVirtualMachine(),
"azurerm_virtual_network": dataSourceArmVirtualNetwork(),
"azurerm_virtual_network_gateway": dataSourceArmVirtualNetworkGateway(),
- "azurerm_application_insights": dataSourceArmApplicationInsights(),
},
ResourcesMap: map[string]*schema.Resource{
Would you prefer leaving sorting all the lines for another PR and just place azurerm_application_insights
where it should be, or should I send the change for all the lines? Sorting all the lines is a bit out of scope of this PR, IMO.
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.
Another PR for this would be great 🙂
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.
Ok, I'll mark this one as resolved and then send a subsequent PR once this gets merged with the sorting. Sounds good?
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.
sounds good
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.
Done in #2638
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.
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.
No problem! <3
Hello @katbyte! Thanks for the review. I didn't include those fields because they didn't look as useful as the instrumentation key (in #2463 I was asked to only return the ID as it was the only useful property for the |
@katbyte as requested I've added the additional attributes in the data source's return object. Let me know what you think! |
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.
Thank you for adding those properties @inkel, i've left a couple comments inline that once addressed this PR should be good to merge 🙂
This also makes the syntax more consistent when using either strings or maps. Thanks @kt for the tip!
@katbyte changes applied! Thanks for your time reviewing this 😸 |
Thanks @inkel! LGTM now 🚀 |
Sweet, thanks!!! |
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
As proposed in #2623 this PR adds a new
azurerm_application_insights
data source that allows to get the instrumentation key of an existing Application Insights component.Usage