From dc853c12680c71fa16c3c912603bd110d7c25cfd Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sun, 2 Aug 2020 18:52:39 -0300 Subject: Use a name from the environment for the names of the host and the volume --- secrets/secret-envrc.sh | Bin 2524 -> 2708 bytes vps.tf | 14 ++++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/secrets/secret-envrc.sh b/secrets/secret-envrc.sh index 4f97639..02f4ab6 100644 Binary files a/secrets/secret-envrc.sh and b/secrets/secret-envrc.sh differ diff --git a/vps.tf b/vps.tf index 85ee061..40c6b93 100644 --- a/vps.tf +++ b/vps.tf @@ -20,6 +20,16 @@ variable "nextcloud_tld_prefix" { description = "DNS prefix used for the Nextcloud installation. Does not contain a dot at the end." } +variable "hostname" { + type = string + description = "Human name of the host. This is a pet name, not cattle name :)" +} + +variable "volume_name" { + type = string + description = "Name of the volume, which will also be the name of it's mount point." +} + # DigitalOcean provider "digitalocean" { @@ -36,7 +46,7 @@ resource "digitalocean_ssh_key" "client" { resource "digitalocean_droplet" "vps" { image = "ubuntu-18-04-x64" - name = "sovereignty" + name = var.hostname region = "nyc3" size = "s-1vcpu-1gb" backups = true @@ -64,7 +74,7 @@ resource "digitalocean_droplet" "vps" { resource "digitalocean_volume" "vps_persistent_volume" { region = "nyc3" - name = "${digitalocean_droplet.vps.name}-volume" + name = var.volume_name size = 10 initial_filesystem_type = "ext4" description = "Persistent disk to store docker volumes contents across droplets being created and destroyed" -- cgit v1.2.3