Skip to content

Commit

Permalink
Add saved search module (feat)
Browse files Browse the repository at this point in the history
  • Loading branch information
lukiffer committed Dec 31, 2020
1 parent b10ac06 commit d0cf3d8
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ repos:
rev: 1.0.0
hooks:
- id: terraform-validate
args: [--azurerm-provider-version=2.34.0]
21 changes: 21 additions & 0 deletions modules/log-analytics-saved-search/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ---------------------------------------------------------------------------------------------------------------------
# DEPLOY AN AZURE LOG ANALYTICS SAVED SEARCH
# ---------------------------------------------------------------------------------------------------------------------

terraform {
required_version = ">= 0.12.26"
}

resource "azurerm_log_analytics_saved_search" "search" {
name = var.name
display_name = coalesce(var.display_name, var.name)
category = var.category
log_analytics_workspace_id = var.log_analytics_workspace_id

query = var.query

function_alias = var.function_alias
function_parameters = var.function_parameters

tags = var.tags
}
4 changes: 4 additions & 0 deletions modules/log-analytics-saved-search/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output "id" {
description = "The unique identifier of the saved search."
value = azurerm_log_analytics_saved_search.search.id
}
43 changes: 43 additions & 0 deletions modules/log-analytics-saved-search/vars.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
variable "name" {
description = "The name of the saved search."
type = string
}

variable "display_name" {
description = "The friendly display name of the saved search."
type = string
default = null
}

variable "category" {
description = "The category under which the saved search will be displayed."
type = string
}

variable "log_analytics_workspace_id" {
description = "The ID of the Log Analytics workspace with which the saved search will be associated."
type = string
}

variable "query" {
description = "The KQL query for the saved search."
type = string
}

variable "function_alias" {
description = "The function alias if the query serves as a function."
type = string
default = null
}

variable "function_parameters" {
description = "A list of parameter definitions (strings) in the following format: `param_name:type=default_value`."
type = set(string)
default = null
}

variable "tags" {
description = "A mapping of tags to assign to the resource."
type = map(string)
default = {}
}
2 changes: 1 addition & 1 deletion modules/log-analytics-solution/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ---------------------------------------------------------------------------------------------------------------------

terraform {
required_version = ">= 0.12"
required_version = ">= 0.12.26"
}

resource "azurerm_log_analytics_solution" "solution" {
Expand Down

0 comments on commit d0cf3d8

Please sign in to comment.