-
Notifications
You must be signed in to change notification settings - Fork 8
[FEAT] - Add feature to schedule snapshots of mgc_virtual_machine_instances (parity with console) #246
Description
Is your feature request related to a problem? Please describe.
Currently, the Magalu Cloud web console allows you to manually take snapshots at the instance (VM) level.
However, the Terraform provider doesn't have an equivalent feature. The only way to schedule snapshots via Terraform is using the mgc_block_storage_schedule_attach feature. The problem is that this feature operates at the individual volume level, requiring us to attach a schedule to each volume, one by one.
This creates two problems:
- Lack of Parity: The Terraform provider can't automate functionality that already exists in the web console.
Describe the solution you'd like
I'd like to request a new feature (perhaps mgc_block_storage_schedule_instance_attach) that allows attaching an mgc_virtual_machine_instances.my_vm.id.
This feature would instruct the platform to apply the snapshot schedule to that instance, mirroring the behavior of the web console.
Intended usage example:
resource "mgc_virtual_machine_instances" "my_vm" {
name = "critical-server"
machine_type = "BV4-8-100"
image = "cloud-ubuntu-24.04 LTS"
# ... other volumes can be attached here
}
resource "mgc_block_storage_schedule" "daily_backup" {
name = "critical-vm-daily-backup"
snapshot_type = "instant"
policy_retention_in_days = 7
policy_frequency_daily_start_time = "03:00:00"
}
# --- THE NEW PROPOSED FEATURE ---
# Attaches the schedule directly to the instance, just like in the console
resource "mgc_block_storage_schedule_instance_attach" "attach_backup_to_the_vm" {
schedule_id = mgc_block_storage_schedule.backup_daily.id
instance_id = mgc_virtual_machine_instances.my_vm.id
}Describe alternatives you've considered
Create a Python script and leave it inside the instance
Additional context
Implementing this feature would bring parity between the Terraform provider and the web console, drastically simplifying backup management and making automation with Terraform more robust and reliable.