Skip to content

Commit

Permalink
Support multiple EBS volume types & set default to less-expensive gp3…
Browse files Browse the repository at this point in the history
  • Loading branch information
nachovalera committed Apr 3, 2023
1 parent 7b82ee0 commit 401d2f1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
10 changes: 10 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 401d2f1

Please sign in to comment.