Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion examples/templates/aws-devcontainer/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down Expand Up @@ -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
Comment on lines +214 to +217
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


--//
Content-Type: text/x-shellscript; charset="us-ascii"
Expand Down Expand Up @@ -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
Expand Down
Loading