add support for enabling delete protection#268
add support for enabling delete protection#268Curverneur wants to merge 5 commits intoapache:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds delete protection support for CloudStack instances (virtual machines) and volumes (disks) by introducing a new deleteprotection boolean field to both the cloudstack_instance and cloudstack_disk resources. The feature integrates with CloudStack's API updateVirtualMachine and updateVolume endpoints to enable protection against accidental deletion.
Key Changes:
- Added
deleteprotectionoptional boolean field to instance and disk resource schemas - Implemented delete protection setting via CloudStack update APIs after resource creation
- Updated documentation for both resources with usage notes about limitations when resources are managed by other services
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
cloudstack/resource_cloudstack_instance.go |
Added deleteprotection schema field and implementation to set/update protection via UpdateVirtualMachine API |
cloudstack/resource_cloudstack_disk.go |
Added deleteprotection schema field and implementation to set/update protection via UpdateVolume API |
website/docs/r/instance.html.markdown |
Documented deleteprotection parameter with usage notes and reformatted userdata_id/userdata_details entries |
website/docs/r/disk.html.markdown |
Documented deleteprotection parameter with usage notes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
looks like some checks failed due to connection issues. could you check and trigger them again, please? |
| Default: false, | ||
| }, | ||
|
|
||
| "deleteprotection": { |
There was a problem hiding this comment.
| "deleteprotection": { | |
| "delete_protection": { |
to maintain consistency with other keys in terraform
| Optional: true, | ||
| }, | ||
|
|
||
| "deleteprotection": { |
There was a problem hiding this comment.
| "deleteprotection": { | |
| "delete_protection": { |
There was a problem hiding this comment.
@Curverneur Thansk for the PR. It looks mostly good. Can you check the comments? It would be great if you can add some tests here as well.
Description
Add support for enabling the delete protection for instances (virtual machines) and volumes (disks).
Reason
This feature allows users to enable the delete protection for certain resources to prevent accidental deletion.
References
Changes
Added deleteprotection option to
cloudstack_instanceandcloudstack_diskresource and updated the corresponding documentation pages.cloudstack/resource_cloudstack_instance.gocloudstack/resource_cloudstack_disk.gowebsite/docs/r/instance.html.markdownwebsite/docs/r/disk.html.markdown