From d0bff74e74a388638e692535d634ac9fec73f6ef Mon Sep 17 00:00:00 2001 From: Keertika Yogendra Date: Tue, 28 May 2024 13:59:33 +0200 Subject: [PATCH] add overide location azapi --- locals.tf | 1 + resources.management_groups.tf | 3 ++- variables.tf | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/locals.tf b/locals.tf index 371b30cb7..82c63f34b 100644 --- a/locals.tf +++ b/locals.tf @@ -39,6 +39,7 @@ locals { module.management_resources.configuration.template_file_variables, ) default_location = lower(var.default_location) + diag_settings_location = lower(var.diag_settings_location) default_tags = var.default_tags disable_base_module_tags = var.disable_base_module_tags disable_telemetry = var.disable_telemetry diff --git a/resources.management_groups.tf b/resources.management_groups.tf index 9ab17ff70..992a9b09b 100644 --- a/resources.management_groups.tf +++ b/resources.management_groups.tf @@ -77,11 +77,12 @@ resource "azurerm_management_group" "level_6" { } # This will deploy Diagnostic Settings for the Management Groups -# when the input variable deploy_diagnostics_for_mg is true +# when the input variable deploy_diagnostics_for_mg is true resource "azapi_resource" "diag_settings" { for_each = local.azapi_mg_diagnostics type = "Microsoft.Insights/diagnosticSettings@2021-05-01-preview" name = "toLA" + location = local.diag_settings_location parent_id = each.key body = jsonencode({ properties = { diff --git a/variables.tf b/variables.tf index 5b8fe85fb..4ca85d06a 100644 --- a/variables.tf +++ b/variables.tf @@ -626,6 +626,12 @@ variable "default_location" { description = "Must be specified, e.g `eastus`. Will set the Azure region in which region bound resources will be deployed. Please see: https://azure.microsoft.com/en-gb/global-infrastructure/geographies/" } +variable "diag_settings_location" { + type = string + description = "Will set the Azure region in which region azapi diagnostic settings will be deployed. Please see: https://azure.microsoft.com/en-gb/global-infrastructure/geographies/" + default = null +} + variable "default_tags" { type = map(string) description = "If specified, will set the default tags for all resources deployed by this module where supported."