Adds log_analytics module and workspace
This commit is contained in:
parent
45322c871d
commit
0900c01d88
15
terraform/modules/log_analytics/main.tf
Normal file
15
terraform/modules/log_analytics/main.tf
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
resource "azurerm_resource_group" "log_workspace" {
|
||||||
|
name = "${var.name}-${var.environment}-log-workspace"
|
||||||
|
location = var.region
|
||||||
|
}
|
||||||
|
|
||||||
|
resource "azurerm_log_analytics_workspace" "log_workspace" {
|
||||||
|
name = "${var.name}-${var.environment}-log-workspace"
|
||||||
|
location = azurerm_resource_group.log_workspace.location
|
||||||
|
resource_group_name = azurerm_resource_group.log_workspace.name
|
||||||
|
sku = "Premium"
|
||||||
|
tags = {
|
||||||
|
environment = var.environment
|
||||||
|
owner = var.owner
|
||||||
|
}
|
||||||
|
}
|
3
terraform/modules/log_analytics/outputs.tf
Normal file
3
terraform/modules/log_analytics/outputs.tf
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
output "workspace_id" {
|
||||||
|
value = azurerm_log_analytics_workspace.log_workspace.id
|
||||||
|
}
|
19
terraform/modules/log_analytics/variables.tf
Normal file
19
terraform/modules/log_analytics/variables.tf
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
variable "region" {
|
||||||
|
type = string
|
||||||
|
description = "Region this module and resources will be created in"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "name" {
|
||||||
|
type = string
|
||||||
|
description = "Unique name for the services in this module"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "environment" {
|
||||||
|
type = string
|
||||||
|
description = "Environment these resources reside (prod, dev, staging, etc)"
|
||||||
|
}
|
||||||
|
|
||||||
|
variable "owner" {
|
||||||
|
type = string
|
||||||
|
description = "Owner of the environment and resources created in this module"
|
||||||
|
}
|
8
terraform/providers/dev/logs.tf
Normal file
8
terraform/providers/dev/logs.tf
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module "logs" {
|
||||||
|
source = "../../modules/log_analytics"
|
||||||
|
owner = var.owner
|
||||||
|
environment = var.environment
|
||||||
|
region = var.region
|
||||||
|
name = var.name
|
||||||
|
}
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user