betamike-infra/terraform/matrix.tf

40 lines
944 B
Terraform
Raw Permalink Normal View History

data "digitalocean_image" "nixos_base" {
name = "nixos-base"
}
resource "digitalocean_droplet" "matrix-0" {
name = "matrix-0"
image = data.digitalocean_image.nixos_base.id
region = "nyc3"
size = "s-2vcpu-2gb"
ssh_keys = [data.digitalocean_ssh_key.mops.id]
}
resource "digitalocean_volume" "matrix" {
region = "nyc3"
name = "matrix-storage"
2023-02-16 14:05:16 +00:00
size = 50
initial_filesystem_type = "ext4"
}
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
}
}