diff --git a/main.tf b/main.tf index 02599aa..f16e9c8 100644 --- a/main.tf +++ b/main.tf @@ -84,6 +84,7 @@ resource "aws_instance" "default" { content { encrypted = var.ebs_block_device_encrypted volume_size = var.ebs_block_device_volume_size + volume_type = var.root_block_device_volume_type delete_on_termination = var.ebs_delete_on_termination device_name = var.ebs_device_name } diff --git a/variables.tf b/variables.tf index ae614c2..6521ad4 100644 --- a/variables.tf +++ b/variables.tf @@ -56,6 +56,16 @@ variable "root_block_device_volume_size" { description = "The volume size (in GiB) to provision for the root block device. It cannot be smaller than the AMI it refers to." } +variable "root_block_device_volume_type" { + type = string + default = "gp3" + description = "The volume type for the EBS root volume" + validation { + condition = contains(["standard", "gp2", "gp3", "io1", "io2", "sc1", "st1"], var.root_block_device_volume_type) + error_message = "The root volume must specify a supported EBS type" + } +} + variable "disable_api_termination" { type = bool description = "Enable EC2 Instance Termination Protection"