0

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?

2
  • 2
    Have you tried your current code? What errors do you get? Commented Mar 16, 2021 at 11:04
  • Please provide the error message .. your question is not clear .. Commented Mar 16, 2021 at 18:14

1 Answer 1

1

Instead of: azurerm_application_insights.example.instrumentation_key

Use: azurerm_application_insights.core_application_insights.instrumentation_key

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.