2020-12-03 21:26:28 +00:00
|
|
|
provider "digitalocean" {
|
|
|
|
token = var.do_token
|
|
|
|
spaces_access_id = var.spaces_access_id
|
|
|
|
spaces_secret_key = var.spaces_secret_key
|
|
|
|
}
|
|
|
|
|
2021-01-07 16:28:25 +00:00
|
|
|
module "packer_droplet" {
|
|
|
|
source = "../../../terraform-modules/packer_droplet"
|
|
|
|
name = "syncthing"
|
|
|
|
do_token = var.do_token
|
|
|
|
spaces_access_id = var.spaces_access_id
|
|
|
|
spaces_secret_key = var.spaces_secret_key
|
2020-12-03 21:37:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_volume" "syncthing_volume" {
|
2020-12-31 21:22:41 +00:00
|
|
|
name = "syncthing-volume"
|
|
|
|
description = "The volume to hold the default Sync folder"
|
|
|
|
region = "nyc1"
|
|
|
|
size = 100
|
|
|
|
initial_filesystem_label = "syncthing-volume"
|
|
|
|
initial_filesystem_type = "ext4"
|
2021-01-22 16:42:39 +00:00
|
|
|
tags = ["terraform"]
|
2020-12-31 21:22:41 +00:00
|
|
|
|
|
|
|
lifecycle {
|
|
|
|
prevent_destroy = true
|
|
|
|
}
|
2020-12-03 21:26:28 +00:00
|
|
|
}
|
2021-01-07 16:28:25 +00:00
|
|
|
|
|
|
|
resource "digitalocean_volume_attachment" "syncthing" {
|
|
|
|
droplet_id = module.packer_droplet.droplet_id
|
|
|
|
volume_id = digitalocean_volume.syncthing_volume.id
|
|
|
|
}
|