Skip to content

Instantly share code, notes, and snippets.

@sveba
Created July 27, 2020 12:11
Show Gist options
  • Save sveba/e4c95afb4f5b9c78ff9de059d83bee85 to your computer and use it in GitHub Desktop.
Save sveba/e4c95afb4f5b9c78ff9de059d83bee85 to your computer and use it in GitHub Desktop.
variable "hcloud_token" {}
terraform {
backend "s3" {
bucket = "hetzner-wireguard"
key = "wg/terraform.tfstate"
region = "eu-west-1"
profile = "private"
}
}
provider "hcloud" {
token = var.hcloud_token
}
provider "aws" {
version = "~> 2.0"
region = "eu-west-1"
profile = "private"
}
data "aws_route53_zone" "autom8" {
name = "autom8.de."
}
resource "aws_route53_record" "wireguard" {
zone_id = data.aws_route53_zone.autom8.zone_id
name = "vpn.${data.aws_route53_zone.autom8.name}"
type = "A"
ttl = "300"
records = [hcloud_server.vpn.ipv4_address]
}
resource "hcloud_server" "vpn" {
name = "wireguard"
image = "ubuntu-20.04"
server_type = "cx11"
ssh_keys = ["shari"]
datacenter = "nbg1-dc3"
user_data = file("ubuntu-20.04.yaml")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment