Skip to content

Latest commit

 

History

History
201 lines (171 loc) · 17.3 KB

README.md

File metadata and controls

201 lines (171 loc) · 17.3 KB

Azure Backup

This sub-module includes:

Global versioning rule for Claranet Azure modules

Module version Terraform version OpenTofu version AzureRM version
>= 8.x.x Unverified 1.8.x >= 4.0
>= 7.x.x 1.3.x >= 3.0
>= 6.x.x 1.x >= 3.0
>= 5.x.x 0.15.x >= 2.0
>= 4.x.x 0.13.x / 0.14.x >= 2.0
>= 3.x.x 0.12.x >= 2.0
>= 2.x.x 0.12.x < 2.0
< 2.x.x 0.11.x < 2.0

Contributing

If you want to contribute to this repository, feel free to use our pre-commit git hook configuration which will help you automatically update and format some files for you by enforcing our Terraform code module best-practices.

More details are available in the CONTRIBUTING.md file.

Usage

This module is optimized to work with the Claranet terraform-wrapper tool which set some terraform variables in the environment needed by this module. More details about variables set by the terraform-wrapper available in the documentation.

⚠️ Since modules version v8.0.0, we do not maintain/check anymore the compatibility with Hashicorp Terraform. Instead, we recommend to use OpenTofu.

module "az_vm_backup" {
  source  = "claranet/run/azurerm//modules/backup"
  version = "x.x.x"

  location       = module.azure_region.location
  location_short = module.azure_region.location_short
  client_name    = var.client_name
  environment    = var.environment
  stack          = var.stack

  resource_group_name = module.rg.name

  backup_vm_enabled         = true
  backup_postgresql_enabled = true

  vm_backup_policy_time = "23:00"

  vm_backup_monthly_retention = {
    count    = 3
    weekdays = ["Sunday"]
    weeks    = ["First"]
  }

  logs_destinations_ids = [module.logs.id]

  extra_tags = {
    foo = "bar"
  }
}

Providers

Name Version
azurecaf ~> 1.2.28
azurerm ~> 4.0

Modules

Name Source Version
diagnostics claranet/diagnostic-settings/azurerm ~> 8.0.0

Resources

Name Type
azurerm_backup_policy_file_share.main resource
azurerm_backup_policy_vm.main resource
azurerm_data_protection_backup_policy_blob_storage.main resource
azurerm_data_protection_backup_policy_disk.main resource
azurerm_data_protection_backup_policy_postgresql.main resource
azurerm_data_protection_backup_vault.main resource
azurerm_recovery_services_vault.main resource
azurecaf_name.backup_vault data source
azurecaf_name.recovery_vault data source

Inputs

