Skip to content

Commit

Permalink
Merge pull request #8 from gaussb-labs/add-root-block-device
Browse files Browse the repository at this point in the history
add root_block_device to launch configs
  • Loading branch information
arihant-2310 authored Oct 31, 2022
2 parents 195878e + 53cd281 commit f8f6198
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ module "app_cluster" {
instance_type = "t3a.medium"
user_data_base64 = ""
iam_instance_profile_name = "ecs_agent_access_instance_profile"
root_block_device = {
volume_type = "gp3"
volume_size = 30
}
security_group_ids = ["sg-01", "sg-02"]
},
{
Expand Down Expand Up @@ -164,7 +168,7 @@ No modules.
| launch_configs.user_data_base64 | Base64 encoded userdata. | `string` | n/a | yes |
| launch_configs.iam_instance_profile_name | Name of the IAM instance profile to attach to the EC2 instance. | `string` | n/a | yes |
| launch_configs.security_group_ids | List of security group ids to attach to the EC2 instance. | `list(string)` | n/a | yes |

| launch_configs.root_block_device | root block device configuration

### Outputs
No outputs.
Expand Down
11 changes: 10 additions & 1 deletion auto_scaling_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@ resource "aws_launch_configuration" "ecs_launch_config" {
instance_type = each.value.instance_type
user_data_base64 = each.value.user_data_base64
iam_instance_profile = each.value.iam_instance_profile_name
security_groups = each.value.security_group_ids

dynamic "root_block_device" {
for_each = each.value.root_block_device != null ? [each.value.root_block_device] : []

content {
volume_type = root_block_device.value.volume_type
volume_size = root_block_device.value.volume_size
}
}
security_groups = each.value.security_group_ids
lifecycle {
create_before_destroy = true
}
Expand Down
6 changes: 5 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ variable "launch_configs" {
instance_type = string
user_data_base64 = string
iam_instance_profile_name = string
security_group_ids = list(string)
root_block_device = object({
volume_type = string
volume_size = number
})
security_group_ids = list(string)
}))
description = "Launch configuration for EC2 instances."
}

0 comments on commit f8f6198

Please sign in to comment.