From d7fee1f5bef4f86922f0a1dbb517ef949b1f91a0 Mon Sep 17 00:00:00 2001 From: Muhammad Atif Ali Date: Sat, 26 Aug 2023 01:14:38 +0300 Subject: [PATCH 1/2] fix: fix a typo in aws_linux template There was a typo after refactoring the aws_linux. --- examples/templates/aws-linux/main.tf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index f1f41024d938a..c9822798a05dd 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -158,7 +158,7 @@ data "aws_ami" "ubuntu" { owners = ["099720109477"] # Canonical } -resource "coder_agent" "main" { +resource "coder_agent" "dev" { arch = "amd64" auth = "aws-instance-identity" os = "linux" @@ -195,7 +195,7 @@ resource "coder_agent" "main" { } resource "coder_app" "code-server" { - agent_id = coder_agent.main.id + agent_id = coder_agent.dev.id slug = "code-server" display_name = "code-server" url = "http://localhost:13337/?folder=/home/coder" @@ -239,7 +239,7 @@ Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="userdata.txt" #!/bin/bash -sudo -u ${local.linux_user} sh -c '${coder_agent.main.init_script}' +sudo -u ${local.linux_user} sh -c '${coder_agent.dev.init_script}' --//-- EOT } @@ -249,7 +249,7 @@ resource "aws_instance" "dev" { availability_zone = "${data.coder_parameter.region.value}a" instance_type = data.coder_parameter.instance_type.value - user_data = local.user_data_start + user_data = local.user_data tags = { Name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}" # Required if you are using our example policy, see template README From e198038746291ad7bc2227b4ffbb39aebff198fe Mon Sep 17 00:00:00 2001 From: Atif Ali Date: Thu, 31 Aug 2023 01:17:03 +0000 Subject: [PATCH 2/2] fixup! --- examples/templates/aws-linux/main.tf | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/examples/templates/aws-linux/main.tf b/examples/templates/aws-linux/main.tf index c9822798a05dd..3017abf339bbb 100644 --- a/examples/templates/aws-linux/main.tf +++ b/examples/templates/aws-linux/main.tf @@ -159,6 +159,7 @@ data "aws_ami" "ubuntu" { } resource "coder_agent" "dev" { + count = data.coder_workspace.me.start_count arch = "amd64" auth = "aws-instance-identity" os = "linux" @@ -195,7 +196,8 @@ resource "coder_agent" "dev" { } resource "coder_app" "code-server" { - agent_id = coder_agent.dev.id + count = data.coder_workspace.me.start_count + agent_id = coder_agent.dev[0].id slug = "code-server" display_name = "code-server" url = "http://localhost:13337/?folder=/home/coder" @@ -211,9 +213,8 @@ resource "coder_app" "code-server" { } locals { - linux_user = "coder" # Ensure this user/group does not exist in your VM image - # User data is used to run the init_script - user_data = < 0 ? trimspace(<