Name Description Type Default Required
backup_file_share_enabled Whether the File Share backup is enabled. bool true no
backup_managed_disk_enabled Whether the Managed Disk backup is enabled. bool true no
backup_postgresql_enabled Whether the PostgreSQL backup is enabled. bool true no
backup_storage_blob_enabled Whether the Storage blob backup is enabled. bool true no
backup_vault_custom_name Azure Backup Vault custom name. Empty by default, using naming convention. string "" no
backup_vault_datastore_type Type of data store used for the Backup Vault. string "VaultStore" no
backup_vault_extra_tags Extra tags to add to Backup Vault. map(string) {} no
backup_vault_geo_redundancy_enabled Whether the geo redundancy is enabled no the Backup Vault. bool true no
backup_vault_identity_type Azure Backup Vault identity type. Possible values include: null, SystemAssigned. Default to SystemAssigned. string "SystemAssigned" no
backup_vm_enabled Whether the Virtual Machines backup is enabled. bool true no
client_name Client name. string n/a yes
default_tags_enabled Option to enable or disable default tags. bool true no
diagnostic_settings_custom_name Custom name of the diagnostics settings, name will be default if not set. string "default" no
environment Environment name. string n/a yes
extra_tags Extra tags to add. map(string) {} no
file_share_backup_daily_policy_retention The number of daily file share backups to keep. Must be between 7 and 9999. number 30 no
file_share_backup_monthly_retention Map to configure the monthly File Share backup policy retention according to the provider's documentation.
object({
count = number,
weekdays = list(string),
weeks = list(string),
})
null no
file_share_backup_policy_custom_name Azure Backup - File share backup policy custom name. Empty by default, using naming convention. string "" no
file_share_backup_policy_frequency Specifies the frequency for file_share backup schedules. Must be either Daily or Weekly. string "Daily" no
file_share_backup_policy_time The time of day to perform the file share backup in 24hour format. string "04:00" no
file_share_backup_policy_timezone Specifies the timezone for file share backup schedules. Defaults to UTC. string "UTC" no
file_share_backup_weekly_retention Map to configure the weekly File Share backup policy retention according to the provider's documentation.
object({
count = number,
weekdays = list(string),
})
null no
file_share_backup_yearly_retention Map to configure the yearly File Share backup policy retention according to the provider's documentation
object({
count = number,
weekdays = list(string),
weeks = list(string),
months = list(string),
})
null no
location Azure location. string n/a yes
location_short Short string for Azure location. string n/a yes
logs_categories Log categories to send to destinations. list(string) null no
logs_destinations_ids List of destination resources IDs for logs diagnostic destination.
Can be Storage Account, Log Analytics Workspace and Event Hub. No more than one of each can be set.
If you want to use Azure EventHub as a destination, you must provide a formatted string containing both the EventHub Namespace authorization send ID and the EventHub name (name of the queue to use in the Namespace) separated by the | character.
list(string) n/a yes
logs_metrics_categories Metrics categories to send to destinations. list(string) null no
managed_disk_backup_daily_policy_retention_in_days The number of days to keep the first daily Managed Disk backup. number null no
managed_disk_backup_policy_custom_name Azure Backup - Managed disk backup policy custom name. Empty by default, using naming convention. string "" no
managed_disk_backup_policy_interval_in_hours The Managed Disk backup interval in hours. string 24 no
managed_disk_backup_policy_retention_in_days The number of days to keep the Managed Disk backup. number 30 no
managed_disk_backup_policy_time The time of day to perform the Managed Disk backup in 24 hours format (eg 04:00). string "04:00" no
managed_disk_backup_weekly_policy_retention_in_weeks The number of weeks to keep the first weekly Managed Disk backup. number null no
name_prefix Optional prefix for the generated name string "" no
name_suffix Optional suffix for the generated name string "" no
postgresql_backup_daily_policy_retention_in_days The number of days to keep the first daily Postgresql backup. number null no
postgresql_backup_monthly_policy_retention_in_months The number of months to keep the first monthly Postgresql backup. number null no
postgresql_backup_policy_custom_name Azure Backup - PostgreSQL backup policy custom name. Empty by default, using naming convention. string "" no
postgresql_backup_policy_interval_in_hours The Postgresql backup interval in hours. string 24 no
postgresql_backup_policy_retention_in_days The number of days to keep the Postgresql backup. number 30 no
postgresql_backup_policy_time The time of day to perform the Postgresql backup in 24 hours format (eg 04:00). string "04:00" no
postgresql_backup_weekly_policy_retention_in_weeks The number of weeks to keep the first weekly Postgresql backup. number null no
recovery_vault_cross_region_restore_enabled Is cross region restore enabled for this Vault? Can only be true, when storage_mode_type is GeoRedundant. bool true no
recovery_vault_custom_name Azure Recovery Vault custom name. Empty by default, using naming convention. string "" no
recovery_vault_extra_tags Extra tags to add to Recovery Vault. map(string) {} no
recovery_vault_identity_type Azure Recovery Vault identity type. Possible values include: null, SystemAssigned. Default to SystemAssigned. string "SystemAssigned" no
recovery_vault_sku Azure Recovery Vault SKU. Possible values include: Standard, RS0. Default to Standard. string "Standard" no
recovery_vault_soft_delete_enabled Is soft delete enable for this Vault? Defaults to true. bool true no
recovery_vault_storage_mode_type The storage type of the Recovery Services Vault. Possible values are GeoRedundant, LocallyRedundant and ZoneRedundant. Defaults to GeoRedundant. string "GeoRedundant" no
resource_group_name Resource group to which the resources will belong. string n/a yes
stack Stack name. string n/a yes
storage_blob_backup_policy_custom_name Azure Backup - Storage blob backup policy custom name. Empty by default, using naming convention. string "" no
storage_blob_backup_policy_retention_in_days The number of days to keep the Storage blob backup. number 30 no
vm_backup_daily_policy_retention The number of daily VM backups to keep. Must be between 7 and 9999. number 30 no
vm_backup_monthly_retention Map to configure the monthly VM backup policy retention according to the provider's documentation.
object({
count = number,
weekdays = list(string),
weeks = list(string),
})
null no
vm_backup_policy_custom_name Azure Backup - VM backup policy custom name. Empty by default, using naming convention. string "" no
vm_backup_policy_frequency Specifies the frequency for VM backup schedules. Must be either Daily or Weekly. string "Daily" no
vm_backup_policy_time The time of day to perform the VM backup in 24hour format. string "04:00" no
vm_backup_policy_timezone Specifies the timezone for VM backup schedules. Defaults to UTC. string "UTC" no
vm_backup_policy_type Type of the Backup Policy. Possible values are V1 and V2 where V2 stands for the Enhanced Policy. Defaults to V1. Changing this forces a new resource to be created. string "V1" no
vm_backup_weekly_retention Map to configure the weekly VM backup policy retention according to the provider's documentation.
object({
count = number,
weekdays = list(string),
})
null no
vm_backup_yearly_retention Map to configure the yearly VM backup policy retention according to the provider's documentation.
object({
count = number,
weekdays = list(string),
weeks = list(string),
months = list(string),
})
null no

Outputs

Name Description
backup_vault_id Azure Backup Vault ID.
backup_vault_identity Azure Backup Services Vault identity.
backup_vault_name Azure Backup Vault name.
file_share_backup_policy_id File share Backup policy ID.
file_share_backup_policy_name File share Backup policy name.
managed_disk_backup_policy_id Managed disk Backup policy ID.
postgresql_backup_policy_id PostgreSQL Backup policy ID.
recovery_vault_id Azure Recovery Services Vault ID.
recovery_vault_identity Azure Recovery Services Vault identity.
recovery_vault_name Azure Recovery Services Vault name.
resource_backup_vault Resource backup vault.
resource_file_share_backup_policy File share Backup policy resource.
resource_managed_disk_backup_policy Managed disk Backup policy resource.
resource_postgresql_backup_policy PostgreSQL Backup policy resource.
resource_recovery_vault Resource recovery vault.
resource_storage_blob_backup_policy Storage blob Backup policy resource.
resource_vm_backup_policy VM Backup policy resource.
storage_blob_backup_policy_id Storage blob Backup policy ID.
vm_backup_policy_id VM Backup policy ID.
vm_backup_policy_name VM Backup policy name.

Related documentation