1
1
Fork 0
mirror of https://gitlab.archlinux.org/archlinux/infrastructure.git synced 2024-05-05 12:56:03 +02:00

Add basic terraform config

This commit is contained in:
Sven-Hendrik Haase 2019-02-14 06:45:18 +01:00
parent d5cc2fa74c
commit 40090ebe1f
3 changed files with 43 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.pyc *.pyc
*.retry *.retry
*.terraform
*.tfstate*
/borg-keys/ /borg-keys/

View File

@ -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. 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 ##### 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. The opendkim DNS data has to be added to DNS manually. The roles verifies that the DNS is correct before starting opendkim.

27
terraform/archlinux.tf Normal file
View File

@ -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"
}