Skip to content

Commit dfd0326

Browse files
authored
Merge branch 'main' into gcp-devcontainer-vm
2 parents 471ba69 + 2e86b76 commit dfd0326

File tree

38 files changed

+468
-1338
lines changed

38 files changed

+468
-1338
lines changed

cli/testdata/coder_templates_init_--help.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ USAGE:
66
Get started with a templated template.
77

88
OPTIONS:
9-
--id aws-ecs-container|aws-linux|aws-windows|azure-linux|do-linux|docker|docker-with-dotfiles|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|nomad-docker
9+
--id aws-linux|aws-windows|azure-linux|do-linux|docker|gcp-linux|gcp-vm-container|gcp-windows|kubernetes|nomad-docker
1010
Specify a given example template by ID.
1111

1212
———

docs/cli/templates_init.md

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dotfiles.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ resource "coder_agent" "main" {
3232
}
3333
```
3434

35-
[Here's a complete example.](https://github.com/coder/coder/tree/main/examples/templates/docker-with-dotfiles#how-it-works)
36-
3735
## Persistent Home
3836

3937
Sometimes you want to support personalization without requiring dotfiles.

docs/platforms/jfrog.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ within a workspace. We'll use Docker as the underlying compute. But, these
88
concepts apply to any compute platform.
99

1010
The full example template can be found
11-
[here](https://github.com/coder/coder/tree/main/examples/templates/jfrog/docker).
11+
[here](https://github.com/coder/coder/tree/main/examples/jfrog/docker).
1212

1313
## Requirements
1414

@@ -249,7 +249,7 @@ for more information.
249249
## More reading
250250
251251
- See the full example template
252-
[here](https://github.com/coder/coder/tree/main/examples/templates/jfrog/docker).
252+
[here](https://github.com/coder/coder/tree/main/examples/jfrog/docker).
253253
- To serve extensions from your own VS Code Marketplace, check out
254254
[code-marketplace](https://github.com/coder/code-marketplace#artifactory-storage).
255255
- To store templates in Artifactory, check out our

docs/templates/docker-in-workspaces.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ Before using Podman, please review the following documentation:
253253
3. For systems running SELinux (typically Fedora-, CentOS-, and Red Hat-based
254254
systems), you might need to disable SELinux or set it to permissive mode.
255255
256-
4. Import our
257-
[kubernetes-with-podman](https://github.com/coder/coder/tree/main/examples/templates/kubernetes-with-podman)
256+
4. Use this
257+
[kubernetes-with-podman](https://github.com/coder/community-templates/tree/main/kubernetes-podman)
258258
example template, or make your own.
259259
260260
```shell

examples/examples.gen.json

Lines changed: 56 additions & 74 deletions
Large diffs are not rendered by default.

examples/examples.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ var (
2323
// Only some templates are embedded that we want to display inside the UI.
2424
// The metadata in examples.gen.json is generated via scripts/examplegen.
2525
//go:embed examples.gen.json
26-
//go:embed templates/aws-ecs-container
2726
//go:embed templates/aws-linux
2827
//go:embed templates/aws-windows
2928
//go:embed templates/azure-linux
3029
//go:embed templates/do-linux
3130
//go:embed templates/docker
32-
//go:embed templates/docker-with-dotfiles
3331
//go:embed templates/gcp-linux
3432
//go:embed templates/gcp-vm-container
3533
//go:embed templates/gcp-windows

examples/templates/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ List template examples in our CLI with `coder templates init`.
66
77
## Getting Started
88

9-
Clone this repository to create a project from any example listed here:
9+
Clone this repository to create a template from any example listed here:
1010

1111
```console
1212
git clone https://github.com/coder/coder
13-
cd examples/templates/aws-macos
13+
cd examples/templates/aws-linux
1414
coder templates create
1515
```
1616

examples/templates/aws-ecs-container/README.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

examples/templates/aws-ecs-container/main.tf

Lines changed: 0 additions & 135 deletions
This file was deleted.

examples/templates/aws-linux/README.md

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,27 @@
11
---
2-
name: Develop in Linux on AWS EC2
3-
description: Get started with Linux development on AWS EC2.
4-
tags: [cloud, aws]
5-
icon: /icon/aws.png
2+
display_name: AWS EC2 (Linux)
3+
description: Provision AWS EC2 VMs as Coder workspaces
4+
icon: ../../../site/static/icon/aws.png
5+
maintainer_github: coder
6+
verified: true
7+
tags: [vm, linux, aws, persistent-vm]
68
---
79

8-
# aws-linux
10+
# Remote Development on AWS EC2 VMs (Linux)
911

10-
To get started, run `coder templates init`. When prompted, select this template.
11-
Follow the on-screen instructions to proceed.
12+
Provision AWS EC2 VMs as [Coder workspaces](https://coder.com/docs/coder-v2/latest) with this example template.
1213

13-
## Authentication
14+
<!-- TODO: Add screenshot -->
1415

15-
This template assumes that coderd is run in an environment that is authenticated
16-
with AWS. For example, run `aws configure import` to import credentials on the
17-
system and user running coderd. For other ways to authenticate [consult the
18-
Terraform docs](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration).
16+
## Prerequisites
17+
18+
### Authentication
19+
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).
21+
22+
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`.
23+
24+
To use another [authentication method](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication), edit the template.
1925

2026
## Required permissions / policy
2127

@@ -71,6 +77,17 @@ instances provisioned by Coder:
7177
}
7278
```
7379

80+
## Architecture
81+
82+
This template provisions the following resources:
83+
84+
- AWS Instance
85+
86+
Coder uses `aws_ec2_instance_state` to start and stop the VM. This example template is fully persistent, meaning the full filesystem is preserved when the workspace restarts. See this [community example](https://github.com/bpmct/coder-templates/tree/main/aws-linux-ephemeral) of an ephemeral AWS instance.
87+
88+
> **Note**
89+
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
90+
7491
## code-server
7592

7693
`code-server` is installed via the `startup_script` argument in the `coder_agent`

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)