Seems like ebs_volumes
should have a parameter to trigger a snapshot of the volume before deleting, much like final_snapshot_identifer in db_instance
Thanks for opening this issue. If use-case examples are necessary i am happy to provide
As far as I know, EBS does not provide this functionality as a flag (unlike RDS which does). @catsby - do you think Terraform should provide this functionality regardless, as a "wrapper" around EBS? If so, I'd be happy to give this a shot.
Basically, yeah.
In the delete method of resource_ebs_volume
we just go right to delete:
I'm proposing adding an optional attribute to resource_ebs_volume
e.g. termination_snapshot_name
or something, to denote that this is the name to give to the snapshot that's created from this volume when terraform destroyed it.
Then in the resourceAwsEbsVolumeDelete
method (linked above), check if termination_snapshot_name
is set (not ""
), and if a name is given, we should then call CreateSnapshot for the volume, and wait until it succeeds before we move on to deletion. We should log that we're creating a snapshot and waiting for it to succeed before moving on to normal deletion.
Sounds good to me @catsby. I'll give it a shot then - I've been wanting to start contributing to Terraform for a while now, and this seems like a good start to me. Updates will follow.
Looking forward to it! Feel free to open an incomplete PR if you need guidance on anything
I'm surprised there is so little traction for this...
any updates on this topic or any workaround? I'm also looking forward to have this feature
@catsby because ebs-volumes don't have an id
in the rds sense of the term, what about just copying any tags on the drive to the snapshot?
Most helpful comment
I'm surprised there is so little traction for this...