» azurerm_application_insights_api_key

Manages an Application Insights API key.

» Example Usage

resource "azurerm_resource_group" "test" {
  name     = "tf-test"
  location = "West Europe"
}

resource "azurerm_application_insights" "test" {
  name                = "tf-test-appinsights"
  location            = "West Europe"
  resource_group_name = "${azurerm_resource_group.test.name}"
  application_type    = "Web"
}

resource "azurerm_application_insights_api_key" "read_telemetry" {
  name                    = "tf-test-appinsights-read-telemetry-api-key"
  application_insights_id = "${azurerm_application_insights.test.id}"
  read_permissions        = ["aggregate", "api", "draft", "extendqueries", "search"]
}

resource "azurerm_application_insights_api_key" "write_annotations" {
  name                    = "tf-test-appinsights-write-annotations-api-key"
  application_insights_id = "${azurerm_application_insights.test.id}"
  write_permissions       = ["annotations"]
}

resource "azurerm_application_insights_api_key" "authenticate_sdk_control_channel" {
  name                    = "tf-test-appinsights-authenticate-sdk-control-channel-api-key"
  application_insights_id = "${azurerm_application_insights.test.id}"
  read_permissions        = ["agentconfig"]
}

resource "azurerm_application_insights_api_key" "full_permissions" {
  name                    = "tf-test-appinsights-full-permissions-api-key"
  application_insights_id = "${azurerm_application_insights.test.id}"
  read_permissions        = ["agentconfig", "aggregate", "api", "draft", "extendqueries", "search"]
  write_permissions       = ["annotations"]
}

output "read_telemetry_api_key" {
  value = "${azurerm_application_insights_api_key.read_telemetry.api_key}"
}

output "write_annotations_api_key" {
  value = "${azurerm_application_insights_api_key.write_annotations.api_key}"
}

output "authenticate_sdk_control_channel" {
  value = "${azurerm_application_insights_api_key.authenticate_sdk_control_channel.api_key}"
}

output "full_permissions_api_key" {
  value = "${azurerm_application_insights_api_key.full_permissions.api_key}"
}

» Argument Reference

The following arguments are supported:

  • name - (Required) Specifies the name of the Application Insights API key. Changing this forces a new resource to be created.

  • application_insights_id - (Required) The ID of the Application Insights component on which the API key operates. Changing this forces a new resource to be created.

  • read_permissions - (Optional) Specifies the list of read permissions granted to the API key. Valid values are agentconfig, aggregate, api, draft, extendqueries, search. Please note these values are case sensitive. Changing this forces a new resource to be created.

  • write_permissions - (Optional) Specifies the list of write permissions granted to the API key. Valid values are annotations. Please note these values are case sensitive. Changing this forces a new resource to be created.

» Attributes Reference

The following attributes are exported:

  • id - The ID of the Application Insights API key.

  • api_key - The API Key secret (Sensitive).

» Import

Application Insights API keys can be imported using the resource id, e.g.

terraform import azurerm_application_insights_api_key.my_key/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/microsoft.insights/components/instance1/apikeys/00000000-0000-0000-0000-000000000000