From 90c61d7c00e5fa54e8af7e4be193f0374464db0e Mon Sep 17 00:00:00 2001 From: shockrah Date: Sun, 15 Dec 2024 22:24:35 -0800 Subject: [PATCH] Fixing the heredoc issues and removing the old immich server --- infra/static-vultr/build.sh | 36 +++++++++++++++++++ infra/static-vultr/immich-server.tf | 22 ------------ infra/static-vultr/output.tf | 7 ---- infra/static-vultr/ssh.tf | 14 +------- .../{generic.tfvars => variables.tfvars} | 0 5 files changed, 37 insertions(+), 42 deletions(-) create mode 100644 infra/static-vultr/build.sh delete mode 100644 infra/static-vultr/immich-server.tf rename infra/static-vultr/{generic.tfvars => variables.tfvars} (100%) diff --git a/infra/static-vultr/build.sh b/infra/static-vultr/build.sh new file mode 100644 index 0000000..02324bd --- /dev/null +++ b/infra/static-vultr/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + +set -e + +opt=$1 +plan=tfplan + +build_plan() { + echo Generating plan + set -x + terraform plan -var-file variables.tfvars -input=false -out $plan +} + +deploy_plan() { + terraform apply $plan +} + +init() { + terraform init +} + +help_prompt() { + cat <<- EOF + Options: plan deploy help + EOF +} + +# Default to building a plan +source ./secrets.sh +case $opt in + plan) build_plan;; + deploy) deploy_plan;; + init) init;; + *) help_prompt;; +esac + diff --git a/infra/static-vultr/immich-server.tf b/infra/static-vultr/immich-server.tf deleted file mode 100644 index 20d9c39..0000000 --- a/infra/static-vultr/immich-server.tf +++ /dev/null @@ -1,22 +0,0 @@ -# Here we define the resources for our temporary immich server - -resource vultr_instance immich { - plan = var.host.plan - region = var.host.region - os_id = var.host.os - enable_ipv6 = true - - # Enable backups for now since we're getting off of s3 as well at some point - backups = "enabled" - backups_schedule { - type = "weekly" - dow = var.host.backups.day - hour = var.host.backups.hour - } - - ssh_key_ids = [ vultr_ssh_key.immich.id ] - firewall_group_id = vultr_firewall_group.host.id - label = "Immich Server" -} - - diff --git a/infra/static-vultr/output.tf b/infra/static-vultr/output.tf index 5edd7ed..3d90ccd 100644 --- a/infra/static-vultr/output.tf +++ b/infra/static-vultr/output.tf @@ -14,10 +14,3 @@ output vultr_key_id { } -output immich_key { - sensitive = true - # value = tls_private_key.host.private_key_openssh - value = vultr_instance.immich.default_password -} - - diff --git a/infra/static-vultr/ssh.tf b/infra/static-vultr/ssh.tf index dc2ebe1..f17d85d 100644 --- a/infra/static-vultr/ssh.tf +++ b/infra/static-vultr/ssh.tf @@ -5,18 +5,6 @@ resource tls_private_key host { resource vultr_ssh_key host { name = "static_ssh_key" - ssh_key = tls_private_key.host.public_key_openssh + ssh_key = chomp(tls_private_key.host.public_key_openssh) } -#################### -# Immich keys # -#################### -resource tls_private_key immich { - algorithm = "RSA" - rsa_bits = 4096 -} - -resource vultr_ssh_key immich { - name = "static_ssh_key" - ssh_key = tls_private_key.immich.public_key_openssh -} diff --git a/infra/static-vultr/generic.tfvars b/infra/static-vultr/variables.tfvars similarity index 100% rename from infra/static-vultr/generic.tfvars rename to infra/static-vultr/variables.tfvars