hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.62k stars 4.66k forks source link

simple_retention days greater than 35 for policy_type "Differential" in azurerm_backup_policy_vm_workload returns error #27549

Open flynjets opened 2 months ago

flynjets commented 2 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9.5

AzureRM Provider Version

3.112.0

Affected Resource(s)/Data Source(s)

azurerm_backup_policy_vm_workload

Terraform Configuration Files

resource "azurerm_backup_policy_vm_workload" "this" {
  name                = "MSSQL-USERDB"
  resource_group_name = azurerm_recovery_services_vault.vault.resource_group_name
  recovery_vault_name = azurerm_recovery_services_vault.vault.name

  workload_type = "SQLDataBase"

  settings {
    time_zone           = "UTC"
    compression_enabled = true
  }

  protection_policy {
    policy_type = "Full"

    backup {
      frequency = "Weekly"
      weekdays  = ["Sunday"]
      time      = "04:00"
    }

    retention_weekly {
      weekdays = ["Sunday"]
      count    = 52
    }
  }

  protection_policy {
    policy_type = "Differential"

    backup {
      frequency = "Weekly"
      time      = "04:00"
      weekdays = [
        "Monday",
        "Tuesday",
        "Wednesday",
        "Thursday",
        "Friday",
        "Saturday"
      ]
    }

    simple_retention {
      count = 90
    }
  }

  protection_policy {
    policy_type = "Log"

    backup {
      frequency_in_minutes = 15
    }

    simple_retention {
      count = 30
    }
  }
}

Debug Output/Panic Output

Error: expected protection_policy.0.simple_retention.0.count to be in the range (7 - 35), got 90

Expected Behaviour

The resource is created with the policy set to the supported count value

Actual Behaviour

Terraform exits with error

Steps to Reproduce

No response

Important Factoids

No response

References

No response

Chambras commented 2 months ago

Thanks for submitting this @flynjets Do you happen to have a documentation link that mentions the supported count ranges?