Skip to content

example: added hetzner cloud workspace #1884

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

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
example: generate dummy ssh private key for hetzner cloud
  • Loading branch information
ntimo committed Jun 9, 2022
commit db360b6c846a7cf0764743a0177ad8dee191efbc
12 changes: 12 additions & 0 deletions examples/hetzner-linux/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,24 @@ resource "coder_app" "code-server" {
relative_path = true
}

# Generate a dummy ssh key that is not accessible so Hetzner cloud does not spam the admin with emails.
resource "tls_private_key" "rsa_4096" {
algorithm = "RSA"
rsa_bits = 4096
}

resource "hcloud_ssh_key" "root" {
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
public_key = tls_private_key.rsa_4096.public_key_openssh
}

resource "hcloud_server" "root" {
count = data.coder_workspace.me.start_count
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
server_type = var.instance_type
location = var.instance_location
image = var.instance_os
ssh_keys = [hcloud_ssh_key.root.id]
user_data = templatefile("cloud-config.yaml.tftpl", {
username = data.coder_workspace.me.owner
volume_path = "/dev/disk/by-id/scsi-0HC_Volume_${hcloud_volume.root.id}"
Expand Down