backup_ebs.tf 726 B

123456789101112131415161718
  1. # Make /opt/tqbackup separate from the instance for greater margin of safety
  2. resource "aws_ebs_volume" "tqbackup" {
  3. count = local.instance_count
  4. availability_zone = var.azs[count.index % 3]
  5. size = var.tqbackup_size
  6. type = "gp3"
  7. encrypted = true
  8. kms_key_id = data.aws_kms_key.ebs-key.arn
  9. tags = merge(local.standard_tags, var.tags, { Name = "${local.server_name_stem}-${count.index}", Path = "/opt/tqbackup", Device = "/dev/xvdf" })
  10. }
  11. resource "aws_volume_attachment" "tqbackup" {
  12. count = local.instance_count
  13. device_name = "/dev/xvdf"
  14. volume_id = aws_ebs_volume.tqbackup[count.index].id
  15. instance_id = aws_instance.instance[count.index].id
  16. }