Skip to content

Commit f8f6198

Browse files
authored
Merge pull request #8 from gaussb-labs/add-root-block-device
add root_block_device to launch configs
2 parents 195878e + 53cd281 commit f8f6198

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ module "app_cluster" {
2525
instance_type = "t3a.medium"
2626
user_data_base64 = ""
2727
iam_instance_profile_name = "ecs_agent_access_instance_profile"
28+
root_block_device = {
29+
volume_type = "gp3"
30+
volume_size = 30
31+
}
2832
security_group_ids = ["sg-01", "sg-02"]
2933
},
3034
{
@@ -164,7 +168,7 @@ No modules.
164168
| launch_configs.user_data_base64 | Base64 encoded userdata. | `string` | n/a | yes |
165169
| launch_configs.iam_instance_profile_name | Name of the IAM instance profile to attach to the EC2 instance. | `string` | n/a | yes |
166170
| launch_configs.security_group_ids | List of security group ids to attach to the EC2 instance. | `list(string)` | n/a | yes |
167-
171+
| launch_configs.root_block_device | root block device configuration
168172

169173
### Outputs
170174
No outputs.

auto_scaling_groups.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,16 @@ resource "aws_launch_configuration" "ecs_launch_config" {
55
instance_type = each.value.instance_type
66
user_data_base64 = each.value.user_data_base64
77
iam_instance_profile = each.value.iam_instance_profile_name
8-
security_groups = each.value.security_group_ids
8+
9+
dynamic "root_block_device" {
10+
for_each = each.value.root_block_device != null ? [each.value.root_block_device] : []
11+
12+
content {
13+
volume_type = root_block_device.value.volume_type
14+
volume_size = root_block_device.value.volume_size
15+
}
16+
}
17+
security_groups = each.value.security_group_ids
918
lifecycle {
1019
create_before_destroy = true
1120
}

variables.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@ variable "launch_configs" {
4040
instance_type = string
4141
user_data_base64 = string
4242
iam_instance_profile_name = string
43-
security_group_ids = list(string)
43+
root_block_device = object({
44+
volume_type = string
45+
volume_size = number
46+
})
47+
security_group_ids = list(string)
4448
}))
4549
description = "Launch configuration for EC2 instances."
4650
}

0 commit comments

Comments
 (0)