aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2020-08-02 18:52:39 -0300
committerEuAndreh <eu@euandre.org>2020-08-02 18:52:39 -0300
commitdc853c12680c71fa16c3c912603bd110d7c25cfd (patch)
tree93e5fcf6479d09cde6f46c007d66fbcaac195f07
parentvps.tf: Name VPS volume derived from droplet name (diff)
downloadserver-dc853c12680c71fa16c3c912603bd110d7c25cfd.tar.gz
server-dc853c12680c71fa16c3c912603bd110d7c25cfd.tar.xz
Use a name from the environment for the names of the host and the volume
-rw-r--r--secrets/secret-envrc.shbin2524 -> 2708 bytes
-rw-r--r--vps.tf14
2 files changed, 12 insertions, 2 deletions
diff --git a/secrets/secret-envrc.sh b/secrets/secret-envrc.sh
index 4f97639..02f4ab6 100644
--- a/secrets/secret-envrc.sh
+++ b/secrets/secret-envrc.sh
Binary files 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"