Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid continuous destroy and create of azapi_resource diag_settings #952

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again please can we use default location?

default_tags = var.default_tags
disable_base_module_tags = var.disable_base_module_tags
disable_telemetry = var.disable_telemetry
Expand Down
3 changes: 2 additions & 1 deletion resources.management_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please can we use default location

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes you can use default_location

parent_id = each.key
body = jsonencode({
properties = {
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Comment on lines +629 to +634
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this and use default location please?

variable "default_tags" {
type = map(string)
description = "If specified, will set the default tags for all resources deployed by this module where supported."
Expand Down