diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index 3f6e2f83d8871..5377f2702d022 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -36,19 +36,6 @@ variable "region" { } } -variable "disk_size" { - description = "Specify your disk size (GiBs)" - default = "20" - type = number - validation { - condition = ( - var.disk_size >= 8 && - var.disk_size <= 256 - ) - error_message = "Disk size must be between 8 and 256." - } -} - provider "aws" { region = var.region } @@ -93,6 +80,11 @@ Content-Disposition: attachment; filename="cloud-config.txt" #cloud-config cloud_final_modules: - [scripts-user, always] +hostname: ${lower(data.coder_workspace.me.name)} +users: +- name: ${local.linux_user} + sudo: ALL=(ALL) NOPASSWD:ALL + shell: /bin/bash --// Content-Type: text/x-shellscript; charset="us-ascii" @@ -101,7 +93,7 @@ Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="userdata.txt" #!/bin/bash -sudo -u ubuntu sh -c '${coder_agent.dev.init_script}' +sudo -u ${local.linux_user} sh -c '${coder_agent.dev.init_script}' --//-- EOT @@ -129,12 +121,16 @@ Content-Disposition: attachment; filename="userdata.txt" sudo shutdown -h now --//-- EOT + + # Ensure Coder username is a valid Linux username + linux_user = lower(substr(data.coder_workspace.me.owner, 0, 32)) + } resource "aws_instance" "dev" { ami = data.aws_ami.ubuntu.id availability_zone = "${var.region}a" - instance_type = "t3.micro" + instance_type = "t3.xlarge" user_data = data.coder_workspace.me.transition == "start" ? local.user_data_start : local.user_data_end tags = { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy