Skip to content

Commit 463139c

Browse files
committed
terraform/AWS: Add an "EBS volume throughput" setting
Enable kdevops users to provision the maximum amount of throughput on the extra EBS volumes added to each instance. Signed-off-by: Chuck Lever <[email protected]>
1 parent 1a9f5c6 commit 463139c

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

playbooks/roles/gen_tfvars/templates/aws/terraform.tfvars.j2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ aws_ebs_volume_type = "{{ terraform_aws_ebs_volume_type }}"
1010
{% if terraform_aws_ebs_volume_iops is defined %}
1111
aws_ebs_volume_iops = {{ terraform_aws_ebs_volume_iops }}
1212
{% endif %}
13+
{% if aws_ebs_volume_throughput is defined %}
14+
aws_ebs_volume_throughput = {{ terraform_aws_ebs_volume_throughput }}
15+
{% endif %}
1316

1417
ssh_config_pubkey_file = "{{ kdevops_terraform_ssh_config_pubkey_file }}"
1518
ssh_config_user = "{{ kdevops_terraform_ssh_config_user }}"

terraform/aws/kconfigs/Kconfig.storage

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,21 @@ config TERRAFORM_AWS_EBS_VOLUME_IOPS
105105

106106
endif # TERRAFORM_AWS_EBS_VOLUME_TYPE_GP3 || TERRAFORM_AWS_EBS_ ...
107107

108+
if TERRAFORM_AWS_EBS_VOLUME_TYPE_GP3 || TERRAFORM_AWS_EBS_VOLUME_TYPE_IO1
109+
110+
config TERRAFORM_AWS_EBS_VOLUME_THROUGHPUT
111+
int "Throughput provisioned for EBS volumes"
112+
output yaml
113+
default 125
114+
range 125 1000
115+
help
116+
This setting specifies the maximum throughput, in
117+
megabytes per second, to be provisioned for each extra EBS
118+
volume. The maximum setting allowed by AWS varies with the
119+
number and type of EBS volumes attached to each instance.
120+
121+
endif # TERRAFORM_AWS_EBS_VOLUME_TYPE_GP3 || TERRAFORM_AWS_EBS_VOLUME_TYPE_IO1
122+
108123
choice
109124
prompt "Volume size for all EBS volumes"
110125
default TERRAFORM_AWS_EBS_VOLUME_SIZE_32G

terraform/aws/kdevops_ebs_volumes/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ resource "aws_ebs_volume" "kdevops_volume" {
99
iops = var.vol_iops
1010
multi_attach_enabled = false
1111
size = var.vol_size
12+
throughput = var.vol_throughput
1213
type = var.vol_type
1314
}
1415

terraform/aws/kdevops_ebs_volumes/vars.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ variable "vol_size" {
2323
type = number
2424
}
2525

26+
variable "vol_throughput" {
27+
description = "Provisioned throughput for each attached volume, in MBS"
28+
type = number
29+
}
30+
2631
variable "vol_type" {
2732
description = "Device type of each attached volume"
2833
type = string

terraform/aws/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ module "kdevops_ebs_volumes" {
146146
vol_instance_id = element(aws_instance.kdevops_instance.*.id, count.index)
147147
vol_iops = var.aws_ebs_volume_iops
148148
vol_size = var.aws_ebs_volume_size
149+
vol_throughput = var.aws_ebs_volume_throughput
149150
vol_type = var.aws_ebs_volume_type
150151
}
151152

terraform/aws/vars.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ variable "aws_ebs_volume_size" {
6565
type = number
6666
}
6767

68+
variable "aws_ebs_volume_throughput" {
69+
description = "Throughput reserved for each EBS volume"
70+
type = number
71+
default = null
72+
}
73+
6874
variable "aws_ebs_volume_type" {
6975
description = "Type of each of the EBS volumes"
7076
type = string

0 commit comments

Comments
 (0)