Skip to content

azurermLogAnalyticsSolution

Manages a Log Analytics (formally Operational Insights) Solution.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as azurerm from "./.gen/providers/azurerm";
import * as random from "./.gen/providers/random";
/*The following providers are missing schema information and might need manual adjustments to synthesize correctly: azurerm, random.
For a more precise conversion please use the --provider flag in convert.*/
const azurermResourceGroupExample = new azurerm.resourceGroup.ResourceGroup(
  this,
  "example",
  {
    location: "West Europe",
    name: "k8s-log-analytics-test",
  }
);
const randomIdWorkspace = new random.id.Id(this, "workspace", {
  byte_length: 8,
  keepers: [
    {
      group_name: azurermResourceGroupExample.name,
    },
  ],
});
const azurermLogAnalyticsWorkspaceExample =
  new azurerm.logAnalyticsWorkspace.LogAnalyticsWorkspace(this, "example_2", {
    location: azurermResourceGroupExample.location,
    name: `k8s-workspace-\${${randomIdWorkspace.hex}}`,
    resource_group_name: azurermResourceGroupExample.name,
    sku: "PerGB2018",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsWorkspaceExample.overrideLogicalId("example");
const azurermLogAnalyticsSolutionExample =
  new azurerm.logAnalyticsSolution.LogAnalyticsSolution(this, "example_3", {
    location: azurermResourceGroupExample.location,
    plan: [
      {
        product: "OMSGallery/ContainerInsights",
        publisher: "Microsoft",
      },
    ],
    resource_group_name: azurermResourceGroupExample.name,
    solution_name: "ContainerInsights",
    workspace_name: azurermLogAnalyticsWorkspaceExample.name,
    workspace_resource_id: azurermLogAnalyticsWorkspaceExample.id,
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
azurermLogAnalyticsSolutionExample.overrideLogicalId("example");

Argument Reference

The following arguments are supported:

  • solutionName - (Required) Specifies the name of the solution to be deployed. See here for options.Changing this forces a new resource to be created.

  • resourceGroupName - (Required) The name of the resource group in which the Log Analytics solution is created. Changing this forces a new resource to be created. Note: The solution and its related workspace can only exist in the same resource group.

  • location - (Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

  • workspaceResourceId - (Required) The full resource ID of the Log Analytics workspace with which the solution will be linked. Changing this forces a new resource to be created.

  • workspaceName - (Required) The full name of the Log Analytics workspace with which the solution will be linked. Changing this forces a new resource to be created.

  • plan - (Required) A plan block as documented below.

  • tags - (Optional) A mapping of tags to assign to the resource.


A plan block includes:

  • publisher - (Required) The publisher of the solution. For example microsoft. Changing this forces a new resource to be created.

  • product - (Required) The product name of the solution. For example omsGallery/containers. Changing this forces a new resource to be created.

  • promotionCode - (Optional) A promotion code to be used with the solution. Changing this forces a new resource to be created.

Timeouts

The timeouts block allows you to specify timeouts for certain actions:

  • create - (Defaults to 30 minutes) Used when creating the Log Analytics Solution.
  • update - (Defaults to 30 minutes) Used when updating the Log Analytics Solution.
  • read - (Defaults to 5 minutes) Used when retrieving the Log Analytics Solution.
  • delete - (Defaults to 30 minutes) Used when deleting the Log Analytics Solution.

Import

Log Analytics Solutions can be imported using the resourceId, e.g.

terraform import azurerm_log_analytics_solution.solution1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationsManagement/solutions/solution1