Skip to content

Commit

Permalink
Fix : Updated Github Workflows and added Latest Azurerm Version
Browse files Browse the repository at this point in the history
  • Loading branch information
vedant990 committed Dec 9, 2024
1 parent a8e58e6 commit eba0310
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ resource "azurerm_monitor_diagnostic_setting" "nic_diagnostic" {


resource "azurerm_recovery_services_vault" "example" {
count = var.enabled && var.backup_enabled ? var.machine_count : 0
count = (var.vault_service == null && var.backup_enabled && var.enabled) ? 1 : (var.vault_service != null ? 1 : 0)
name = var.vm_addon_name == null ? format("%s-vm-service-vault-%s", module.labels.id, count.index + 1) : format("vm-%s-service-vault-%s", module.labels.id, var.vm_addon_name)
location = var.location
resource_group_name = var.resource_group_name
Expand All @@ -478,7 +478,7 @@ resource "azurerm_recovery_services_vault" "example" {
}

resource "azurerm_backup_policy_vm" "policy" {
count = var.enabled && var.backup_enabled ? var.machine_count : 0
count = (var.backup_policy == null && var.backup_enabled && var.enabled) ? 1 : (var.backup_policy != null ? 1 : 0)
name = var.vm_addon_name == null ? format("%s-policy-vm-%d", module.labels.id, count.index + 1) : format("%s-policy-vm-%d", module.labels.id, var.vm_addon_name)
resource_group_name = var.resource_group_name
recovery_vault_name = azurerm_recovery_services_vault.example[count.index].name
Expand Down
15 changes: 15 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,18 @@ output "extension_id" {
value = { for id in azurerm_virtual_machine_extension.vm_insight_monitor_agent : id.name => id.id }
description = "The ID of the Virtual Machine Extension."
}

output "service_vault_id" {
description = "The Principal ID associated with this Managed Service Identity."
value = azurerm_recovery_services_vault.example.principal_id
}

output "service_vault_tenant_id" {
description = "The Tenant ID associated with this Managed Service Identity."
value = azurerm_recovery_services_vault.example.tenant_id
}

output "vm_backup_policy_id" {
description = "The ID of the VM Backup Policy."
value = azurerm_backup_policy_vm.policy.id
}
13 changes: 13 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -699,3 +699,16 @@ variable "backup_policy_retention" {
}
}
}

variable "vault_service" {
default = null
type = string
description = "Value for Service Vault ID"
}

variable "backup_policy" {
default = null
type = string
description = "Value for Backup Policy ID"

}

0 comments on commit eba0310

Please sign in to comment.