36 lines
853 B
Terraform
36 lines
853 B
Terraform
|
resource "digitalocean_volume" "git" {
|
||
|
region = "nyc3"
|
||
|
name = "git-storage-1"
|
||
|
size = 1
|
||
|
initial_filesystem_type = "ext4"
|
||
|
}
|
||
|
|
||
|
resource "digitalocean_droplet" "git-1" {
|
||
|
name = "git-1"
|
||
|
|
||
|
image = data.digitalocean_image.nixos_base.id
|
||
|
region = "nyc3"
|
||
|
size = "s-1vcpu-1gb"
|
||
|
|
||
|
ssh_keys = [data.digitalocean_ssh_key.mops.id]
|
||
|
}
|
||
|
|
||
|
resource "digitalocean_volume_attachment" "git" {
|
||
|
droplet_id = digitalocean_droplet.git-1.id
|
||
|
volume_id = digitalocean_volume.git.id
|
||
|
}
|
||
|
|
||
|
module "deploy_nixos_git" {
|
||
|
source = "github.com/tweag/terraform-nixos//deploy_nixos?ref=d055d2180da230e47ba9082fc53a8b7d1fadbc43"
|
||
|
|
||
|
nixos_config = "../nixos_configs/git.nix"
|
||
|
|
||
|
target_user = "root"
|
||
|
target_host = digitalocean_droplet.git-1.ipv4_address
|
||
|
|
||
|
triggers = {
|
||
|
// Also re-deploy whenever the VM is re-created
|
||
|
instance_id = digitalocean_droplet.git-1.id
|
||
|
}
|
||
|
}
|