commit 7c3887b62d3664846b5dfdeba2d471720e8aafb5
parent 1a104a0e1d9e9ec97df2a663fa7ec71b535eb724
Author: pyratebeard <root@pyratebeard.net>
Date: Tue, 7 Feb 2023 17:06:13 +0000
basic hetzner instance config
Diffstat:
4 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/hetzner/data.tf b/hetzner/data.tf
@@ -0,0 +1,3 @@
+data "hcloud_ssh_key" "pyrategpgssh" {
+ name = "pyrategpgssh"
+}
diff --git a/hetzner/infra.tf b/hetzner/infra.tf
@@ -0,0 +1,10 @@
+resource "hcloud_server" "test" {
+ image = "ubuntu-20.04"
+ count = 1
+ name = var.hostname
+ location = "hel1"
+ server_type = "cx11"
+ ssh_keys = [
+ data.hcloud_ssh_key.pyrategpgssh.id
+ ]
+}
diff --git a/hetzner/provider.tf b/hetzner/provider.tf
@@ -0,0 +1,12 @@
+terraform {
+ required_providers {
+ hcloud = {
+ source = "hetznercloud/hcloud"
+ }
+ }
+}
+
+provider "hcloud" {
+ token = var.hcloud_token
+}
+
diff --git a/hetzner/variables.tf b/hetzner/variables.tf
@@ -0,0 +1,17 @@
+variable "hcloud_token" {
+ type = string
+ description = "hcloud api token"
+ default = ""
+}
+
+variable "hostname" {
+ type = string
+ description = "hostname of system"
+ default = "test"
+}
+
+variable "instance_count" {
+ type = string
+ description = "number of instances to create"
+ default = "1"
+}