Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support multiple EBS volume types & set default to less-expensive gp3 #77

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ resource "aws_instance" "default" {
root_block_device {
encrypted = var.root_block_device_encrypted
volume_size = var.root_block_device_volume_size
volume_type = var.root_block_device_volume_type
Gowiem marked this conversation as resolved.
Show resolved Hide resolved
}

# Optional block; skipped if var.ebs_block_device_volume_size is zero
Expand Down
14 changes: 12 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,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)
mbijon marked this conversation as resolved.
Show resolved Hide resolved
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 Expand Up @@ -156,8 +166,8 @@ variable "security_group_rules" {
}
]
description = <<-EOT
A list of maps of Security Group rules.
The values of map is fully complated with `aws_security_group_rule` resource.
A list of maps of Security Group rules.
The values of map is fully complated with `aws_security_group_rule` resource.
To get more info see https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule .
EOT
}
Expand Down