Reputation: 31
I have created azure application insights and output the instrumentation key.
FileName: tfapp.tf
resource "azurerm_application_insights" "core_application_insights" {
name = "${var.environment_name}-test-service-aai-${var.company_tag}"
resource_group_name = "${var.environment_name}-aai-${var.company_tag}"
location = "${var.location}"
application_type = "${var.aai_application_type}"
}
output "instrumentation_key" {
value = azurerm_application_insights.core_application_insights.instrumentation_key
}
Now, I am creating azurerm_api_management_logger and It is require to put the application_insights instrumentation_key value.
FileName: tfapi.tf
resource "azurerm_api_management_logger" "example" {
name = "example-logger"
api_management_name = azurerm_api_management.example.name
resource_group_name = azurerm_resource_group.example.name
resource_id = azurerm_application_insights.example.id
application_insights {
instrumentation_key = azurerm_application_insights.example.instrumentation_key
}
}
Just for the information. I am using terraform cloud.
How can I use instrumentation_key from the azurerm_application_insights output?
Upvotes: 0
Views: 220
Reputation: 11
Instead of: azurerm_application_insights.example.instrumentation_key
Use: azurerm_application_insights.core_application_insights.instrumentation_key
Upvotes: 1