Terraform and DNS
-
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
terraform {
required_providers {
dns = {
source = "hashicorp/dns"
}
}This requires:
-
A corresponding
variable "dns_secret" {...}declaration. -
An e.g.,
export TF_VAR_dns_secret = "sVfw2a...vAUqw=="(non - versioned!) environment variable.
provider "dns" {
update {
server = "ns1.sdi.hdm-stuttgart.cloud"
key_name = "g12.key." # Corresponding to your group e.g., Group 12
key_algorithm = "hmac-sha512"
key_secret = var.dns_secret
}
}This requires:
-
A corresponding
variable "dns_secret" {...}declaration. -
An e.g.,
export TF_VAR_dns_secret = "sVfw2a...vAUqw=="(non - versioned!) environment variable.
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
} No. 21
Creating DNS records
|
Q: |
In this exercise we start from a domain gxy.sdi.hdm-stuttgart.cloud not yet containing any »A« or »CNAME« records. The aim is using Terraform to create:
Provide proper variables representing:
This way your Terraform configuration remains flexible. You may follow the subsequent steps each time testing your result: dig +noall +answer @ns1.hdm-stuttgart.cloud -y $HMAC -t AXFR gxy.sdi.hdm-stuttgart.cloud
|
No. 22
Creating a host with corresponding DNS entries
|
Q: |
Extend Solving the Use the server's common DNS name
rather than its IP in the generated
|
No. 23
Creating a fixed number of servers
|
Q: |
Write a Terraform configuration
for deploying a configurable number of servers being defined by
the following terraform
|
