Skip to content

Commit 24dd048

Browse files
committed
Fix AWS authentication typo and update user_data
in main.tf
1 parent 207fc07 commit 24dd048

File tree

2 files changed

+26
-27
lines changed

2 files changed

+26
-27
lines changed

examples/templates/aws-linux/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Provision AWS EC2 VMs as [Coder workspaces](https://coder.com/docs/coder-v2/late
1717

1818
### Authentication
1919

20-
By default, this template authenticates to AWS with using the provider's default [authentication methods](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration).
20+
By default, this template authenticates to AWS using the provider's default [authentication methods](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration).
2121

2222
The simplest way (without making changes to the template) is via environment variables (e.g. `AWS_ACCESS_KEY_ID`) or a [credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-format). If you are running Coder on a VM, this file must be in `/home/coder/aws/credentials`.
2323

examples/templates/aws-linux/main.tf

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -212,36 +212,35 @@ resource "coder_app" "code-server" {
212212

213213
locals {
214214
linux_user = "coder"
215-
user_data = data.coder_workspace.me.start_count > 0 ? trimspace(<<EOT
216-
Content-Type: multipart/mixed; boundary="//"
217-
MIME-Version: 1.0
215+
user_data = <<-EOT
216+
Content-Type: multipart/mixed; boundary="//"
217+
MIME-Version: 1.0
218218
219-
--//
220-
Content-Type: text/cloud-config; charset="us-ascii"
221-
MIME-Version: 1.0
222-
Content-Transfer-Encoding: 7bit
223-
Content-Disposition: attachment; filename="cloud-config.txt"
219+
--//
220+
Content-Type: text/cloud-config; charset="us-ascii"
221+
MIME-Version: 1.0
222+
Content-Transfer-Encoding: 7bit
223+
Content-Disposition: attachment; filename="cloud-config.txt"
224224
225-
#cloud-config
226-
cloud_final_modules:
227-
- [scripts-user, always]
228-
hostname: ${lower(data.coder_workspace.me.name)}
229-
users:
230-
- name: ${local.linux_user}
231-
sudo: ALL=(ALL) NOPASSWD:ALL
232-
shell: /bin/bash
225+
#cloud-config
226+
cloud_final_modules:
227+
- [scripts-user, always]
228+
hostname: ${lower(data.coder_workspace.me.name)}
229+
users:
230+
- name: ${local.linux_user}
231+
sudo: ALL=(ALL) NOPASSWD:ALL
232+
shell: /bin/bash
233233
234-
--//
235-
Content-Type: text/x-shellscript; charset="us-ascii"
236-
MIME-Version: 1.0
237-
Content-Transfer-Encoding: 7bit
238-
Content-Disposition: attachment; filename="userdata.txt"
234+
--//
235+
Content-Type: text/x-shellscript; charset="us-ascii"
236+
MIME-Version: 1.0
237+
Content-Transfer-Encoding: 7bit
238+
Content-Disposition: attachment; filename="userdata.txt"
239239
240-
#!/bin/bash
241-
sudo -u ${local.linux_user} sh -c '${coder_agent.dev[0].init_script}'
242-
--//--
243-
EOT
244-
) : ""
240+
#!/bin/bash
241+
sudo -u ${local.linux_user} sh -c '${try(coder_agent.dev[0].init_script, "")}'
242+
--//--
243+
EOT
245244
}
246245

247246
resource "aws_instance" "dev" {

0 commit comments

Comments
 (0)