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

Update azurerm_container_app_environment resource to enable configuration of daprAIInstrumentationKey property #20404

Closed
1 task done
faheemgani opened this issue Feb 10, 2023 · 2 comments · Fixed by #23080

Comments

@faheemgani
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

I noticed that the wait is now over and we have support for deploying Container Apps and Container App environments through Terraform. 🎉 Thanks for all the hard work that went into making that happen.

When I was looking at the azurerm_container_app_environment resource, I noticed the following property was missing - daprAIInstrumentationKey

If using ARM or the az CLI this property can be set when deploying the container app environment:

https://learn.microsoft.com/en-us/azure/container-apps/azure-resource-manager-api-spec?tabs=arm-template

I believe it allows Dapr to log its metrics against an Application Insights instance.

Just wanted to check if there was a plan to add this in the future or if this needs to be set elsewhere.

New or Affected Resource(s)/Data Source(s)

azurerm_container_app_environment

Potential Terraform Configuration

resource "azurerm_application_insights" "example" {
  name                = "tf-test-appinsights"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  application_type    = "web"
}

resource "azurerm_container_app_environment" "example" {
  name                        = "my-environment"
  location                    = azurerm_resource_group.example.location
  resource_group_name         = azurerm_resource_group.example.name
  log_analytics_workspace_id  = azurerm_log_analytics_workspace.example.id
  dapr_ai_instrumentation_key = azurerm_application_insights.example.instrumentation_key
}


### References

https://learn.microsoft.com/en-us/azure/container-apps/azure-resource-manager-api-spec?tabs=arm-template

https://learn.microsoft.com/en-us/cli/azure/containerapp/env?view=azure-cli-latest#az-containerapp-env-create
@crookm
Copy link

crookm commented Apr 1, 2023

The usefulness of this feature is not as high as instrumenting application insights within the application. Dapr does kinda hide cross-service calls because of its proxy, but app insights does still join telemetry together across buckets and apps, so you still get full distributed tracing (I guess only for service invocations though).

I still think this feature should be added, because without it the application map is useless (only showing one localhost server, the proxy). My guess is that it would help with tracing pubsub etc as well, but I'm not sure as my app doesn't use it.

As a temporary solution until this can be added to the provider, I managed to set this value with the AzAPI provider (I used the connection string value instead of the instrumentation key).

resource "azapi_update_resource" "ai_dapr" {
  type        = "Microsoft.App/managedEnvironments@2022-10-01"
  resource_id = azurerm_container_app_environment.env.id

  body = jsonencode({
    properties = {
      daprAIConnectionString = azurerm_application_insights.ai.connection_string
    }
  })
}

There's some details here about the structure of the body for this resource, if you want to change other things as well.

The daprAIConnectionString property doesn't seem to like being updated, I found. If you change app insights buckets, it won't direct logging to the new bucket.

Copy link

github-actions bot commented May 8, 2024

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 have found a problem that seems similar to this, 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 May 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants