Skip to content

Commit 13addf5

Browse files
[WIP] make ec2 volume size configurable (#116)
* make ec2 volume size configurable * Adding option in README * Size to number and root as block device --------- Co-authored-by: LeoDiazL <[email protected]>
1 parent 33f24d6 commit 13addf5

File tree

5 files changed

+17
-1
lines changed

5 files changed

+17
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ The following inputs can be used as `step.with` keys
159159
| `aws_ami_id` | String | AWS AMI ID. Will default to latest Ubuntu 22.04 server image (HVM). Accepts `ami-###` values. |
160160
| `ec2_instance_profile` | String | The AWS IAM instance profile to use for the EC2 instance. Default is `${GITHUB_ORG_NAME}-${GITHUB_REPO_NAME}-${GITHUB_BRANCH_NAME}`|
161161
| `ec2_instance_type` | String | The AWS IAM instance type to use. Default is `t2.small`. See [this list](https://aws.amazon.com/ec2/instance-types/) for reference. |
162+
| `ec2_volume_size` | Integer | The size of the volume (in GB) on the AWS Instance. |
162163
| `create_keypair_sm_entry` | Boolean | Generates and manage a secret manager entry that contains the public and private keys created for the ec2 instance. |
163164
<hr/>
164165
<br/>

action.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ inputs:
7272
ec2_instance_type:
7373
description: 'The AWS Instance type'
7474
required: false
75+
ec2_volume_size:
76+
description: 'The size of the volume (in GB) on the AWS Instance'
77+
required: false
78+
default: "8"
79+
7580

7681
# EFS
7782
aws_create_efs:
@@ -200,6 +205,7 @@ runs:
200205
LB_HEALTHCHECK: ${{ inputs.lb_healthcheck }}
201206
EC2_INSTANCE_PROFILE: ${{ inputs.ec2_instance_profile }}
202207
EC2_INSTANCE_TYPE: ${{ inputs.ec2_instance_type }}
208+
EC2_VOLUME_SIZE: ${{ inputs.ec2_volume_size }}
203209
STACK_DESTROY: ${{ inputs.stack_destroy }}
204210
AWS_RESOURCE_IDENTIFIER: ${{ inputs.aws_resource_identifier }}
205211
DOMAIN_NAME: ${{ inputs.domain_name }}

operations/_scripts/generate/generate_tf_vars.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ additional_tags=$(generate_var additional_tags $ADDITIONAL_TAGS)
148148
application_mount_target=$(generate_var application_mount_target $APPLICATION_MOUNT_TARGET)
149149
efs_mount_target=$(generate_var efs_mount_target $EFS_MOUNT_TARGET)
150150
data_mount_target=$(generate_var data_mount_target $DATA_MOUNT_TARGET)
151+
ec2_volume_size=$(generate_var ec2_volume_size $EC2_VOLUME_SIZE)
151152

152153

153154
# -------------------------------------------------- #
@@ -175,6 +176,7 @@ $security_group_name
175176
$ec2_instance_type
176177
$ec2_instance_profile
177178
$ec2_iam_instance_profile
179+
$ec2_volume_size
178180
179181
#-- AWS --#
180182
$aws_resource_identifier

operations/deployment/terraform/main.tf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ resource "aws_instance" "server" {
6666
key_name = aws_key_pair.aws_key.key_name
6767
monitoring = true
6868
iam_instance_profile = aws_iam_instance_profile.ec2_profile.name
69-
69+
root_block_device {
70+
volume_size = tonumber(var.ec2_volume_size)
71+
}
7072
tags = {
7173
Name = "${var.aws_resource_identifier} - Instance"
7274
}

operations/deployment/terraform/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ variable "ec2_instance_public_ip" {
5353
default = "true"
5454
description = "Attach public IP to the EC2 instance"
5555
}
56+
variable "ec2_volume_size" {
57+
type = string
58+
default = "8"
59+
description = "Size (in GB) of the VM's storage drive"
60+
}
5661

5762
variable "security_group_name" {
5863
type = string

0 commit comments

Comments
 (0)