Open RodrigoGodoyDE opened 2 months ago
Thanks for raising this issue. Suggest use latest terraform azurerm provider for new features.
I have the same issue. In the azurerm provider documentation it states that is required to use the property «duration» in the block «retention_rule» but it doesn't work. A message like this appears:
Error:
│ Error: Unsupported argument
│
│ on main.tf line 29, in resource "azurerm_data_protection_backup_policy_blob_storage" "bkpol_blobs_01":
│ 29: duration = "P4W" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
│
│ An argument named "duration" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│ on main.tf line 44, in resource "azurerm_data_protection_backup_policy_blob_storage" "bkpol_blobs_01":
│ 44: duration = "P6M" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
│
│ An argument named "duration" is not expected here.
╵
╷
│ Error: Unsupported argument
│
│ on main.tf line 59, in resource "azurerm_data_protection_backup_policy_blob_storage" "bkpol_blobs_01":
│ 59: duration = "P1Y" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
│
│ An argument named "duration" is not expected here.
Code that causes the error:
resource "azurerm_data_protection_backup_policy_blob_storage" "bkpol_blobs_01" {
name = "bkpol-blobs-vaulted"
vault_id = azurerm_data_protection_backup_vault.bvault_01.id
time_zone = "Romance Standard Time"
vault_default_retention_duration = "P30D"
backup_repeating_time_intervals = ["R/2024-06-01T23:00:00Z/P1D"]
retention_rule {
name = "Weekly"
duration = "P4W" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 20
criteria {
absolute_criteria = "FirstOfWeek"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P4W"
}
}
retention_rule {
name = "Monthly"
duration = "P6M" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 15
criteria {
absolute_criteria = "FirstOfMonth"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P6M"
}
}
retention_rule {
name = "Yearly"
duration = "P1Y" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 10
criteria {
absolute_criteria = "FirstOfYear"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P1Y"
}
}
}
It is necessary to include the duration parameter only in the life_cycle block like this:
Code that works correctly:
resource "azurerm_data_protection_backup_policy_blob_storage" "bkpol_blobs_01" {
name = "bkpol-blobs-vaulted"
vault_id = azurerm_data_protection_backup_vault.bvault_01.id
time_zone = "Romance Standard Time"
vault_default_retention_duration = "P30D"
backup_repeating_time_intervals = ["R/2024-06-01T23:00:00Z/P1D"]
retention_rule {
name = "Weekly"
# duration = "P4W" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 20
criteria {
absolute_criteria = "FirstOfWeek"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P4W"
}
}
retention_rule {
name = "Monthly"
# duration = "P6M" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 15
criteria {
absolute_criteria = "FirstOfMonth"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P6M"
}
}
retention_rule {
name = "Yearly"
# duration = "P1Y" # NOTE: Provider documentation issue in https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/data_protection_backup_policy_blob_storage
priority = 10
criteria {
absolute_criteria = "FirstOfYear"
}
life_cycle {
data_store_type = "VaultStore"
duration = "P1Y"
}
}
}
Is there an existing issue for this?
Community Note
Terraform Version
1.5.7
AzureRM Provider Version
3.106.1
Affected Resource(s)/Data Source(s)
azurerm_data_protection_backup_policy_blob_storage
Terraform Configuration Files
It seems the most of the arguments are not configurable for
azurerm_data_protection_backup_policy_blob_storage
.After running terraform validate, plan or apply the most of the arguments appear as " ... is not expected here."
I have this variable definition, using all the arguments described on terraform registry:
Terraform registry specify the following info:
At least one of
operational_default_retention_duration
,retention_duration
orvault_default_retention_duration
must be specified.However the following arguments are not expected by terraform when you run terraform commands:
operational_default_retention_duration
(same specified above)vault_default_retention_duration
(same specified above)backup_repeating_time_intervals
time_zone
retention_rule
and we'll get the
Error: Unsupported argument
messages at the main.tf:It seems somehow all of them are not configurable, and can not be used as it is at: https://github.com/hashicorp/terraform-provider-azurerm/blob/main/internal/services/dataprotection/data_protection_backup_policy_blob_storage_resource_test.go
i.e.:
Debug Output/Panic Output
Expected Behaviour
All the arguments on terraform registry should be configurable. Even using it as simple as following we'll get the same Issue:
I had to add
retention_duration
because in fact is a Required instead an Optional Argument.Actual Behaviour
Only the following arguments are valid to use this resource:
name
retention_duration
vault_id
Steps to Reproduce
No response
Important Factoids
No response
References
No response