Skip to content

Commit

Permalink
Merged in dev/rich/modify-ec2-ebs-disk-size-2021.03.05 (pull request e…
Browse files Browse the repository at this point in the history
…lastic#70)

Ability to increase the EBS disk size on terraform created stacks

* This commit is for https://engageli.atlassian.net/browse/MPC-1457,
and the JIRA has a confluence page linked that provides additional
information.

It adds the capability to increase the EBS disk size on
terraform created stacks for these instance roles:
* EMS
* Engageli
* Merger
* Recorder

Here is the required variables in the tfvars to enable this
feature, and the values are in Gb.  The value of `8` is the
default, so adding this section as is, will not make any
changes to the instances:

```
ebs_root_volume_size = {
  "engageli" = 8
  "ems" = 8
  "merger" = 8
  "recorder" = 8
}
```

For the variables it uses the new map format, since the existing
map has been deprecated:
  https://www.terraform.io/docs/language/functions/map.html
modified:   aws/ams-cluster-v1-tf/ems.tf
modified:   aws/ams-cluster-v1-tf/main.tf
modified:   aws/ams-cluster-v1-tf/variables.tf

Approved-by: Gideon Avida
  • Loading branch information
Rich Nessel committed Mar 8, 2021
1 parent ff9bc8b commit c64a969
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
3 changes: 3 additions & 0 deletions aws/ams-cluster-v1-tf/ems.tf
Expand Up @@ -89,6 +89,9 @@ resource "aws_instance" "ems" {
aws_security_group.ems.id
]
subnet_id = aws_subnet.subnets[0].id # FIXME for cluster v2
root_block_device {
volume_size = var.ebs_root_volume_size.ems
}
tags = {
Name = "tf-${var.stack_name}-ems"
Role = "ems"
Expand Down
15 changes: 12 additions & 3 deletions aws/ams-cluster-v1-tf/main.tf
Expand Up @@ -469,6 +469,9 @@ resource "aws_instance" "engageli" {
aws_security_group.redis_clients.id
]
subnet_id = aws_subnet.subnets[0].id # FIXME for cluster v2
root_block_device {
volume_size = var.ebs_root_volume_size.engageli
}
tags = {
Name = "tf-${var.stack_name}-engageli"
Role = "engageli-api"
Expand Down Expand Up @@ -509,6 +512,9 @@ resource "aws_instance" "merger" {
aws_security_group.redis_clients.id
]
subnet_id = aws_subnet.subnets[0].id # FIXME for cluster v2
root_block_device {
volume_size = var.ebs_root_volume_size.merger
}
tags = {
Name = "tf-${var.stack_name}-merger"
Role = "merger"
Expand All @@ -532,6 +538,9 @@ resource "aws_instance" "recorder" {
aws_security_group.redis_clients.id
]
subnet_id = aws_subnet.subnets[0].id # FIXME for cluster v2
root_block_device {
volume_size = var.ebs_root_volume_size.recorder
}
tags = {
Name = "tf-${var.stack_name}-recorder"
Role = "recorder"
Expand Down Expand Up @@ -640,21 +649,21 @@ resource "aws_lb_target_group_attachment" "engageli" {
}

resource "aws_lb_target_group" "ems" {
count = var.num_ems
count = var.num_ems
name = "tf-${var.stack_name}-ems-tg"
port = 443
protocol = "HTTPS"
vpc_id = aws_vpc.main.id
target_type = "instance"
health_check {
enabled = true # Required by AWS: "Health check enabled must be true for target groups with target type 'instance'"
enabled = true # Required by AWS: "Health check enabled must be true for target groups with target type 'instance'"
path = "/ems/ping" # FIXME
matcher = 200
}
}

resource "aws_lb_target_group_attachment" "ems" {
count = var.num_ems
count = var.num_ems
target_group_arn = aws_lb_target_group.ems[count.index].arn
target_id = aws_instance.ems[count.index].id
port = 443
Expand Down
10 changes: 10 additions & 0 deletions aws/ams-cluster-v1-tf/variables.tf
Expand Up @@ -167,6 +167,16 @@ variable "instance_types" {
}
}

variable "ebs_root_volume_size" {
description = "Size of the root EBS volume in gibibytes (GiB)"
default = {
"ems" = 8
"engageli" = 8
"recorder" = 8
"merger" = 8
}
}

variable "concurrent_mergers" {
description = "Number of concurrent merger workers in a dequeue node"
type = number
Expand Down

0 comments on commit c64a969

Please sign in to comment.