Description
Cloud Storage Object Versioning keeps earlier generations when a live object is overwritten or deleted without a generation number. Use it when logs, backups or production objects need readable history.
Potential impact
Without a retained generation, recovery depends on soft delete or another backup. Use audit logs to identify who changed the object.
Remediation
- Set
versioning.enabled: trueon buckets that need object history. Test restoring a retained generation by copying it to the original object name. - Set a retention period that fits your recovery needs and storage budget. Review soft delete, lifecycle rules, and who can delete old generations or the bucket.
Examples
The examples use the legacy Deployment Manager format. Apply the policy through a supported tool and supply your bucket name and required settings.
Before
yaml
resources:
- name: bucket
type: storage.v1.bucket
properties:
storageClass: STANDARD
location: EUROPE-WEST3
After
yaml
resources:
- name: bucket
type: storage.v1.bucket
properties:
storageClass: STANDARD
location: EUROPE-WEST3
versioning:
enabled: true
Explanation:
- Before: The manifest sets a storage class and location but omits versioning. Check the existing bucket’s effective settings.
- After: Versioning is enabled for future changes. Data already permanently deleted cannot be restored.