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 db7512a commit a8e58e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions examples/linux-vm/example.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
provider "azurerm" {
features {}
subscription_id = "000000-11111-1223-XXX-XXXXXXXXXXXX"
subscription_id = "068245d4-3c94-42fe-9c4d-9e5e1cabc60c"
}
provider "azurerm" {
features {}
alias = "peer"
subscription_id = "000000-11111-1223-XXX-XXXXXXXXXXXX"
subscription_id = "068245d4-3c94-42fe-9c4d-9e5e1cabc60c"
}

data "azurerm_client_config" "current_client_config" {}
Expand Down
10 changes: 5 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ resource "azurerm_monitor_diagnostic_setting" "nic_diagnostic" {

resource "azurerm_recovery_services_vault" "example" {
count = var.enabled && var.backup_enabled ? var.machine_count : 0
name = format("%s-service-vault", module.labels.id)
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
sku = var.vault_sku
Expand All @@ -479,9 +479,9 @@ resource "azurerm_recovery_services_vault" "example" {

resource "azurerm_backup_policy_vm" "policy" {
count = var.enabled && var.backup_enabled ? var.machine_count : 0
name = format("%s-policy-vm", module.labels.id)
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[0].name
recovery_vault_name = azurerm_recovery_services_vault.example[count.index].name
policy_type = var.backup_policy_type != null ? var.backup_policy_type : "V2"

timezone = var.backup_policy_time_zone != null ? var.backup_policy_time_zone : "UTC"
Expand Down Expand Up @@ -520,7 +520,7 @@ resource "azurerm_backup_policy_vm" "policy" {
resource "azurerm_backup_protected_vm" "example" {
count = var.enabled && var.backup_enabled ? var.machine_count : 0
resource_group_name = var.resource_group_name
recovery_vault_name = azurerm_recovery_services_vault.example[0].name
backup_policy_id = azurerm_backup_policy_vm.policy[0].id
recovery_vault_name = azurerm_recovery_services_vault.example[count.index].name
backup_policy_id = azurerm_backup_policy_vm.policy[count.index].id
source_vm_id = var.is_vm_linux ? azurerm_linux_virtual_machine.default[count.index].id : azurerm_windows_virtual_machine.win_vm[count.index].id
}
5 changes: 3 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -642,9 +642,10 @@ variable "backup_policy_frequency" {
type = string

validation {
condition = contains(["Daily"], var.backup_policy_frequency)
error_message = "The value must be set to one of the following: Daily"
condition = contains(["Daily", "Weekly", "Hourly"], var.backup_policy_frequency)
error_message = "The value must be set to one of the following: Daily, Weekly, Hourly"
}

}

variable "backup_policy_type" {
Expand Down

0 comments on commit a8e58e6

Please sign in to comment.