feat(examples/templates/aws-devcontainer): add root volume parameter, growpart automatically (#14839)

Fixes https://github.com/coder/coder/issues/14833
This commit is contained in:
Cian Johnston
2024-09-27 09:51:31 +01:00
committed by GitHub
parent a3ffab6ceb
commit 3b5cabb566

View File

@ -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" { data "coder_parameter" "fallback_image" {
default = "codercom/enterprise-base:ubuntu" default = "codercom/enterprise-base:ubuntu"
description = "This image runs if the devcontainer fails to build." description = "This image runs if the devcontainer fails to build."
@ -197,6 +210,11 @@ locals {
shell: /bin/bash shell: /bin/bash
ssh_authorized_keys: ssh_authorized_keys:
- "${data.coder_parameter.ssh_pubkey.value}" - "${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" Content-Type: text/x-shellscript; charset="us-ascii"
@ -268,7 +286,7 @@ resource "aws_instance" "vm" {
instance_type = data.coder_parameter.instance_type.value instance_type = data.coder_parameter.instance_type.value
iam_instance_profile = try(data.aws_iam_instance_profile.vm_instance_profile[0].name, null) iam_instance_profile = try(data.aws_iam_instance_profile.vm_instance_profile[0].name, null)
root_block_device { root_block_device {
volume_size = 30 volume_size = data.coder_parameter.root_volume_size_gb.value
} }
user_data = local.user_data user_data = local.user_data