Add vultr cloud

This commit is contained in:
Serge Logvinov
2021-09-14 22:04:26 +03:00
parent e6596c7961
commit dd89eed0fa
7 changed files with 117 additions and 0 deletions

9
system_os/vultr/Makefile Normal file
View File

@@ -0,0 +1,9 @@
init:
packer init -upgrade .
release:
packer build -only=release.vultr.talos .
develop:
packer build -only=develop.vultr.talos .

View File

@@ -0,0 +1,19 @@
variable "vultr_api_key" {
type = string
default = ""
}
variable "vultr_region" {
type = string
default = ""
}
variable "talos_version" {
type = string
default = "v0.13.0"
}
locals {
image = "https://github.com/talos-systems/talos/releases/download/${var.talos_version}/vultr-amd64.raw.xz"
}

View File

@@ -0,0 +1,53 @@
packer {
required_plugins {
vultr = {
version = ">= 2.4.0"
source = "github.com/vultr/vultr"
}
}
}
source "vultr" "talos" {
api_key = var.vultr_api_key
region_id = var.vultr_region
plan_id = "vc2-1c-1gb"
# Arch Linux
iso_id = "20eceb4f-7b28-466e-aaf4-cff60385c30d"
state_timeout = "10m"
ssh_username = "root"
ssh_password = "packer"
instance_label = "talos"
snapshot_description = "talos system disk"
}
# FIXME
build {
name = "release"
sources = ["source.vultr.talos"]
provisioner "shell" {
inline = [
"apt-get install -y wget",
"wget -O /tmp/talos.raw.xz ${local.image}",
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/vda",
]
}
}
build {
name = "develop"
sources = ["source.vultr.talos"]
provisioner "file" {
source = "../../../talos-pr/_out/vultr-amd64.raw.xz"
destination = "/tmp/talos.raw.xz"
}
provisioner "shell" {
inline = [
"xz -d -c /tmp/talos.raw.xz | dd of=/dev/vda",
]
}
}

6
vultr/auth.tf Normal file
View File

@@ -0,0 +1,6 @@
provider "vultr" {
api_key = var.vultr_api_key
rate_limit = 700
retry_limit = 3
}

17
vultr/main.tf Normal file
View File

@@ -0,0 +1,17 @@
resource "vultr_instance" "controlplane" {
plan = "vc2-1c-1gb"
region = "ams"
snapshot_id = "0d6f3e7b-62e6-429b-ac53-53108843ee21"
label = "talos"
tag = "controlplane"
hostname = "master-1"
enable_ipv6 = true
private_network_ids = ["329f9a26-d475-41f0-8e1f-b8cf11814848"]
user_data = file("talos.yaml")
backups = "disabled"
ddos_protection = false
activation_email = false
}

5
vultr/variables.tf Normal file
View File

@@ -0,0 +1,5 @@
variable "vultr_api_key" {
type = string
sensitive = true
}

8
vultr/versions.tf Normal file
View File

@@ -0,0 +1,8 @@
terraform {
required_providers {
vultr = {
source = "vultr/vultr"
version = "2.4.1"
}
}
}