The errors in the image show that the resource types azurerm_backup_policy_blob_storage
and azurerm_backup_vault
are invalid. These resource types are either deprecated, unsupported, or incorrectly named in your Terraform configuration.
Here’s how you can resolve these issues:
. Invalid Resource Type: azurerm_backup_policy_blob_storage
- Error: The provider does not support the resource type
azurerm_backup_policy_blob_storage
. - Cause: The resource type might be outdated or incorrectly named. AzureRM does not currently have a resource named
azurerm_backup_policy_blob_storage
. - Solution: Use the appropriate resources for configuring backup policies for blob storage. For Azure Blob Storage backup, consider using lifecycle management policies or Recovery Services Vault with custom configurations.
Example Configuration for Blob Storage Backup:
resource "azurerm_storage_account" "example" {
name = "examplestorage"
resource_group_name = azurerm_resource_group.example.name
location = azurerm_resource_group.example.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_backup_policy_vm" "example" {
name = "example-backup-policy"
resource_group_name = azurerm_resource_group.example.name
recovery_vault_name = azurerm_recovery_services_vault.example.name
backup {
frequency = "Daily"
time = "23:00"
}
}
Verify your requirements and configure storage accounts and Recovery Services Vaults accordingly.
2. Invalid Resource Type: azurerm_backup_vault
- Error: The provider does not support the resource type
azurerm_backup_vault
. - Cause: The
azurerm_backup_vault
resource type has been deprecated. The correct resource to use isazurerm_recovery_services_vault
. - Solution: Replace
azurerm_backup_vault
withazurerm_recovery_services_vault
in your configuration.
Example Configuration for a Recovery Services Vault:
resource "azurerm_recovery_services_vault" "vm_west_backup_vault" {
name = "example-vault"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "Standard"
}
Update the references in your configuration to point to azurerm_recovery_services_vault
.
General Steps to Fix the Configuration
- Update the AzureRM Provider: Ensure you’re using the latest version of the AzureRM provider in your Terraform configuration:
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 3.0"
}
}
}
- Replace Deprecated Resource Types:
- Replace
azurerm_backup_vault
withazurerm_recovery_services_vault
. - Replace
azurerm_backup_policy_blob_storage
with an appropriate alternative.
- Replace
- Run
terraform validate
: Validate your configuration to ensure that no further issues are present:terraform validate
- Consult Documentation: Refer to the AzureRM Provider Documentation to ensure correct syntax
Post Views: 7