Backup Vault module can deploy these resources:
- azurerm_data_protection_backup_vault (required)
- azurerm_data_protection_backup_policy_disk (optional)
- azurerm_monitor_diagnostic_setting (optional)
Example variables structure is located in variables.md.
Example use case is located in test-case/locals.tf.
You can also see changelog.
Terraform documentation:
WARNING: AzureRM provider had been updated to a new major version. Many breaking changes were implemented. See the providers guide for more information.
There are a few things you need to do to import resources into .tfstate. In the example below there are resources which can be imported within the module. You may need to modify these commands to the OS on which they will be running (Refer to the documentation for additional details).
- terraform import '
<path-to-module>
.azurerm_data_protection_backup_vault.data_protection_backup_vault["<backup-vault-name>
"]' '/subscriptions/<subscription-id>
/resourceGroups/<resource-group-name>
/providers/Microsoft.DataProtection/backupVaults/<backup-vault-name>
'
- terraform import '
<path-to-module>
.azurerm_data_protection_backup_policy_disk.data_protection_backup_policy_disk["<backup-vault-name_backup-policy-name>
"]' '/subscriptions/<subscription-id>
/resourceGroups/<resource-group-name>
/providers/Microsoft.DataProtection/backupVaults/<backup-vault-name>
/backupPolicies/<backup-policy-name>
'
- terraform import '
<path-to-module>
.azurerm_monitor_diagnostic_setting.diagnostic_setting["<backup-vault-name>
_<diag-name>
"]' '/subscriptions/<subscription-id>
/resourceGroups/<resource-group-name>
/providers/Microsoft.DataProtection/backupVaults/<backup-vault-name>
|<diag-name>
'
NOTE:
<path-to-module>
is terraform logical path from root. e.g. module.backup_vault
Output Name | Value | Comment |
---|---|---|
outputs | name | |
id | ||
principal_id | principal_id (object_id) of system assigned identity | |
disk_policy | Backup Policy Disk outputs | |
id |
In the example below, outputted id of the deployed Backup Vault module is used as a value for the scope variable in Role Assignment resource.
module "bv" {
source = "git@github.com:seyfor-csc/mit.backup-vault.git?ref=v1.0.0"
config = [
{
name = "SEY-TERRAFORM-NE-BV01"
location = "northeurope"
resource_group_name = "SEY-TERRAFORM-NE-RG01"
datastore_type = "VaultStore"
redundancy = "LocallyRedundant"
}
]
}
data "azurerm_client_config" "azurerm_client_config" {
}
resource "azurerm_role_assignment" "role_assignment" {
scope = module.bv.outputs.sey-terraform-ne-bv01.id # This is how to use output values
role_definition_name = "Contributor"
principal_id = data.azurerm_client_config.azurerm_client_config.object_id
}
No special features in module.
We currently log no issues in this module.