initialize backup vault module with configuration, outputs, and variable definitions
This commit is contained in:
34
main.tf
Normal file
34
main.tf
Normal file
@@ -0,0 +1,34 @@
|
||||
data "azurerm_client_config" "current" {}
|
||||
|
||||
locals {
|
||||
backup_vault_name = (
|
||||
var.name != null &&
|
||||
trimspace(var.name) != "" ?
|
||||
var.name :
|
||||
"${coalesce(var.base_name, "")}${substr(md5("${data.azurerm_client_config.current.subscription_id}/${var.rg_name}/${coalesce(var.base_name, "")}"), 0, 6)}"
|
||||
)
|
||||
}
|
||||
|
||||
resource "azurerm_data_protection_backup_vault" "this" {
|
||||
name = local.backup_vault_name
|
||||
resource_group_name = var.rg_name
|
||||
location = var.location
|
||||
datastore_type = var.datastore_type
|
||||
redundancy = var.redundancy
|
||||
|
||||
cross_region_restore_enabled = var.cross_region_restore_enabled
|
||||
retention_duration_in_days = var.retention_duration_in_days
|
||||
immutability = var.immutability
|
||||
soft_delete = var.soft_delete
|
||||
|
||||
dynamic "identity" {
|
||||
for_each = var.identity == null ? [] : [var.identity]
|
||||
|
||||
content {
|
||||
type = identity.value.type
|
||||
identity_ids = try(identity.value.identity_ids, null)
|
||||
}
|
||||
}
|
||||
|
||||
tags = var.tags
|
||||
}
|
||||
Reference in New Issue
Block a user