Terraform and DNS

Figure 1027. Bind server ns1.sdi.hdm-stuttgart.cloud Slide presentation
  • Providing DNS info for sdi.hdm-stuttgart.cloud and sub-zones:

    • g01.sdi.hdm-stuttgart.cloud

    • g02.sdi.hdm-stuttgart.cloud

    • ...

  • Remote API for per-zone editing


Figure 1028. DNS provider Slide presentation
provider "dns" {
  update {
    server        = "ns1.sdi.hdm-stuttgart.cloud"
    key_name      = "goik.key."
    key_algorithm = "hmac-sha512"
    key_secret    = file("../dnsupdatetoken.key")
  }
}

Figure 1029. Defining an A record Slide presentation
resource "dns_a_record_set" "helloRecord" {
  zone = "${var.dnsSubnetName}." # The dot matters!
  name = hcloud_server.helloServer.name
  addresses = [hcloud_server.helloServer.ipv4_address]
  ttl = 10
}

exercise No. 13

Creating a host with corresponding DNS entry

Q:

Extend Solving ~/.ssh/known_hosts quirk by adding an A-record. The generated IP4 address shall be bound to host www within your given zone.