From a2706640346082e101f5b8b18291cec689323bbe Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 26 Sep 2024 18:44:40 +0100 Subject: [PATCH 1/2] feat(examples/templates/aws-devcontainer): add root volume parameter, growpart automatically --- examples/templates/aws-devcontainer/main.tf | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/examples/templates/aws-devcontainer/main.tf b/examples/templates/aws-devcontainer/main.tf index ea60b7a9b25b6..7e74933203b22 100644 --- a/examples/templates/aws-devcontainer/main.tf +++ b/examples/templates/aws-devcontainer/main.tf @@ -88,6 +88,19 @@ data "coder_parameter" "instance_type" { } } +data "coder_parameter" "root_volume_size_gb" { + name = "root_volume_size_gb" + display_name = "Root Volume Size (GB)" + description = "How large should the root volume for the instance be?" + default = 30 + type = "number" + mutable = true + validation { + min = 1 + monotonic = "increasing" + } +} + data "coder_parameter" "fallback_image" { default = "codercom/enterprise-base:ubuntu" description = "This image runs if the devcontainer fails to build." @@ -197,6 +210,11 @@ locals { shell: /bin/bash ssh_authorized_keys: - "${data.coder_parameter.ssh_pubkey.value}" + # Automatically grow the partition + growpart: + mode: auto + devices: ['/'] + ignore_growroot_disabled: false --// Content-Type: text/x-shellscript; charset="us-ascii" @@ -268,7 +286,7 @@ resource "aws_instance" "vm" { instance_type = data.coder_parameter.instance_type.value iam_instance_profile = try(data.aws_iam_instance_profile.vm_instance_profile[0].name, null) root_block_device { - volume_size = 30 + volume_size = data.coder_parameter.root_volume_size_gb.value } user_data = local.user_data From eff8a5c6669041d271885492c5f34605c4f4ba35 Mon Sep 17 00:00:00 2001 From: Cian Johnston Date: Thu, 26 Sep 2024 18:50:52 +0100 Subject: [PATCH 2/2] make fmt --- examples/templates/aws-devcontainer/main.tf | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/templates/aws-devcontainer/main.tf b/examples/templates/aws-devcontainer/main.tf index 7e74933203b22..27434385c647b 100644 --- a/examples/templates/aws-devcontainer/main.tf +++ b/examples/templates/aws-devcontainer/main.tf @@ -89,14 +89,14 @@ data "coder_parameter" "instance_type" { } data "coder_parameter" "root_volume_size_gb" { - name = "root_volume_size_gb" + name = "root_volume_size_gb" display_name = "Root Volume Size (GB)" - description = "How large should the root volume for the instance be?" - default = 30 - type = "number" - mutable = true + description = "How large should the root volume for the instance be?" + default = 30 + type = "number" + mutable = true validation { - min = 1 + min = 1 monotonic = "increasing" } }