2020-11-09 15:20:09 +00:00
|
|
|
data "digitalocean_image" "nixos_base" {
|
|
|
|
name = "nixos-base"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_volume" "matrix" {
|
|
|
|
region = "nyc3"
|
|
|
|
name = "matrix-storage"
|
|
|
|
size = 10
|
|
|
|
initial_filesystem_type = "ext4"
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_droplet" "matrix-0" {
|
|
|
|
name = "matrix-0"
|
|
|
|
|
|
|
|
image = data.digitalocean_image.nixos_base.id
|
|
|
|
region = "nyc3"
|
2020-11-10 07:15:13 +00:00
|
|
|
size = "s-2vcpu-2gb"
|
2020-11-09 15:20:09 +00:00
|
|
|
|
|
|
|
ssh_keys = [data.digitalocean_ssh_key.mops.id]
|
|
|
|
}
|
|
|
|
|
|
|
|
resource "digitalocean_volume_attachment" "matrix" {
|
|
|
|
droplet_id = digitalocean_droplet.matrix-0.id
|
|
|
|
volume_id = digitalocean_volume.matrix.id
|
|
|
|
}
|
|
|
|
|
|
|
|
module "deploy_nixos" {
|
|
|
|
source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=d055d2180da230e47ba9082fc53a8b7d1fadbc43"
|
|
|
|
|
|
|
|
nixos_config = "../nixos_configs/matrix.nix"
|
|
|
|
|
|
|
|
target_user = "root"
|
|
|
|
target_host = digitalocean_droplet.matrix-0.ipv4_address
|
|
|
|
|
|
|
|
triggers = {
|
|
|
|
// Also re-deploy whenever the VM is re-created
|
|
|
|
instance_id = digitalocean_droplet.matrix-0.id
|
|
|
|
}
|
|
|
|
}
|