Skip to content

Commit

Permalink
feat: add lifecycle to ignore tag changes to reduce resource updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alismx committed Oct 23, 2023
1 parent 9275f36 commit 09a7bfc
Show file tree
Hide file tree
Showing 37 changed files with 175 additions and 28 deletions.
2 changes: 1 addition & 1 deletion ops/demo/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/demo/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev2/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev3/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev4/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev4/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev5/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev5/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev6/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev6/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev7/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/dev7/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
environment = local.env
# Resource groups can support multiple environments at the same level. Any resources that are shared between
# environments should use the "local.env_level" convention where possible.
resource_group = "${local.project}-${local.name}-${local.env_level}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/pentest/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/pentest/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/prod/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ locals {
management_tags = {
prime-app = "simple-report"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
2 changes: 1 addition & 1 deletion ops/prod/persistent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ locals {
management_tags = {
prime-app = "simplereport"
environment = local.env
resource_group = "${local.project}-${local.name}-${local.env}"
resource_group = data.azurerm_resource_group.dev.name
}
}

Expand Down
10 changes: 10 additions & 0 deletions ops/services/alerts/app_service_metrics/database.tf
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ ${local.skip_on_weekends}
action_group = var.action_group_ids
custom_webhook_payload = var.wiki_docs_text
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "db_connection_exhaustion" {
Expand Down Expand Up @@ -54,4 +59,9 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "db_connection_exhaustion
operator = "GreaterThan"
threshold = 5
}
lifecycle {
ignore_changes = [
tags
]
}
}
30 changes: 30 additions & 0 deletions ops/services/alerts/app_service_metrics/exceptions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ AppServiceConsoleLogs
operator = "GreaterThan"
threshold = 2
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "first_error_in_a_week" {
Expand Down Expand Up @@ -98,6 +103,11 @@ requests
operator = "GreaterThan"
threshold = 0
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "account_request_failures" {
Expand Down Expand Up @@ -134,6 +144,11 @@ ${local.skip_on_weekends}
operator = "GreaterThan"
threshold = 4
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "experian_auth_failures" {
Expand Down Expand Up @@ -170,6 +185,11 @@ ${local.skip_on_weekends}
operator = "GreaterThan"
threshold = 0
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "all_experian_auth_failures" {
Expand Down Expand Up @@ -206,6 +226,11 @@ ${local.skip_on_weekends}
operator = "GreaterThan"
threshold = 2
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "frontend_error_boundary" {
Expand Down Expand Up @@ -235,4 +260,9 @@ resource "azurerm_monitor_scheduled_query_rules_alert" "frontend_error_boundary"
operator = "GreaterThan"
threshold = 0
}
lifecycle {
ignore_changes = [
tags
]
}
}
10 changes: 10 additions & 0 deletions ops/services/alerts/app_service_metrics/function_triggers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ requests
action_group = var.action_group_ids
custom_webhook_payload = var.wiki_docs_text
}
lifecycle {
ignore_changes = [
tags
]
}
}

resource "azurerm_monitor_scheduled_query_rules_alert" "fhir_batched_uploader_function_not_triggering" {
Expand Down Expand Up @@ -90,5 +95,10 @@ requests
action_group = var.action_group_ids
custom_webhook_payload = var.wiki_docs_text
}
lifecycle {
ignore_changes = [
tags
]
}
}

Loading

0 comments on commit 09a7bfc

Please sign in to comment.