diff --git a/.gitignore b/.gitignore index d2d001d4..5a255ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ *.pyc *.retry +*.terraform +*.tfstate* /borg-keys/ diff --git a/README.md b/README.md index 2939dfff..9a22e642 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,20 @@ In order to use this, you need to install packer and then run This will take some time after which a new snapshot will have been created on the primary hcloud archlinux project. +##### Note about terraform + +We use terraform to provision a part of the infrastructure on hcloud. +In order to use this, you need to install terraform and then run + + terraform plan -var $(./packer/get_hetzner_cloud_api_key.sh) terraform + +This will show you planned changes between the current infrastructure and the desired infrastructure. +You can then run + + terraform apply -var $(./packer/get_hetzner_cloud_api_key.sh) terraform + +to actually apply your changes. + ##### Note about opendkim The opendkim DNS data has to be added to DNS manually. The roles verifies that the DNS is correct before starting opendkim. diff --git a/terraform/archlinux.tf b/terraform/archlinux.tf new file mode 100644 index 00000000..eede0abe --- /dev/null +++ b/terraform/archlinux.tf @@ -0,0 +1,27 @@ +variable "hetzner_cloud_api_key" {} + +# Find the id using `hcloud image list` +variable "archlinux_image_id" { + default = "2923545" +} + +provider "hcloud" { + token = "${var.hetzner_cloud_api_key}" +} + +resource "hcloud_floating_ip" "bbs" { + type = "ipv4" + server_id = "${hcloud_server.bbs.id}" +} + +resource "hcloud_rdns" "bbs" { + floating_ip_id = "${hcloud_floating_ip.bbs.id}" + ip_address = "${hcloud_floating_ip.bbs.ip_address}" + dns_ptr = "bbs.archlinux.org" +} + +resource "hcloud_server" "bbs" { + name = "bbs.archlinux.org" + image = "${var.archlinux_image_id}" + server_type = "cx11" +}