This commit is contained in:
parent
1fcab667ed
commit
e1c9b6bb21
4 changed files with 50 additions and 5 deletions
39
.drone.yml
Normal file
39
.drone.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: default
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
- pull_request
|
||||
- tag
|
||||
|
||||
steps:
|
||||
- name: Lint
|
||||
image: docker.io/hashicorp/terraform
|
||||
commands:
|
||||
- cd hetzner-cloud/
|
||||
- terraform init
|
||||
- terraform validate
|
||||
|
||||
- name: Push
|
||||
image: ghcr.io/coder/coder:v0.24.1
|
||||
commands:
|
||||
- |
|
||||
coder templates push \
|
||||
--name "$DRONE_COMMIT" \
|
||||
--directory "hetzner-cloud" \
|
||||
--variable hcloud_token="$HCLOUD_TOKEN" \
|
||||
--variable use_subdomain=true \
|
||||
--variable private_network_id="$HCLOUD_PRIVATE_NETWORK_ID" \
|
||||
--yes \
|
||||
"Hetzner-Cloud"
|
||||
environment:
|
||||
CODER_URL: https://ide.icb4dc0.de
|
||||
CODER_SESSION_TOKEN:
|
||||
from_secret: coder_token
|
||||
HCLOUD_TOKEN:
|
||||
from_secret: hcloud_token
|
||||
HCLOUD_PRIVATE_NETWORK_ID:
|
||||
from_secret: hcloud_private_network_id
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -1 +1,3 @@
|
|||
*.tar
|
||||
*.tar
|
||||
.terraform/
|
||||
*.lock.hcl
|
|
@ -252,13 +252,13 @@ resource "tls_private_key" "rsa_4096" {
|
|||
}
|
||||
|
||||
resource "hcloud_ssh_key" "root" {
|
||||
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
|
||||
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
|
||||
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"
|
||||
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}"
|
||||
server_type = data.coder_parameter.instance_type.value
|
||||
location = data.coder_parameter.instance_location.value
|
||||
image = data.coder_parameter.instance_os.value
|
||||
|
@ -289,10 +289,14 @@ resource "hcloud_server" "root" {
|
|||
}
|
||||
|
||||
resource "hcloud_volume" "root" {
|
||||
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
|
||||
name = "coder-${data.coder_workspace.me.id}-home"
|
||||
size = data.coder_parameter.volume_size.value
|
||||
format = "ext4"
|
||||
location = data.coder_parameter.instance_location.value
|
||||
|
||||
lifecycle {
|
||||
ignore_changes = all
|
||||
}
|
||||
}
|
||||
|
||||
resource "hcloud_volume_attachment" "root" {
|
||||
|
@ -303,7 +307,7 @@ resource "hcloud_volume_attachment" "root" {
|
|||
}
|
||||
|
||||
resource "hcloud_firewall" "root" {
|
||||
name = "coder-${data.coder_workspace.me.owner}-${data.coder_workspace.me.name}-root"
|
||||
name = "coder-${data.coder_workspace.me.owner_id}-${data.coder_workspace.me.id}-root"
|
||||
rule {
|
||||
direction = "in"
|
||||
protocol = "icmp"
|
Loading…
Reference in a new issue