flake/infra/vultr.tf

37 lines
784 B
Terraform
Raw Normal View History

2024-09-21 16:21:30 +00:00
locals {
2024-09-27 16:03:31 +00:00
vultr_nodes = {
2024-09-21 16:21:30 +00:00
sin0 = {
region = "sgp"
plan = "vhp-1c-1gb-amd"
2024-09-21 20:19:03 +00:00
tags = ["vultr", "proxy"]
2024-09-21 16:21:30 +00:00
}
}
}
2024-09-22 08:31:40 +00:00
# https://github.com/NickCao/netboot
2024-09-21 16:21:30 +00:00
resource "vultr_startup_script" "script" {
name = "nixos"
type = "pxe"
script = base64encode(<<EOT
#!ipxe
set cmdline sshkey="ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMmd/uqiBahzKcKMJ+gT3dkUIdrWQgudspsDchDlx1E/"
2024-09-22 08:31:40 +00:00
chain http://nixos.icu
2024-09-21 16:21:30 +00:00
EOT
)
}
module "vultr" {
source = "./modules/vultr"
2024-09-27 16:03:31 +00:00
for_each = local.vultr_nodes
2024-09-21 16:21:30 +00:00
hostname = each.key
fqdn = "${each.key}.ny4.dev"
region = each.value.region
plan = each.value.plan
tags = each.value.tags
script = vultr_startup_script.script.id
}
2024-09-22 08:31:23 +00:00
resource "vultr_object_storage" "storage" {
cluster_id = 4 # sgp1.vultrobjects.com
}