I'm fairly new to Terraform so I'm hoping the issue is something I'm doing wrong.
I have some instances which need separate EBS volumes attached. These are defined as three separate Terraform resources:
aws_instance
aws_ebs_volume
aws_volume_attachment
When the instances boot, within AWS console the volumes say they have 'Delete on termination' protection, yet Terraform still destroys them:
If you use the 'block_device' mapping within the aws_instance resource definition you can prevent it from being terminated:
https://www.terraform.io/docs/providers/aws/r/instance.html#delete_on_termination-1
But this does option not appear in the ebs_volume resource:
https://www.terraform.io/docs/providers/aws/r/ebs_volume.html
How do I stop Terraform from deleting my EBS volumes?
I tried doing this, but it just stops the terraform destroy job from running:
lifecycle = {
prevent_destroy = true
}
Thanks
