Commit e4c51998 authored by Frederik Schwan's avatar Frederik Schwan
Browse files

Merge branch 'terraform-move-machines' into 'master'

terraform: move handling of machines into variables

See merge request !238
parents 053fa0fc fc13e31a
Pipeline #4162 passed with stage
in 43 seconds
......@@ -24,10 +24,7 @@ something hosted below one of our domains is official).
1. [ ] At this point, we'll need to add some stuff to the `archlinux_org_gitlab_pages` variable in `archlinux.tf`. It should look something like this.
Make sure to substitute the `your-domain` and `your-code-shown-by-gitlab` strings accordingly:
{
name = "your-domain"
verification_code = "your-code-shown-by-gitlab"
}
"your-domain" = "your-code-shown-by-gitlab"
1. [ ] Run `terraform apply` and go back to GitLab. Hit `Verify` and it should pick up the new domain
verification code. It should then also automatically begin fetching a certificate via Let's
......
This diff is collapsed.
# This files contains template handling for the main archlinux.tf file
resource "hetznerdns_record" "archlinux_org_gitlab_pages_cname" {
for_each = local.archlinux_org_gitlab_pages
zone_id = hetznerdns_zone.archlinux.id
name = each.key
value = "pages.archlinux.org."
type = "CNAME"
}
resource "hetznerdns_record" "archlinux_org_gitlab_pages_verification_code_txt" {
for_each = local.archlinux_org_gitlab_pages
zone_id = hetznerdns_zone.archlinux.id
name = "_gitlab-pages-verification-code.${each.value}"
value = "gitlab-pages-verification-code=${each.value}"
type = "TXT"
}
resource "hetznerdns_record" "pkgbuild_org_a" {
for_each = local.pkgbuild_com_a_aaaa
zone_id = hetznerdns_zone.pkgbuild.id
name = each.key
ttl = lookup(local.pkgbuild_com_a_aaaa[each.key], "ttl", null)
value = each.value.ipv4_address
type = "A"
}
resource "hetznerdns_record" "pkgbuild_org_aaaa" {
for_each = local.pkgbuild_com_a_aaaa
zone_id = hetznerdns_zone.pkgbuild.id
name = each.key
ttl = lookup(local.pkgbuild_com_a_aaaa[each.key], "ttl", null)
value = each.value.ipv6_address
type = "AAAA"
}
resource "hetznerdns_record" "archlinux_org_a" {
for_each = local.archlinux_org_a_aaaa
zone_id = hetznerdns_zone.archlinux.id
name = each.key
ttl = lookup(local.archlinux_org_a_aaaa[each.key], "ttl", null)
value = each.value.ipv4_address
type = "A"
}
resource "hetznerdns_record" "archlinux_org_aaaa" {
for_each = local.archlinux_org_a_aaaa
zone_id = hetznerdns_zone.archlinux.id
name = each.key
ttl = lookup(local.archlinux_org_a_aaaa[each.key], "ttl", null)
value = each.value.ipv6_address
type = "AAAA"
}
resource "hetznerdns_record" "archlinux_org_cname" {
for_each = local.archlinux_org_cname
zone_id = hetznerdns_zone.archlinux.id
name = each.key
ttl = lookup(local.archlinux_org_cname[each.key], "ttl", null)
value = each.value.value
type = "CNAME"
}
resource "hcloud_rdns" "rdns_ipv4" {
for_each = local.machines
server_id = hcloud_server.machine[each.key].id
ip_address = hcloud_server.machine[each.key].ipv4_address
dns_ptr = each.key
}
resource "hcloud_rdns" "rdns_ipv6" {
for_each = local.machines
server_id = hcloud_server.machine[each.key].id
ip_address = hcloud_server.machine[each.key].ipv6_address
dns_ptr = each.key
}
resource "hcloud_server" "machine" {
for_each = local.machines
name = each.value.domain
image = data.hcloud_image.archlinux.id
server_type = each.value.server_type
lifecycle {
ignore_changes = [image]
}
}
resource "hetznerdns_record" "machine_a" {
for_each = local.machines
zone_id = lookup(local.machines[each.key], "zone", hetznerdns_zone.archlinux.id)
name = each.value.domain
ttl = lookup(local.machines[each.key], "ttl", null)
value = hcloud_server.machine[each.key].ipv4_address
type = "A"
}
resource "hetznerdns_record" "machine_aaaa" {
for_each = local.machines
zone_id = lookup(local.machines[each.key], "zone", hetznerdns_zone.archlinux.id)
name = each.value.domain
ttl = lookup(local.machines[each.key], "ttl", null)
value = hcloud_server.machine[each.key].ipv6_address
type = "AAAA"
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment