main
parent 872995d867
commit 498077c9be
  1. 64
      hetznercloud.tf
  2. 4
      outputs.tf
  3. 6
      stack.tf
  4. 6
      versions.tf

@ -0,0 +1,64 @@
variable "h_network_cidr" {
default = "10.101.0.0/24"
}
variable "h_subnet_euc_cidr" {
default = "10.101.0.0/24"
}
resource "hcloud_network" "net0" {
name = "net0"
ip_range = var.h_network_cidr
}
resource "hcloud_network_subnet" "subnet0" {
network_id = hcloud_network.net0.id
type = "cloud"
network_zone = "eu-central"
ip_range = var.h_subnet_euc_cidr
}
resource "hcloud_ssh_key" "default" {
name = "mathom"
public_key = var.ssh_public_key
}
resource "hcloud_firewall" "fw0" {
name = "fw0"
rule {
direction = "in"
protocol = "tcp"
port = "22"
source_ips = [
"0.0.0.0/0",
"::/0"
]
}
}
resource "hcloud_server" "euc-auth-0" {
name = "euc-auth-0"
image = "ubuntu-20.04"
server_type = "cx11"
ssh_keys = [hcloud_ssh_key.default.id]
location = "fsn1"
firewall_ids = [hcloud_firewall.fw0.id]
network {
network_id = hcloud_network.net0.id
}
depends_on = [
hcloud_network_subnet.subnet0
]
}
resource "cloudflare_record" "euc-auth-0" {
zone_id = cloudflare_zone.sudois.id
type = "A"
name = "euc-auth-0"
value = hcloud_server.euc-auth-0.ipv4_address
ttl = 60
}

@ -15,6 +15,10 @@ output "oci" {
output "fra0" {
value = digitalocean_droplet.fra0.ipv4_address
}
output "euc-auth-0" {
value = hcloud_server.euc-auth-0.ipv4_address
}
output "mainframe" {
value = local.mainframe_ip
}

@ -4,6 +4,8 @@ variable "cf_token_custom" {}
variable "cf_token_general" {}
variable "cf_email" {}
variable "h_token" {}
provider "digitalocean" {
token = var.do_token
}
@ -13,3 +15,7 @@ provider "cloudflare" {
api_token = var.cf_token_custom
#api_key = var.cf_token_general
}
provider "hcloud" {
token = var.h_token
}

@ -8,5 +8,11 @@ terraform {
digitalocean = {
source = "digitalocean/digitalocean"
}
hcloud = {
source = "hetznercloud/hcloud"
}
oci = {
source = "hashicorp/oci"
}
}
}

Loading…
Cancel
Save