github.com/darmach/terratest@v0.34.8-0.20210517103231-80931f95e3ff/examples/azure/terraform-azure-loganalytics-example/main.tf (about) 1 # --------------------------------------------------------------------------------------------------------------------- 2 # DEPLOY LOG ANALYTICS 3 # This is an example of how to deploy a Log Analytics workspace resource. 4 # --------------------------------------------------------------------------------------------------------------------- 5 # See test/azure/terraform_azure_loganalytics_example_test.go for how to write automated tests for this code. 6 # --------------------------------------------------------------------------------------------------------------------- 7 8 provider "azurerm" { 9 version = "~> 2.20" 10 features {} 11 } 12 13 # PIN TERRAFORM VERSION 14 15 terraform { 16 # This module is now only being tested with Terraform 0.13.x. However, to make upgrading easier, we are setting 17 # 0.12.26 as the minimum version, as that version added support for required_providers with source URLs, making it 18 # forwards compatible with 0.13.x code. 19 required_version = ">= 0.12.26" 20 } 21 22 # --------------------------------------------------------------------------------------------------------------------- 23 # DEPLOY A RESOURCE GROUP 24 # --------------------------------------------------------------------------------------------------------------------- 25 26 resource "azurerm_resource_group" "resource_group" { 27 name = "terratest-log-rg-${var.postfix}" 28 location = var.location 29 } 30 31 resource "azurerm_log_analytics_workspace" "log_analytics_workspace" { 32 name = "log-ws-${var.postfix}" 33 location = azurerm_resource_group.resource_group.location 34 resource_group_name = azurerm_resource_group.resource_group.name 35 sku = "PerGB2018" 36 retention_in_days = 30 37 }