Terraform and DNS

Figure 1033. 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 1034. DNS provider Slide presentation
provider "dns" {
  update {
    server        = "ns1.sdi.hdm-stuttgart.cloud"
    key_name      = "gxy.key."  # Corresponding to your group
    key_algorithm = "hmac-sha512"
    key_secret    = "gas4rFgjT..." # Please choose a more secure option 
                                   # e.g. an environment variable! 
  }
}

Figure 1035. 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.