main.tf (13 lines of code) (raw):

resource "azurerm_resource_group" "this" { count = var.resource_group_creation_enabled ? 1 : 0 location = var.location name = var.resource_group_name == null ? "rg-${var.postfix}" : var.resource_group_name tags = var.tags } resource "azurerm_management_lock" "this" { count = var.lock != null ? 1 : 0 lock_level = var.lock.kind name = coalesce(var.lock.name, "lock-${var.lock.kind}") scope = azurerm_resource_group.this[0].id notes = var.lock.kind == "CanNotDelete" ? "Cannot delete the resource or its child resources." : "Cannot delete or modify the resource or its child resources." }